hack to make possible to set the applet position
when a dnd operation is done, set the applet position before emitting the appletAdded signal
This commit is contained in:
parent
f3729cac2d
commit
e00070da7e
@ -171,7 +171,23 @@ void ContainmentInterface::processMimeData(QMimeData *data, int x, int y)
|
||||
foreach (const QString &appletName, appletNames) {
|
||||
qDebug() << "adding" << appletName;
|
||||
QRectF geom(QPoint(x, y), QSize(0, 0));
|
||||
containment()->createApplet(appletName);
|
||||
//HACK
|
||||
//This is necessary to delay the appletAdded signal (of containmentInterface) AFTER the applet graphics object has been created
|
||||
blockSignals(true);
|
||||
Plasma::Applet *applet = containment()->createApplet(appletName);
|
||||
|
||||
QObject *appletGraphicObject;
|
||||
if (applet) {
|
||||
appletGraphicObject = applet->property("graphicObject").value<QObject *>();
|
||||
if (appletGraphicObject) {
|
||||
appletGraphicObject->setProperty("x", x);
|
||||
appletGraphicObject->setProperty("y", y);
|
||||
}
|
||||
}
|
||||
|
||||
blockSignals(false);
|
||||
emit appletAdded(appletGraphicObject);
|
||||
emit appletsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user