Applets may expect that init() has been run when constraintsUpdated is called
so ensure that it has been run before updating constraints. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=754350
This commit is contained in:
parent
900d587280
commit
1fe1bbb5c0
@ -450,6 +450,7 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
addApplet(applet);
|
addApplet(applet);
|
||||||
|
prepareApplet(applet, delayInit);
|
||||||
|
|
||||||
// Reposition the applet after adding has been done
|
// Reposition the applet after adding has been done
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
@ -458,19 +459,12 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, ui
|
|||||||
d->applets.insert(index, applet);
|
d->applets.insert(index, applet);
|
||||||
}
|
}
|
||||||
|
|
||||||
//the applet needs to be given constraints before it can set its geometry
|
|
||||||
applet->updateConstraints(Plasma::AllConstraints);
|
|
||||||
applet->flushUpdatedConstraints();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
addApplet(applet);
|
addApplet(applet);
|
||||||
|
prepareApplet(applet, delayInit);
|
||||||
//the applet needs to be given constraints before it can set its geometry
|
|
||||||
applet->updateConstraints(Plasma::AllConstraints);
|
|
||||||
applet->flushUpdatedConstraints();
|
|
||||||
|
|
||||||
//kDebug() << "adding applet" << applet->name() << "with a default geometry of" << appletGeometry << appletGeometry.isValid();
|
//kDebug() << "adding applet" << applet->name() << "with a default geometry of" << appletGeometry << appletGeometry.isValid();
|
||||||
if (appletGeometry.isValid()) {
|
if (appletGeometry.isValid()) {
|
||||||
@ -486,6 +480,12 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, ui
|
|||||||
|
|
||||||
//kDebug() << applet->name() << "sizehint:" << applet->sizeHint() << "geometry:" << applet->geometry();
|
//kDebug() << applet->name() << "sizehint:" << applet->sizeHint() << "geometry:" << applet->geometry();
|
||||||
|
|
||||||
|
emit appletAdded(applet);
|
||||||
|
return applet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Containment::prepareApplet(Applet *applet, bool delayInit)
|
||||||
|
{
|
||||||
if (delayInit) {
|
if (delayInit) {
|
||||||
if (containmentType() == DesktopContainment) {
|
if (containmentType() == DesktopContainment) {
|
||||||
applet->installSceneEventFilter(this);
|
applet->installSceneEventFilter(this);
|
||||||
@ -495,8 +495,10 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, ui
|
|||||||
Phase::self()->animateItem(applet, Phase::Appear);
|
Phase::self()->animateItem(applet, Phase::Appear);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit appletAdded(applet);
|
applet->updateConstraints(Plasma::AllConstraints);
|
||||||
return applet;
|
if (!delayInit) {
|
||||||
|
applet->flushUpdatedConstraints();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF Containment::geometryForApplet(Applet *applet) const
|
QRectF Containment::geometryForApplet(Applet *applet) const
|
||||||
|
@ -316,6 +316,7 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
private:
|
private:
|
||||||
QRectF geometryForApplet(Applet *applet) const;
|
QRectF geometryForApplet(Applet *applet) const;
|
||||||
bool regionIsEmpty(const QRectF ®ion, Applet *ignoredApplet=0) const;
|
bool regionIsEmpty(const QRectF ®ion, Applet *ignoredApplet=0) const;
|
||||||
|
void prepareApplet(Applet *applet, bool delayInit);
|
||||||
|
|
||||||
Q_DISABLE_COPY(Containment)
|
Q_DISABLE_COPY(Containment)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user