API REVIEW: constraintsUpdated() -> constraintsEvent()
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=801656
This commit is contained in:
parent
5bc429daa9
commit
ff16201431
@ -667,10 +667,10 @@ void Applet::updateConstraints(Plasma::Constraints constraints)
|
||||
d->scheduleConstraintsUpdate(constraints, this);
|
||||
}
|
||||
|
||||
void Applet::constraintsUpdated(Plasma::Constraints constraints)
|
||||
void Applet::constraintsEvent(Plasma::Constraints constraints)
|
||||
{
|
||||
//NOTE: do NOT put any code in here that reacts to constraints updates
|
||||
// as it will not get called for any applet that reimplements constraintsUpdated
|
||||
// as it will not get called for any applet that reimplements constraintsEvent
|
||||
// without calling the Applet:: version as well, which it shouldn't need to.
|
||||
// INSTEAD put such code into flushPendingConstraintsEvents
|
||||
Q_UNUSED(constraints)
|
||||
@ -972,7 +972,7 @@ void Applet::flushPendingConstraintsEvents()
|
||||
containment->d->containmentConstraintsUpdated(c);
|
||||
}
|
||||
|
||||
constraintsUpdated(c);
|
||||
constraintsEvent(c);
|
||||
|
||||
if (layout()) {
|
||||
layout()->updateGeometry();
|
||||
|
30
applet.h
30
applet.h
@ -199,27 +199,13 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
|
||||
/**
|
||||
* Called when any of the geometry constraints have been updated.
|
||||
* This method calls constraintsUpdated, which may be reimplemented,
|
||||
* This method calls constraintsEvent, which may be reimplemented,
|
||||
* once the Applet has been prepared for updating the constraints.
|
||||
*
|
||||
* @param constraints the type of constraints that were updated
|
||||
*/
|
||||
void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
|
||||
|
||||
/**
|
||||
* Called when any of the geometry constraints have been updated.
|
||||
*
|
||||
* This is always called prior to painting and should be used as an
|
||||
* opportunity to layout the widget, calculate sizings, etc.
|
||||
*
|
||||
* Do not call update() from this method; an update() will be triggered
|
||||
* at the appropriate time for the applet.
|
||||
*
|
||||
* @param constraints the type of constraints that were updated
|
||||
* @property constraint
|
||||
*/
|
||||
virtual void constraintsUpdated(Plasma::Constraints constraints);
|
||||
|
||||
/**
|
||||
* Returns the current form factor the applet is being displayed in.
|
||||
*
|
||||
@ -646,6 +632,20 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
*/
|
||||
void setActAsContainment(bool actAsContainment);
|
||||
|
||||
/**
|
||||
* Called when any of the geometry constraints have been updated.
|
||||
*
|
||||
* This is always called prior to painting and should be used as an
|
||||
* opportunity to layout the widget, calculate sizings, etc.
|
||||
*
|
||||
* Do not call update() from this method; an update() will be triggered
|
||||
* at the appropriate time for the applet.
|
||||
*
|
||||
* @param constraints the type of constraints that were updated
|
||||
* @property constraint
|
||||
*/
|
||||
virtual void constraintsEvent(Plasma::Constraints constraints);
|
||||
|
||||
/**
|
||||
* Sets the BackgroundHints for this applet @see BackgroundHint
|
||||
*
|
||||
|
@ -538,7 +538,7 @@ void AppletHandle::switchContainment(Containment *containment, const QPointF &po
|
||||
QVariant AppletHandle::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemPositionHasChanged && m_applet) {
|
||||
m_applet->constraintsUpdated(Plasma::LocationConstraint);
|
||||
m_applet->updateConstraints(Plasma::LocationConstraint);
|
||||
}
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
|
@ -980,7 +980,7 @@ void Containment::Private::containmentConstraintsUpdated(Plasma::Constraints con
|
||||
|
||||
// tell the applets too
|
||||
foreach (Applet *a, applets) {
|
||||
a->constraintsUpdated(ImmutableConstraint);
|
||||
a->constraintsEvent(ImmutableConstraint);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user