remove an extenderitem from his group when is dragged away. makes drag and drop of items actually working

svn path=/trunk/KDE/kdelibs/; revision=1113017
This commit is contained in:
Marco Martin 2010-04-09 17:59:56 +00:00
parent 43a7dbe1f6
commit 937892d2ee

View File

@ -374,6 +374,7 @@ void ExtenderItem::setGroup(ExtenderGroup *group)
return; return;
} }
ExtenderGroup *oldGroup = d->group;
d->group = group; d->group = group;
if (group) { if (group) {
@ -385,6 +386,9 @@ void ExtenderItem::setGroup(ExtenderGroup *group)
} }
group->d->addItemToGroup(this); group->d->addItemToGroup(this);
} else { } else {
if (oldGroup) {
oldGroup->d->removeItemFromGroup(this);
}
config().deleteEntry("group"); config().deleteEntry("group");
} }
} }
@ -631,6 +635,10 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
group->collapseGroup(); group->collapseGroup();
} }
if (!isGroup() && this->group()) {
setGroup(0);
}
//and execute the drag. //and execute the drag.
QWidget *dragParent = extender()->d->applet->view(); QWidget *dragParent = extender()->d->applet->view();
QDrag *drag = new QDrag(dragParent); QDrag *drag = new QDrag(dragParent);