delay itemAddedEvent at the end of the event loop:

if an item is added in a group right after creation, an itemAddedEvent shouldn't happen at all

svn path=/trunk/KDE/kdelibs/; revision=1177226
This commit is contained in:
Marco Martin 2010-09-19 19:47:23 +00:00
parent f16e46eb86
commit 8992e628f8
2 changed files with 11 additions and 2 deletions

View File

@ -612,8 +612,7 @@ void ExtenderPrivate::addExtenderItem(ExtenderItem *item, const QPointF &pos)
QObject::connect(item, SIGNAL(destroyed(ExtenderItem*)), q, SLOT(extenderItemDestroyed(ExtenderItem*)));
attachedExtenderItems.append(item);
q->itemHoverLeaveEvent(item);
q->itemAddedEvent(item, pos);
emit q->itemAttached(item);
QTimer::singleShot(0, q, SLOT(delayItemAddedEvent()));
}
void ExtenderPrivate::removeExtenderItem(ExtenderItem *item)
@ -750,6 +749,15 @@ void ExtenderPrivate::updateBorders()
}
}
void ExtenderPrivate::delayItemAddedEvent()
{
while (!pendingItems.isEmpty()) {
QPair<Plasma::ExtenderItem *, QPointF> item = pendingItems.first();
q->itemAddedEvent(item.first, item.second);
pendingItems.pop_front();
}
}
void ExtenderPrivate::updateEmptyExtenderLabel()
{
if (q->isEmpty() && !emptyExtenderLabel &&

View File

@ -303,6 +303,7 @@ class PLASMA_EXPORT Extender : public QGraphicsWidget
private:
ExtenderPrivate *const d;
Q_PRIVATE_SLOT(d, void delayItemAddedEvent())
Q_PRIVATE_SLOT(d, void extenderItemDestroyed(ExtenderItem *item))
friend class ExtenderPrivate;