summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-23 07:02:24 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-23 07:02:24 (GMT)
commit80d1bc3da3ac03deb321a307a87df1f5f331e48f (patch)
tree54f3ef183a295d7682db3c92bd86cc6f21370f1c /src/declarative
parent8ede65299dc5644d84a394d6a96cbdbd39e69ecf (diff)
parent571de030b02a5549c6069bf31dec69eb239870a6 (diff)
downloadQt-80d1bc3da3ac03deb321a307a87df1f5f331e48f.zip
Qt-80d1bc3da3ac03deb321a307a87df1f5f331e48f.tar.gz
Qt-80d1bc3da3ac03deb321a307a87df1f5f331e48f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/QmlChanges.txt31
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp12
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp13
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp6
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp10
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal_p.h5
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp119
-rw-r--r--src/declarative/qml/qdeclarativecomponent.h1
-rw-r--r--src/declarative/qml/qdeclarativecontext.h1
-rw-r--r--src/declarative/qml/qdeclarativeengine.h1
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp24
-rw-r--r--src/declarative/qml/qdeclarativeexpression.h7
-rw-r--r--src/declarative/qml/qdeclarativeexpression_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.h3
-rw-r--r--src/declarative/qml/qdeclarativewatcher.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp2
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp10
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp2
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp2
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp2
-rw-r--r--src/declarative/util/qdeclarativeview.h2
26 files changed, 167 insertions, 102 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 55f7b21..9c46467 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -3,6 +3,11 @@ The changes below are pre Qt 4.7.0 RC
Flickable: overShoot is replaced by boundsBehavior enumeration.
+C++ API
+-------
+QDeclarativeExpression::value() has been renamed to
+QDeclarativeExpression::evaluate()
+
=============================================================================
The changes below are pre Qt 4.7.0 beta
@@ -62,22 +67,22 @@ automatically 'followed' anymore.
If you want to follow an hypothetical rect1, you should do now:
-     Rectangle {
-         color: "green"
-         width: 60; height: 60;
-         x: rect1.x - 5; y: rect1.y - 5;
-         Behavior on x { SmoothedAnimation { velocity: 200 } }
-         Behavior on y { SmoothedAnimation { velocity: 200 } }
-     }
+ Rectangle {
+ color: "green"
+ width: 60; height: 60;
+ x: rect1.x - 5; y: rect1.y - 5;
+ Behavior on x { SmoothedAnimation { velocity: 200 } }
+ Behavior on y { SmoothedAnimation { velocity: 200 } }
+ }
instead of the old automatic source changed tracking:
-     Rectangle {
-         color: "green"
-         width: 60; height: 60;
-         EaseFollow on x { source: rect1.x - 5; velocity: 200 }
-         EaseFollow on y { source: rect1.y - 5; velocity: 200 }
-    }
+ Rectangle {
+ color: "green"
+ width: 60; height: 60;
+ EaseFollow on x { source: rect1.x - 5; velocity: 200 }
+ EaseFollow on y { source: rect1.y - 5; velocity: 200 }
+ }
This is a syntax and behavior change.
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
index 4238c53..2945b6c 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -143,6 +143,7 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QAction>();
qmlRegisterType<QDeclarativePen>();
qmlRegisterType<QDeclarativeFlickableVisibleArea>();
+ qmlRegisterType<QGraphicsEffect>();
qmlRegisterUncreatableType<QDeclarativeKeyNavigationAttached>("Qt",4,7,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties"));
qmlRegisterUncreatableType<QDeclarativeKeysAttached>("Qt",4,7,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties"));
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 3daa83f..0328f91 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -357,9 +357,7 @@ void QDeclarativeRectangle::generateBorderedRect()
Q_D(QDeclarativeRectangle);
if (d->rectImage.isNull()) {
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- // Adding 5 here makes qDrawBorderPixmap() paint correctly with smooth: true
- // Ideally qDrawBorderPixmap() would be fixed - QTBUG-7999
- d->rectImage = QPixmap(pw*2 + 5, pw*2 + 5);
+ d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3);
d->rectImage.fill(Qt::transparent);
QPainter p(&(d->rectImage));
p.setRenderHint(QPainter::Antialiasing);
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index a95c930..0b59503 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -525,18 +525,6 @@ void QDeclarativeText::setWrapMode(WrapMode mode)
emit wrapModeChanged();
}
-bool QDeclarativeText::wrap() const
-{
- Q_D(const QDeclarativeText);
- return d->wrapMode != NoWrap;
-}
-
-void QDeclarativeText::setWrap(bool w)
-{
- qmlInfo(this) << "\"wrap\" property is deprecated and will soon be removed. Use wrapMode";
- setWrapMode(w ? WordWrap : NoWrap);
-}
-
/*!
\qmlproperty enumeration Text::textFormat
diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
index 4fd5e3a..00ce126 100644
--- a/src/declarative/graphicsitems/qdeclarativetext_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
@@ -69,7 +69,6 @@ class Q_DECLARATIVE_EXPORT QDeclarativeText : public QDeclarativeItem
Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged)
Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)
Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
- Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapModeChanged)
Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode?
@@ -123,8 +122,6 @@ public:
VAlignment vAlign() const;
void setVAlign(VAlignment align);
- bool wrap() const;
- void setWrap(bool w);
WrapMode wrapMode() const;
void setWrapMode(WrapMode w);
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 77fb459..25eaef6 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -495,19 +495,6 @@ void QDeclarativeTextEdit::setWrapMode(WrapMode mode)
emit wrapModeChanged();
}
-bool QDeclarativeTextEdit::wrap() const
-{
- Q_D(const QDeclarativeTextEdit);
- return d->wrapMode != QDeclarativeTextEdit::NoWrap;
-}
-
-void QDeclarativeTextEdit::setWrap(bool w)
-{
-
- qmlInfo(this) << "\"wrap\" property is deprecated and will soon be removed. Use wrapMode";
- setWrapMode(w ? WordWrap : NoWrap);
-}
-
/*!
\qmlproperty bool TextEdit::cursorVisible
If true the text edit shows a cursor.
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
index 605b620..474de09 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -73,7 +73,6 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged)
Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)
- Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged) //### deprecated
Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
@@ -139,8 +138,6 @@ public:
VAlignment vAlign() const;
void setVAlign(VAlignment align);
- bool wrap() const;
- void setWrap(bool w);
WrapMode wrapMode() const;
void setWrapMode(WrapMode w);
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 7fa8cc4..e2d8bc7 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -198,7 +198,7 @@ QVariant QDeclarativeVisualItemModel::evaluate(int index, const QString &express
QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
ctxt->setContextObject(d->children.at(index));
QDeclarativeExpression e(ctxt, expression, objectContext);
- QVariant value = e.value();
+ QVariant value = e.evaluate();
delete ctxt;
return value;
}
@@ -1138,7 +1138,7 @@ QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &express
QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
if (item) {
QDeclarativeExpression e(qmlContext(item), expression, objectContext);
- value = e.value();
+ value = e.evaluate();
}
} else {
QDeclarativeContext *ccontext = d->m_context;
@@ -1147,7 +1147,7 @@ QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &express
QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this);
ctxt->setContextObject(data);
QDeclarativeExpression e(ctxt, expression, objectContext);
- value = e.value();
+ value = e.evaluate();
delete data;
delete ctxt;
}
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index 00a93cc..89f1256 100644
--- a/src/declarative/qml/qdeclarativeboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -95,10 +95,8 @@ QDeclarativeAbstractBoundSignal::~QDeclarativeAbstractBoundSignal()
QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMethod &signal,
QObject *parent)
-: m_expression(0), m_signal(signal), m_paramsValid(false), m_params(0)
+: m_expression(0), m_signal(signal), m_paramsValid(false), m_isEvaluating(false), m_params(0)
{
- // A cached evaluation of the QDeclarativeExpression::value() slot index.
- //
// This is thread safe. Although it may be updated by two threads, they
// will both set it to the same value - so the worst thing that can happen
// is that they both do the work to figure it out. Boo hoo.
@@ -111,10 +109,8 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMeth
QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, const QString &val,
QObject *scope, const QMetaMethod &signal,
QObject *parent)
-: m_expression(0), m_signal(signal), m_paramsValid(false), m_params(0)
+: m_expression(0), m_signal(signal), m_paramsValid(false), m_isEvaluating(false), m_params(0)
{
- // A cached evaluation of the QDeclarativeExpression::value() slot index.
- //
// This is thread safe. Although it may be updated by two threads, they
// will both set it to the same value - so the worst thing that can happen
// is that they both do the work to figure it out. Boo hoo.
@@ -169,6 +165,7 @@ QDeclarativeBoundSignal *QDeclarativeBoundSignal::cast(QObject *o)
int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
{
if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
+ m_isEvaluating = true;
if (!m_paramsValid) {
if (!m_signal.parameterTypes().isEmpty())
m_params = new QDeclarativeBoundSignalParameters(m_signal, this);
@@ -182,6 +179,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
QDeclarativeEnginePrivate::warning(m_expression->engine(), m_expression->error());
}
if (m_params) m_params->clearValues();
+ m_isEvaluating = false;
return -1;
} else {
return QObject::qt_metacall(c, id, a);
diff --git a/src/declarative/qml/qdeclarativeboundsignal_p.h b/src/declarative/qml/qdeclarativeboundsignal_p.h
index bba4eec..06900d7 100644
--- a/src/declarative/qml/qdeclarativeboundsignal_p.h
+++ b/src/declarative/qml/qdeclarativeboundsignal_p.h
@@ -83,6 +83,8 @@ public:
QDeclarativeExpression *expression() const;
QDeclarativeExpression *setExpression(QDeclarativeExpression *);
+ bool isEvaluating() const { return m_isEvaluating; }
+
static QDeclarativeBoundSignal *cast(QObject *);
protected:
@@ -91,7 +93,8 @@ protected:
private:
QDeclarativeExpression *m_expression;
QMetaMethod m_signal;
- bool m_paramsValid;
+ bool m_paramsValid : 1;
+ bool m_isEvaluating : 1;
QDeclarativeBoundSignalParameters *m_params;
};
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index c86f089..161ce56 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -67,14 +67,14 @@ int statusId = qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeCom
/*!
\class QDeclarativeComponent
- \since 4.7
+ \since 4.7
\brief The QDeclarativeComponent class encapsulates a QML component description.
\mainclass
*/
/*!
\qmlclass Component QDeclarativeComponent
- \since 4.7
+ \since 4.7
\brief The Component element encapsulates a QML component description.
Components are reusable, encapsulated Qml element with a well-defined interface.
@@ -86,26 +86,26 @@ int statusId = qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeCom
file containing it.
\qml
-Item {
- Component {
- id: redSquare
- Rectangle {
- color: "red"
- width: 10
- height: 10
+ Item {
+ Component {
+ id: redSquare
+ Rectangle {
+ color: "red"
+ width: 10
+ height: 10
+ }
}
+ Loader { sourceComponent: redSquare }
+ Loader { sourceComponent: redSquare; x: 20 }
}
- Loader { sourceComponent: redSquare }
- Loader { sourceComponent: redSquare; x: 20 }
-}
\endqml
+*/
- \section1 Attached Properties
-
- \e onCompleted
+/*!
+ \qmlattachedsignal Component::onCompleted()
Emitted after component "startup" has completed. This can be used to
- execute script code at startup, once the full QML environment has been
+ execute script code at startup, once the full QML environment has been
established.
The \c {Component::onCompleted} attached property can be applied to
@@ -120,8 +120,10 @@ Item {
}
}
\endqml
+*/
- \e onDestruction
+/*!
+ \qmlattachedsignal Component::onDestruction()
Emitted as the component begins destruction. This can be used to undo
work done in the onCompleted signal, or other imperative code in your
@@ -129,7 +131,7 @@ Item {
The \c {Component::onDestruction} attached property can be applied to
any element. However, it applies to the destruction of the component as
- a whole, and not the destruction of the specific object. The order of
+ a whole, and not the destruction of the specific object. The order of
running the \c onDestruction scripts is undefined.
\qml
@@ -150,7 +152,7 @@ Item {
\value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content.
\value Ready This QDeclarativeComponent is ready and create() may be called.
\value Loading This QDeclarativeComponent is loading network data.
- \value Error An error has occured. Calling errorDescription() to retrieve a description.
+ \value Error An error has occured. Call errors() to retrieve a list of \{QDeclarativeError}{errors}.
*/
void QDeclarativeComponentPrivate::typeDataReady()
@@ -235,6 +237,18 @@ QDeclarativeComponent::~QDeclarativeComponent()
}
/*!
+ \qmlproperty enumeration Component::status
+ This property holds the status of component loading. It can be one of:
+ \list
+ \o Null - no data is available for the component
+ \o Ready - the component has been loaded, and can be used to create instances.
+ \o Loading - the component is currently being loaded
+ \o Error - an error occurred while loading the component.
+ Calling errorsString() will provide a human-readable description of any errors.
+ \endlist
+ */
+
+/*!
\property QDeclarativeComponent::status
The component's current \l{QDeclarativeComponent::Status} {status}.
*/
@@ -253,6 +267,14 @@ QDeclarativeComponent::Status QDeclarativeComponent::status() const
}
/*!
+ \qmlproperty bool Component::isNull
+
+ Is true if the component is in the Null state, false otherwise.
+
+ Equivalent to status == Component.Null.
+*/
+
+/*!
\property QDeclarativeComponent::isNull
Is true if the component is in the Null state, false otherwise.
@@ -265,6 +287,14 @@ bool QDeclarativeComponent::isNull() const
}
/*!
+ \qmlproperty bool Component::isReady
+
+ Is true if the component is in the Ready state, false otherwise.
+
+ Equivalent to status == Component.Ready.
+*/
+
+/*!
\property QDeclarativeComponent::isReady
Is true if the component is in the Ready state, false otherwise.
@@ -277,6 +307,16 @@ bool QDeclarativeComponent::isReady() const
}
/*!
+ \qmlproperty bool Component::isError
+
+ Is true if the component is in the Error state, false otherwise.
+
+ Equivalent to status == Component.Error.
+
+ Calling errorsString() will provide a human-readable description of any errors.
+*/
+
+/*!
\property QDeclarativeComponent::isError
Is true if the component is in the Error state, false otherwise.
@@ -289,6 +329,14 @@ bool QDeclarativeComponent::isError() const
}
/*!
+ \qmlproperty bool Component::isLoading
+
+ Is true if the component is in the Loading state, false otherwise.
+
+ Equivalent to status == Component::Loading.
+*/
+
+/*!
\property QDeclarativeComponent::isLoading
Is true if the component is in the Loading state, false otherwise.
@@ -301,6 +349,12 @@ bool QDeclarativeComponent::isLoading() const
}
/*!
+ \qmlproperty real Component::progress
+ The progress of loading the component, from 0.0 (nothing loaded)
+ to 1.0 (finished).
+*/
+
+/*!
\property QDeclarativeComponent::progress
The progress of loading the component, from 0.0 (nothing loaded)
to 1.0 (finished).
@@ -486,6 +540,17 @@ QList<QDeclarativeError> QDeclarativeComponent::errors() const
}
/*!
+ \qmlmethod string Component::errorsString()
+
+ Returns a human-readable description of any errors.
+
+ The string includes the file, location, and description of each error.
+ If multiple errors are present they are separated by a newline character.
+
+ If no errors are present, an empty string is returned.
+*/
+
+/*!
\internal
errorsString is only meant as a way to get the errors in script
*/
@@ -504,6 +569,11 @@ QString QDeclarativeComponent::errorsString() const
}
/*!
+ \qmlproperty url Component::url
+ The component URL. This is the URL that was used to construct the component.
+*/
+
+/*!
\property QDeclarativeComponent::url
The component URL. This is the URL passed to either the constructor,
or the loadUrl() or setData() methods.
@@ -523,6 +593,13 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
}
/*!
+ \qmlmethod object Component::createObject()
+ Returns an object instance from this component, or null if object creation fails.
+
+ The object will be created in the same context as the component was created in.
+*/
+
+/*!
\internal
A version of create which returns a scriptObject, for use in script
*/
@@ -531,10 +608,10 @@ QScriptValue QDeclarativeComponent::createObject()
Q_D(QDeclarativeComponent);
QDeclarativeContext* ctxt = creationContext();
if(!ctxt)
- return QScriptValue();
+ return QScriptValue(QScriptValue::NullValue);
QObject* ret = create(ctxt);
if (!ret)
- return QScriptValue();
+ return QScriptValue(QScriptValue::NullValue);
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(d->engine);
QDeclarativeData::get(ret, true)->setImplicitDestructible();
return priv->objectClass->newQObject(ret, QMetaType::QObjectStar);
diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
index 526a319..f3cfe3c 100644
--- a/src/declarative/qml/qdeclarativecomponent.h
+++ b/src/declarative/qml/qdeclarativecomponent.h
@@ -117,6 +117,7 @@ protected:
private:
QDeclarativeComponent(QDeclarativeEngine *, QDeclarativeCompiledData *, int, int, QObject *parent);
+ Q_DISABLE_COPY(QDeclarativeComponent)
friend class QDeclarativeVME;
friend class QDeclarativeCompositeTypeData;
};
diff --git a/src/declarative/qml/qdeclarativecontext.h b/src/declarative/qml/qdeclarativecontext.h
index 94c9f4a..548869c 100644
--- a/src/declarative/qml/qdeclarativecontext.h
+++ b/src/declarative/qml/qdeclarativecontext.h
@@ -103,6 +103,7 @@ private:
friend class QDeclarativeContextData;
QDeclarativeContext(QDeclarativeContextData *);
QDeclarativeContext(QDeclarativeEngine *, bool);
+ Q_DISABLE_COPY(QDeclarativeContext)
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h
index e161cd9..01487f5 100644
--- a/src/declarative/qml/qdeclarativeengine.h
+++ b/src/declarative/qml/qdeclarativeengine.h
@@ -118,6 +118,7 @@ Q_SIGNALS:
void warnings(const QList<QDeclarativeError> &warnings);
private:
+ Q_DISABLE_COPY(QDeclarativeEngine)
Q_DECLARE_PRIVATE(QDeclarativeEngine)
};
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 264fd8d..69e42f8 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -416,7 +416,7 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message)
if (object && context) {
QDeclarativeExpression exprObj(context, expr, object);
bool undefined = false;
- QVariant value = exprObj.value(&undefined);
+ QVariant value = exprObj.evaluate(&undefined);
if (undefined)
result = QLatin1String("<undefined>");
else
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index 8b5a62f..f561a7e 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -479,18 +479,18 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU
}
/*!
- Returns the value of the expression, or an invalid QVariant if the
- expression is invalid or has an error.
+ Evaulates the expression, returning the result of the evaluation,
+ or an invalid QVariant if the expression is invalid or has an error.
- \a isUndefined is set to true if the expression resulted in an
+ \a valueIsUndefined is set to true if the expression resulted in an
undefined value.
\sa hasError(), error()
*/
-QVariant QDeclarativeExpression::value(bool *isUndefined)
+QVariant QDeclarativeExpression::evaluate(bool *valueIsUndefined)
{
Q_D(QDeclarativeExpression);
- return d->value(0, isUndefined);
+ return d->value(0, valueIsUndefined);
}
/*!
@@ -569,7 +569,7 @@ QObject *QDeclarativeExpression::scopeObject() const
}
/*!
- Returns true if the last call to value() resulted in an error,
+ Returns true if the last call to evaluate() resulted in an error,
otherwise false.
\sa error(), clearError()
@@ -593,7 +593,7 @@ void QDeclarativeExpression::clearError()
}
/*!
- Return any error from the last call to value(). If there was no error,
+ Return any error from the last call to evaluate(). If there was no error,
this returns an invalid QDeclarativeError instance.
\sa hasError(), clearError()
@@ -606,10 +606,9 @@ QDeclarativeError QDeclarativeExpression::error() const
}
/*! \internal */
-void QDeclarativeExpression::__q_notify()
+void QDeclarativeExpressionPrivate::_q_notify()
{
- Q_D(QDeclarativeExpression);
- d->emitValueChanged();
+ emitValueChanged();
}
void QDeclarativeExpressionPrivate::clearGuards()
@@ -625,7 +624,7 @@ void QDeclarativeExpressionPrivate::updateGuards(const QPODVector<QDeclarativeEn
static int notifyIdx = -1;
if (notifyIdx == -1)
- notifyIdx = QDeclarativeExpression::staticMetaObject.indexOfMethod("__q_notify()");
+ notifyIdx = QDeclarativeExpression::staticMetaObject.indexOfMethod("_q_notify()");
if (properties.count() != data->guardListLength) {
QDeclarativeNotifierEndpoint *newGuardList =
@@ -711,7 +710,7 @@ void QDeclarativeExpressionPrivate::updateGuards(const QPODVector<QDeclarativeEn
Emitted each time the expression value changes from the last time it was
evaluated. The expression must have been evaluated at least once (by
- calling QDeclarativeExpression::value()) before this signal will be emitted.
+ calling QDeclarativeExpression::evaluate()) before this signal will be emitted.
*/
void QDeclarativeExpressionPrivate::emitValueChanged()
@@ -771,3 +770,4 @@ bool QDeclarativeAbstractExpression::isValid() const
QT_END_NAMESPACE
+#include <moc_qdeclarativeexpression.cpp>
diff --git a/src/declarative/qml/qdeclarativeexpression.h b/src/declarative/qml/qdeclarativeexpression.h
index 35d6949..6c72e4d 100644
--- a/src/declarative/qml/qdeclarativeexpression.h
+++ b/src/declarative/qml/qdeclarativeexpression.h
@@ -86,7 +86,7 @@ public:
void clearError();
QDeclarativeError error() const;
- QVariant value(bool *isUndefined = 0);
+ QVariant evaluate(bool *valueIsUndefined = 0);
Q_SIGNALS:
void valueChanged();
@@ -97,13 +97,12 @@ protected:
QDeclarativeExpression(QDeclarativeContextData *, void *, QDeclarativeRefCount *rc,
QObject *me, const QString &, int, QDeclarativeExpressionPrivate &dd);
-private Q_SLOTS:
- void __q_notify();
-
private:
QDeclarativeExpression(QDeclarativeContextData *, const QString &, QObject *);
+ Q_DISABLE_COPY(QDeclarativeExpression)
Q_DECLARE_PRIVATE(QDeclarativeExpression)
+ Q_PRIVATE_SLOT(d_func(), void _q_notify())
friend class QDeclarativeDebugger;
friend class QDeclarativeContext;
friend class QDeclarativeVME;
diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h
index d39aa2c..4ff3162 100644
--- a/src/declarative/qml/qdeclarativeexpression_p.h
+++ b/src/declarative/qml/qdeclarativeexpression_p.h
@@ -164,6 +164,7 @@ public:
return expr->q_func();
}
+ void _q_notify();
virtual void emitValueChanged();
static void exceptionToError(QScriptEngine *, QDeclarativeError &);
diff --git a/src/declarative/qml/qdeclarativeextensionplugin.h b/src/declarative/qml/qdeclarativeextensionplugin.h
index 8095ec7..8a9378a 100644
--- a/src/declarative/qml/qdeclarativeextensionplugin.h
+++ b/src/declarative/qml/qdeclarativeextensionplugin.h
@@ -64,6 +64,9 @@ public:
virtual void registerTypes(const char *uri) = 0;
virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri);
+
+private:
+ Q_DISABLE_COPY(QDeclarativeExtensionPlugin)
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativewatcher.cpp b/src/declarative/qml/qdeclarativewatcher.cpp
index 9ea84b8..842b3c4 100644
--- a/src/declarative/qml/qdeclarativewatcher.cpp
+++ b/src/declarative/qml/qdeclarativewatcher.cpp
@@ -110,7 +110,7 @@ void QDeclarativeWatchProxy::notifyValueChanged()
{
QVariant v;
if (m_expr)
- v = m_expr->value();
+ v = m_expr->evaluate();
else
v = m_property.read(m_object);
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 4f7719b..3b0d264 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -780,7 +780,7 @@ void QDeclarativeScriptActionPrivate::execute()
QDeclarativeData *ddata = QDeclarativeData::get(q);
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
- expr.value();
+ expr.evaluate();
if (expr.hasError())
qmlInfo(q) << expr.error();
}
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index 596b306..c188521 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -150,8 +150,14 @@ void QDeclarativeConnections::setTarget(QObject *obj)
Q_D(QDeclarativeConnections);
if (d->target == obj)
return;
- foreach (QDeclarativeBoundSignal *s, d->boundsignals)
- delete s;
+ foreach (QDeclarativeBoundSignal *s, d->boundsignals) {
+ // It is possible that target is being changed due to one of our signal
+ // handlers -> use deleteLater().
+ if (s->isEvaluating())
+ s->deleteLater();
+ else
+ delete s;
+ }
d->boundsignals.clear();
d->target = obj;
connectSignals();
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index 8a6937d..2641dcf 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -434,7 +434,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
a.specifiedProperty = QString::fromUtf8(property);
if (d->isExplicit) {
- a.toValue = d->expressions.at(ii).second->value();
+ a.toValue = d->expressions.at(ii).second->evaluate();
} else {
QDeclarativeBinding *newBinding =
new QDeclarativeBinding(d->expressions.at(ii).second->expression(), object(), qmlContext(this));
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index 81f4230..2349ce1 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -288,7 +288,7 @@ bool QDeclarativeStateGroupPrivate::updateAutoState()
QDeclarativeState *state = states.at(ii);
if (state->isWhenKnown()) {
if (!state->name().isEmpty()) {
- if (state->when() && state->when()->value().toBool()) {
+ if (state->when() && state->when()->evaluate().toBool()) {
if (stateChangeDebug())
qWarning() << "Setting auto state due to:"
<< state->when()->expression();
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 0aad498..9049b83 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -579,7 +579,7 @@ void QDeclarativeStateChangeScript::execute(Reason)
QDeclarativeData *ddata = QDeclarativeData::get(this);
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
- expr.value();
+ expr.evaluate();
if (expr.hasError())
qmlInfo(this, expr.error());
}
diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h
index 1807758..3513c04 100644
--- a/src/declarative/util/qdeclarativeview.h
+++ b/src/declarative/util/qdeclarativeview.h
@@ -105,8 +105,10 @@ protected:
virtual void setRootObject(QObject *obj);
virtual bool eventFilter(QObject *watched, QEvent *e);
+private:
friend class QDeclarativeViewPrivate;
QDeclarativeViewPrivate *d;
+ Q_DISABLE_COPY(QDeclarativeView)
};
QT_END_NAMESPACE