diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-12 03:52:24 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-12 03:52:24 (GMT) |
commit | a609f4c1e70eaba81da493d3409356bef3a26c93 (patch) | |
tree | f42bcfbffbd0275a4a29b08dd634264db9c46ffa /src/declarative | |
parent | eae40ec9e65326bf268979afe1399d1fb8548105 (diff) | |
download | Qt-a609f4c1e70eaba81da493d3409356bef3a26c93.zip Qt-a609f4c1e70eaba81da493d3409356bef3a26c93.tar.gz Qt-a609f4c1e70eaba81da493d3409356bef3a26c93.tar.bz2 |
Add NOTIFY signals for QFxScaleGrid
This change allows things like "border.top" to be used to position
items based on the values in a ".sci" file.
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/fx/qfxscalegrid.cpp | 26 | ||||
-rw-r--r-- | src/declarative/fx/qfxscalegrid_p.h | 11 |
2 files changed, 29 insertions, 8 deletions
diff --git a/src/declarative/fx/qfxscalegrid.cpp b/src/declarative/fx/qfxscalegrid.cpp index 4856c15..60ab418 100644 --- a/src/declarative/fx/qfxscalegrid.cpp +++ b/src/declarative/fx/qfxscalegrid.cpp @@ -93,7 +93,10 @@ bool QFxScaleGrid::isNull() const */ void QFxScaleGrid::setLeft(int pos) { - _left = pos; + if (_left != pos) { + _left = pos; + emit borderChanged(); + } } /*! @@ -102,7 +105,10 @@ void QFxScaleGrid::setLeft(int pos) */ void QFxScaleGrid::setTop(int pos) { - _top = pos; + if (_top != pos) { + _top = pos; + emit borderChanged(); + } } /*! @@ -111,7 +117,10 @@ void QFxScaleGrid::setTop(int pos) */ void QFxScaleGrid::setRight(int pos) { - _right = pos; + if (_right != pos) { + _right = pos; + emit borderChanged(); + } } /*! @@ -120,9 +129,18 @@ void QFxScaleGrid::setRight(int pos) */ void QFxScaleGrid::setBottom(int pos) { - _bottom = pos; + if (_bottom != pos) { + _bottom = pos; + emit borderChanged(); + } } +/*! + \fn void QFxScaleGrid::borderChanged() + + This signal is emitted when one of the border properties is changed. +*/ + QFxGridScaledImage::QFxGridScaledImage() : _l(-1), _r(-1), _t(-1), _b(-1), _h(QFxBorderImage::Stretch), _v(QFxBorderImage::Stretch) diff --git a/src/declarative/fx/qfxscalegrid_p.h b/src/declarative/fx/qfxscalegrid_p.h index 9d0a84c..4beec85 100644 --- a/src/declarative/fx/qfxscalegrid_p.h +++ b/src/declarative/fx/qfxscalegrid_p.h @@ -61,10 +61,10 @@ class Q_DECLARATIVE_EXPORT QFxScaleGrid : public QObject Q_OBJECT Q_ENUMS(TileRule) - Q_PROPERTY(int left READ left WRITE setLeft) - Q_PROPERTY(int top READ top WRITE setTop) - Q_PROPERTY(int right READ right WRITE setRight) - Q_PROPERTY(int bottom READ bottom WRITE setBottom) + Q_PROPERTY(int left READ left WRITE setLeft NOTIFY borderChanged) + Q_PROPERTY(int top READ top WRITE setTop NOTIFY borderChanged) + Q_PROPERTY(int right READ right WRITE setRight NOTIFY borderChanged) + Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY borderChanged) public: QFxScaleGrid(); @@ -84,6 +84,9 @@ public: int bottom() const { return _bottom; } void setBottom(int); +Q_SIGNALS: + void borderChanged(); + private: int _left; int _top; |