Don't call constraintsUpdated() before init(), even if an event loop is created in an applet constructor.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=849656
This commit is contained in:
Alex Merry 2008-08-19 21:36:52 +00:00
parent 8427acfc83
commit c8823d1900
3 changed files with 11 additions and 2 deletions

View File

@ -1655,7 +1655,9 @@ QString AppletPrivate::instanceName()
void AppletPrivate::scheduleConstraintsUpdate(Plasma::Constraints c) void AppletPrivate::scheduleConstraintsUpdate(Plasma::Constraints c)
{ {
if (!constraintsTimerId) { // Don't start up a timer if we're just starting up
// flushPendingConstraints will be called by Corona
if (!constraintsTimerId && !(c & Plasma::StartupCompletedConstraint)) {
constraintsTimerId = q->startTimer(0); constraintsTimerId = q->startTimer(0);
} }
pendingConstraints |= c; pendingConstraints |= c;

View File

@ -176,7 +176,12 @@ class PLASMA_EXPORT Containment : public Applet
const QRectF &geometry = QRectF(-1, -1, -1, -1)); const QRectF &geometry = QRectF(-1, -1, -1, -1));
/** /**
* add existing applet to this containment at pos * Add an existing applet to this Containment
*
* If dontInit is true, the pending constraints are not flushed either.
* So it is your responsibility to call both init() and
* flushPendingConstraints() on the applet.
*
* @param applet the applet that should be added * @param applet the applet that should be added
* @param pos the containment-relative position * @param pos the containment-relative position
* @param dontInit if true, init() will not be called on the applet * @param dontInit if true, init() will not be called on the applet

View File

@ -289,6 +289,8 @@ void Corona::loadLayout(const QString& configName)
foreach(Applet* applet, containment->applets()) { foreach(Applet* applet, containment->applets()) {
applet->init(); applet->init();
// We have to flush the applet constraints manually
applet->flushPendingConstraintsEvents();
} }
containment->updateConstraints(Plasma::StartupCompletedConstraint); containment->updateConstraints(Plasma::StartupCompletedConstraint);