summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qmlbinding.cpp3
-rw-r--r--src/declarative/qml/qmlbinding.h2
-rw-r--r--src/declarative/qml/qmlexpression.cpp11
-rw-r--r--src/declarative/qml/qmlexpression.h4
-rw-r--r--tests/auto/declarative/qmlecmascript/testtypes.h3
5 files changed, 18 insertions, 5 deletions
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index d1a8fe8..4ec7191 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -225,9 +225,10 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
data->release();
}
-void QmlBinding::valueChanged()
+void QmlBinding::emitValueChanged()
{
update();
+ // don't bother calling valueChanged()
}
void QmlBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h
index 242742a..cefb4fe 100644
--- a/src/declarative/qml/qmlbinding.h
+++ b/src/declarative/qml/qmlbinding.h
@@ -114,7 +114,7 @@ public Q_SLOTS:
void update() { update(QmlMetaProperty::DontRemoveBinding); }
protected:
- virtual void valueChanged();
+ void emitValueChanged();
private:
Q_DECLARE_PRIVATE(QmlBinding)
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 1587d61..22a9c36f 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -627,7 +627,7 @@ QmlError QmlExpression::error() const
/*! \internal */
void QmlExpression::__q_notify()
{
- valueChanged();
+ emitValueChanged();
}
void QmlExpressionPrivate::clearGuards()
@@ -753,6 +753,15 @@ void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::Captu
calling QmlExpression::value()) before this signal will be emitted.
*/
+/*!
+ Subclasses can capture the emission of the valueChanged() signal by overriding
+ this function. They can choose whether to then call valueChanged().
+*/
+void QmlExpression::emitValueChanged()
+{
+ emit valueChanged();
+}
+
QmlAbstractExpression::QmlAbstractExpression()
: m_context(0), m_prevExpression(0), m_nextExpression(0)
{
diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h
index c019f21..cc02d56 100644
--- a/src/declarative/qml/qmlexpression.h
+++ b/src/declarative/qml/qmlexpression.h
@@ -92,9 +92,11 @@ public Q_SLOTS:
QVariant value(bool *isUndefined = 0);
Q_SIGNALS:
- virtual void valueChanged();
+ void valueChanged();
protected:
+ virtual void emitValueChanged();
+
QmlExpression(QmlContext *, const QString &, QObject *,
QmlExpressionPrivate &dd);
QmlExpression(QmlContext *, void *, QmlRefCount *rc, QObject *me, const QString &,
diff --git a/tests/auto/declarative/qmlecmascript/testtypes.h b/tests/auto/declarative/qmlecmascript/testtypes.h
index 7c02995..b275b8a 100644
--- a/tests/auto/declarative/qmlecmascript/testtypes.h
+++ b/tests/auto/declarative/qmlecmascript/testtypes.h
@@ -168,8 +168,9 @@ public:
{
}
- virtual void valueChanged() {
+ void emitValueChanged() {
changed = true;
+ QmlExpression::emitValueChanged();
}
bool changed;
};