diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-02-16 06:16:38 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-02-17 05:11:40 (GMT) |
commit | 060d833d3e0fd5a99876e0717fb26ef93fae30e1 (patch) | |
tree | 75dff625d18ca442088c8b8b07b9979e5cb55544 /src/declarative | |
parent | 7f6317c25e6c1ec457971ab70c850d4d2bbe4cd2 (diff) | |
download | Qt-060d833d3e0fd5a99876e0717fb26ef93fae30e1.zip Qt-060d833d3e0fd5a99876e0717fb26ef93fae30e1.tar.gz Qt-060d833d3e0fd5a99876e0717fb26ef93fae30e1.tar.bz2 |
Add missing NOTIFY signals to various QML item class properties
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/declarative')
10 files changed, 74 insertions, 17 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp index 5143251..39fe5b4 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp @@ -1006,7 +1006,10 @@ bool QmlGraphicsFlickable::overShoot() const void QmlGraphicsFlickable::setOverShoot(bool o) { Q_D(QmlGraphicsFlickable); + if (d->overShoot == o) + return; d->overShoot = o; + emit overShootChanged(); } /*! @@ -1215,6 +1218,7 @@ void QmlGraphicsFlickable::setMaximumFlickVelocity(qreal v) if (v == d->maxVelocity) return; d->maxVelocity = v; + emit maximumFlickVelocityChanged(); } /*! @@ -1232,7 +1236,10 @@ qreal QmlGraphicsFlickable::flickDeceleration() const void QmlGraphicsFlickable::setFlickDeceleration(qreal deceleration) { Q_D(QmlGraphicsFlickable); + if (deceleration == d->deceleration) + return; d->deceleration = deceleration; + emit flickDecelerationChanged(); } /*! @@ -1270,6 +1277,7 @@ void QmlGraphicsFlickable::setPressDelay(int delay) if (d->pressDelay == delay) return; d->pressDelay = delay; + emit pressDelayChanged(); } qreal QmlGraphicsFlickable::reportedVelocitySmoothing() const diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h index ea07da4..5a1d15a 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h @@ -65,15 +65,15 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) Q_PROPERTY(qreal reportedVelocitySmoothing READ reportedVelocitySmoothing WRITE setReportedVelocitySmoothing NOTIFY reportedVelocitySmoothingChanged) - Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot) - Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity) - Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration) + Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot NOTIFY overShootChanged) + Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) + Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged) Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) Q_PROPERTY(FlickDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickDirectionChanged) Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged) - Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay) + Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay NOTIFY pressDelayChanged) Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged) Q_PROPERTY(bool atYEnd READ isAtYEnd NOTIFY isAtBoundaryChanged) @@ -160,6 +160,10 @@ Q_SIGNALS: void pageChanged(); void flickDirectionChanged(); void interactiveChanged(); + void overShootChanged(); + void maximumFlickVelocityChanged(); + void flickDecelerationChanged(); + void pressDelayChanged(); protected: virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp index 2fbf18b..5cda430 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp @@ -1640,7 +1640,10 @@ bool QmlGraphicsItem::clip() const void QmlGraphicsItem::setClip(bool c) { + if (clip() == c) + return; setFlag(ItemClipsChildrenToShape, c); + emit clipChanged(); } /*! @@ -2628,6 +2631,7 @@ void QmlGraphicsItem::setSmooth(bool smooth) if (d->smooth == smooth) return; d->smooth = smooth; + emit smoothChanged(); update(); } diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.h b/src/declarative/graphicsitems/qmlgraphicsitem.h index e0f33c7..ed4a7cf 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem.h +++ b/src/declarative/graphicsitems/qmlgraphicsitem.h @@ -88,12 +88,12 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsItem : public QGraphicsObject, public QmlP Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL) Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline CONSTANT FINAL) Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) - Q_PROPERTY(bool clip READ clip WRITE setClip) // ### move to QGI/QGO, NOTIFY + Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged) // ### move to QGI/QGO, NOTIFY Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL) Q_PROPERTY(bool wantsFocus READ wantsFocus NOTIFY wantsFocusChanged) Q_PROPERTY(QmlList<QGraphicsTransform *>* transform READ transform DESIGNABLE false FINAL) Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin NOTIFY transformOriginChanged) - Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) + Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect) Q_ENUMS(TransformOrigin) Q_CLASSINFO("DefaultProperty", "data") @@ -178,6 +178,8 @@ Q_SIGNALS: void wantsFocusChanged(); void parentChanged(); void transformOriginChanged(TransformOrigin); + void smoothChanged(); + void clipChanged(); protected: bool isComponentComplete() const; diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp index d778c83..342fec2 100644 --- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp @@ -398,6 +398,7 @@ void QmlGraphicsLoader::setResizeMode(ResizeMode mode) } d->resizeMode = mode; + emit resizeModeChanged(); d->initResize(); } diff --git a/src/declarative/graphicsitems/qmlgraphicsloader_p.h b/src/declarative/graphicsitems/qmlgraphicsloader_p.h index 87b6a52..a115aa9 100644 --- a/src/declarative/graphicsitems/qmlgraphicsloader_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsloader_p.h @@ -59,7 +59,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsLoader : public QmlGraphicsItem Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QmlComponent *sourceComponent READ sourceComponent WRITE setSourceComponent NOTIFY sourceChanged) - Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) + Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode NOTIFY resizeModeChanged) Q_PROPERTY(QGraphicsObject *item READ item NOTIFY itemChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) @@ -89,6 +89,8 @@ Q_SIGNALS: void sourceChanged(); void statusChanged(); void progressChanged(); + void resizeModeChanged(); + protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); QVariant itemChange(GraphicsItemChange change, const QVariant &value); diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp b/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp index fe72e84..003c18d 100644 --- a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp @@ -65,7 +65,10 @@ QmlGraphicsItem *QmlGraphicsDrag::target() const void QmlGraphicsDrag::setTarget(QmlGraphicsItem *t) { + if (_target == t) + return; _target = t; + emit targetChanged(); } QmlGraphicsDrag::Axis QmlGraphicsDrag::axis() const @@ -75,7 +78,10 @@ QmlGraphicsDrag::Axis QmlGraphicsDrag::axis() const void QmlGraphicsDrag::setAxis(QmlGraphicsDrag::Axis a) { + if (_axis == a) + return; _axis = a; + emit axisChanged(); } qreal QmlGraphicsDrag::xmin() const @@ -85,7 +91,10 @@ qreal QmlGraphicsDrag::xmin() const void QmlGraphicsDrag::setXmin(qreal m) { + if (_xmin == m) + return; _xmin = m; + emit minimumXChanged(); } qreal QmlGraphicsDrag::xmax() const @@ -95,7 +104,10 @@ qreal QmlGraphicsDrag::xmax() const void QmlGraphicsDrag::setXmax(qreal m) { + if (_xmax == m) + return; _xmax = m; + emit maximumXChanged(); } qreal QmlGraphicsDrag::ymin() const @@ -105,7 +117,10 @@ qreal QmlGraphicsDrag::ymin() const void QmlGraphicsDrag::setYmin(qreal m) { + if (_ymin == m) + return; _ymin = m; + emit minimumYChanged(); } qreal QmlGraphicsDrag::ymax() const @@ -115,7 +130,10 @@ qreal QmlGraphicsDrag::ymax() const void QmlGraphicsDrag::setYmax(qreal m) { + if (_ymax == m) + return; _ymax = m; + emit maximumYChanged(); } QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h b/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h index 0ddad1b..1a8f83e 100644 --- a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h @@ -55,12 +55,12 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsDrag : public QObject Q_OBJECT Q_ENUMS(Axis) - Q_PROPERTY(QmlGraphicsItem *target READ target WRITE setTarget) - Q_PROPERTY(Axis axis READ axis WRITE setAxis) - Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin) - Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax) - Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin) - Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax) + Q_PROPERTY(QmlGraphicsItem *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(Axis axis READ axis WRITE setAxis NOTIFY axisChanged) + Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin NOTIFY minimumXChanged) + Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax NOTIFY maximumXChanged) + Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin NOTIFY minimumYChanged) + Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax NOTIFY maximumYChanged) //### consider drag and drop public: @@ -83,6 +83,14 @@ public: qreal ymax() const; void setYmax(qreal); +Q_SIGNALS: + void targetChanged(); + void axisChanged(); + void minimumXChanged(); + void maximumXChanged(); + void minimumYChanged(); + void maximumYChanged(); + private: QmlGraphicsItem *_target; Axis _axis; @@ -107,7 +115,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedChanged) Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged) Q_PROPERTY(bool hoverEnabled READ acceptHoverEvents WRITE setAcceptHoverEvents) - Q_PROPERTY(QmlGraphicsDrag *drag READ drag) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ??? + Q_PROPERTY(QmlGraphicsDrag *drag READ drag CONSTANT) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ??? public: QmlGraphicsMouseRegion(QmlGraphicsItem *parent=0); diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp index f0e5bb3..4b01952 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp @@ -157,6 +157,9 @@ QVariant QmlGraphicsRepeater::model() const void QmlGraphicsRepeater::setModel(const QVariant &model) { Q_D(QmlGraphicsRepeater); + if (d->dataSource == model) + return; + clear(); if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); @@ -168,6 +171,7 @@ void QmlGraphicsRepeater::setModel(const QVariant &model) */ } d->dataSource = model; + emit modelChanged(); QObject *object = qvariant_cast<QObject*>(model); QmlGraphicsVisualModel *vim = 0; if (object && (vim = qobject_cast<QmlGraphicsVisualModel *>(object))) { @@ -219,6 +223,10 @@ QmlComponent *QmlGraphicsRepeater::delegate() const void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate) { Q_D(QmlGraphicsRepeater); + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) + if (delegate == dataModel->delegate()) + return; + if (!d->ownModel) { d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; @@ -226,6 +234,7 @@ void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate) if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) { dataModel->setDelegate(delegate); regenerate(); + emit delegateChanged(); } } diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h b/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h index 61f82d7..d0c009f 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h @@ -55,8 +55,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsRepeater : public QmlGraphicsItem { Q_OBJECT - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) Q_CLASSINFO("DefaultProperty", "delegate") @@ -73,8 +73,9 @@ public: int count() const; Q_SIGNALS: + void modelChanged(); + void delegateChanged(); void countChanged(); - private: void clear(); void regenerate(); |