summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxrect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/fx/qfxrect.cpp')
-rw-r--r--src/declarative/fx/qfxrect.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index 564faa6..c156753 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)
/*!
@@ -308,7 +321,14 @@ QFxGradient *QFxRect::gradient() const
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();
}