addApplet function

offers a crude support to applet migration between containments
This commit is contained in:
Marco Martin 2014-05-12 21:07:41 +02:00
parent 97831b616f
commit cdb9c8c1cc
2 changed files with 14 additions and 0 deletions

View File

@ -245,6 +245,18 @@ QObject *ContainmentInterface::containmentAt(int x, int y)
return 0;
}
void ContainmentInterface::addApplet(AppletInterface *applet)
{
if (!applet || applet->applet()->containment() == containment()) {
return;
}
blockSignals(true);
containment()->addApplet(applet->applet());
blockSignals(false);
emit appletAdded(applet, QCursor::pos().x(), QCursor::pos().y());
}
void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y)
{
if (!mimeData) {

View File

@ -117,6 +117,8 @@ public:
Q_INVOKABLE QObject *containmentAt(int x, int y);
Q_INVOKABLE void addApplet(AppletInterface *applet);
static ContainmentInterface *qmlAttachedProperties(QObject *object)
{
return qobject_cast<ContainmentInterface *>(AppletQuickItem::qmlAttachedProperties(object));