summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-23 01:53:26 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-23 01:53:26 (GMT)
commite24aa4af60718e17405871fb3776107adc0b36f1 (patch)
treea055210a51704f4454398b64d6a77e4608210369 /src/declarative/qml
parent92e7f06b3690e6e39af8fac7af6c101b416b0f4c (diff)
parentf6f247737c15e8180299b1c1c3f3704434a9b29a (diff)
downloadQt-e24aa4af60718e17405871fb3776107adc0b36f1.zip
Qt-e24aa4af60718e17405871fb3776107adc0b36f1.tar.gz
Qt-e24aa4af60718e17405871fb3776107adc0b36f1.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp4
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp38
-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
11 files changed, 44 insertions, 40 deletions
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index eb352a2..89f1256 100644
--- a/src/declarative/qml/qdeclarativeboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -97,8 +97,6 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMeth
QObject *parent)
: 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.
@@ -113,8 +111,6 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, cons
QObject *parent)
: 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.
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index c86f089..3899e73 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
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);