diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-05-29 01:32:39 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-05-29 01:32:39 (GMT) |
commit | 9f95bd8f6e6ccf3575216285b29f2a42dcfd328d (patch) | |
tree | 4cc4a0be670927a3e613ab1b790ebd241b9dfcc8 /src/declarative/fx/qfxrect.cpp | |
parent | 3824fa64f8f8d24db34e3ce1c8d5c7d21cb624b7 (diff) | |
download | Qt-9f95bd8f6e6ccf3575216285b29f2a42dcfd328d.zip Qt-9f95bd8f6e6ccf3575216285b29f2a42dcfd328d.tar.gz Qt-9f95bd8f6e6ccf3575216285b29f2a42dcfd328d.tar.bz2 |
Update in reaction to GradientStops changing.
Diffstat (limited to 'src/declarative/fx/qfxrect.cpp')
-rw-r--r-- | src/declarative/fx/qfxrect.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index b10594e..9718344 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -133,6 +133,12 @@ void QFxPen::setWidth(int w) Sets a \e color at a \e position in a gradient. */ +void QFxGradientStop::updateGradient() +{ + if (QFxGradient *grad = qobject_cast<QFxGradient*>(parent())) + grad->doUpdate(); +} + /*! \qmlclass Gradient QFxGradient \brief The Gradient item defines a gradient fill. @@ -171,6 +177,13 @@ const QGradient *QFxGradient::gradient() const return m_gradient; } +void QFxGradient::doUpdate() +{ + delete m_gradient; + m_gradient = 0; + emit updated(); +} + QML_DEFINE_TYPE(QFxRect,Rect) /*! @@ -310,7 +323,11 @@ void QFxRect::setGradient(QFxGradient *gradient) Q_D(QFxRect); if (d->gradient == gradient) return; + if (d->gradient) + disconnect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate())); d->gradient = gradient; + if (d->gradient) + connect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate())); update(); } |