Added signals appletTransformedByUsed and appletTransformedItself to
Plasma::Applet. This makes it easier for layouts to know when applets are transformed (moved/resized/rotated), and know whether the change was by the user or the applet itself. svn path=/trunk/KDE/kdelibs/; revision=923848
This commit is contained in:
parent
b4267d0689
commit
476fd1a6a3
10
applet.h
10
applet.h
@ -607,6 +607,16 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
|||||||
*/
|
*/
|
||||||
void geometryChanged();
|
void geometryChanged();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted when the user completes a transformation of the applet.
|
||||||
|
*/
|
||||||
|
void appletTransformedByUser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted when the applet changes its own geometry or transform.
|
||||||
|
*/
|
||||||
|
void appletTransformedItself();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted by Applet subclasses when they change a sizeHint and wants to announce the change
|
* Emitted by Applet subclasses when they change a sizeHint and wants to announce the change
|
||||||
*/
|
*/
|
||||||
|
@ -246,6 +246,7 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
|||||||
//size not saved/invalid size saved
|
//size not saved/invalid size saved
|
||||||
if (oldSize.width() < q->minimumSize().width() || oldSize.height() < q->minimumSize().height()) {
|
if (oldSize.width() < q->minimumSize().width() || oldSize.height() < q->minimumSize().height()) {
|
||||||
q->resize(prefSize);
|
q->resize(prefSize);
|
||||||
|
emit q->appletTransformedItself();
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: this will be automatically propagated by the qgraphicslayout in the future
|
//FIXME: this will be automatically propagated by the qgraphicslayout in the future
|
||||||
|
@ -72,6 +72,9 @@ AppletHandle::AppletHandle(Containment *parent, Applet *applet, const QPointF &h
|
|||||||
Theme::defaultTheme()->colorScheme());
|
Theme::defaultTheme()->colorScheme());
|
||||||
m_gradientColor = colorScheme.background(KColorScheme::NormalBackground).color();
|
m_gradientColor = colorScheme.background(KColorScheme::NormalBackground).color();
|
||||||
|
|
||||||
|
m_originalGeom = m_applet->geometry();
|
||||||
|
m_originalTransform = m_applet->transform();
|
||||||
|
|
||||||
QTransform originalMatrix = m_applet->transform();
|
QTransform originalMatrix = m_applet->transform();
|
||||||
m_applet->resetTransform();
|
m_applet->resetTransform();
|
||||||
|
|
||||||
@ -167,6 +170,10 @@ void AppletHandle::detachApplet ()
|
|||||||
|
|
||||||
m_applet->setZValue(m_zValue);
|
m_applet->setZValue(m_zValue);
|
||||||
|
|
||||||
|
if (m_applet->geometry() != m_originalGeom || m_applet->transform() != m_originalTransform) {
|
||||||
|
emit m_applet->appletTransformedByUser();
|
||||||
|
}
|
||||||
|
|
||||||
m_applet->update(); // re-render the background, now we've transformed the applet
|
m_applet->update(); // re-render the background, now we've transformed the applet
|
||||||
|
|
||||||
m_applet = 0;
|
m_applet = 0;
|
||||||
|
@ -127,6 +127,8 @@ class AppletHandle : public QObject, public QGraphicsItem
|
|||||||
QPointF m_entryPos; //where the hover in event occurred
|
QPointF m_entryPos; //where the hover in event occurred
|
||||||
QPointF m_pos; //current position of applet in sceneCoords
|
QPointF m_pos; //current position of applet in sceneCoords
|
||||||
qreal m_zValue; //current zValue of the applet, so it can be restored after drag.
|
qreal m_zValue; //current zValue of the applet, so it can be restored after drag.
|
||||||
|
QRectF m_originalGeom;
|
||||||
|
QTransform m_originalTransform;
|
||||||
|
|
||||||
// used for both resize and rotate
|
// used for both resize and rotate
|
||||||
QPointF m_origAppletCenter;
|
QPointF m_origAppletCenter;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user