with a new singleshot don't adjust the extender size due to a sub widget resize until the next turn of the eventloop: avoids container that resizes the ontent that resizes the container loops

svn path=/trunk/KDE/kdelibs/; revision=1215443
This commit is contained in:
Marco Martin 2011-01-18 19:03:33 +00:00
parent ef64072b4a
commit fc8f66f498
2 changed files with 13 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include <QApplication>
#include <QString>
#include <QList>
#include <QTimer>
#include <QtGui/QGraphicsWidget>
#include <QtGui/QGraphicsLinearLayout>
#include <QtGui/QGraphicsSceneDragDropEvent>
@ -49,6 +50,10 @@ ExtenderGroup::ExtenderGroup(Extender *parent, uint groupId)
connect(extender(), SIGNAL(itemDetached(Plasma::ExtenderItem*)),
this, SLOT(removeItemFromGroup(Plasma::ExtenderItem*)));
//this isn't actually connected to anything, we will just check if it's running or not
d->resizeTimer = new QTimer(this);
d->resizeTimer->setSingleShot(true);
config().writeEntry("isGroup", true);
setAcceptDrops(true);
@ -217,8 +222,11 @@ bool ExtenderGroup::eventFilter(QObject *watched, QEvent *event)
{
if (watched == d->childsWidget && event->type() == QEvent::GraphicsSceneResize) {
static_cast<QGraphicsLayoutItem *>(extender()->d->scrollWidget)->updateGeometry();
static_cast<QGraphicsLayoutItem *>(extender())->updateGeometry();
extender()->d->adjustSize();
if (!d->resizeTimer->isActive()) {
static_cast<QGraphicsLayoutItem *>(extender())->updateGeometry();
extender()->d->adjustSize();
d->resizeTimer->start(0);
}
}
return ExtenderItem::eventFilter(watched, event);

View File

@ -20,6 +20,8 @@
#ifndef PLASMA_EXTENDERGROUPPRIVATE_H
#define PLASMA_EXTENDERGROUPPRIVATE_H
class QTimer;
namespace Plasma
{
@ -45,6 +47,7 @@ class ExtenderGroupPrivate
Plasma::Svg *svg;
QGraphicsWidget *childsWidget;
QGraphicsLinearLayout *layout;
QTimer *resizeTimer;
bool collapsed;
bool autoHide;
bool autoCollapse;