aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/animations/qabstractanimationjob_p.h2
-rw-r--r--src/qml/animations/qanimationgroupjob_p.h2
-rw-r--r--src/qml/animations/qparallelanimationgroupjob_p.h2
-rw-r--r--src/qml/animations/qpauseanimationjob_p.h2
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob_p.h2
-rw-r--r--src/qml/debugger/qdebugmessageservice_p.h2
-rw-r--r--src/qml/doc/snippets/qml/imports/timeexample.qml2
-rw-r--r--src/qml/doc/src/cppintegration/extending-tutorial.qdoc3
-rw-r--r--src/qml/doc/src/modules/cppplugins.qdoc14
-rw-r--r--src/qml/doc/src/qtqml-cpp.qdoc4
-rw-r--r--src/qml/qml/qqmlextensionplugin.cpp12
-rw-r--r--src/qml/qml/qqmllist.cpp43
-rw-r--r--src/qml/qml/qqmllist.h10
-rw-r--r--src/qml/qml/qqmlopenmetaobject.cpp17
-rw-r--r--src/qml/qml/qqmlopenmetaobject_p.h4
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp33
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h1
-rw-r--r--src/qml/qml/qqmlvme.cpp11
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h2
-rw-r--r--src/qml/qml/v8/qv8contextwrapper.cpp1
20 files changed, 126 insertions, 43 deletions
diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h
index 12582a2986..0bf9169d0c 100644
--- a/src/qml/animations/qabstractanimationjob_p.h
+++ b/src/qml/animations/qabstractanimationjob_p.h
@@ -51,8 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Qml)
-
class QAnimationGroupJob;
class QAnimationJobChangeListener;
class Q_QML_PRIVATE_EXPORT QAbstractAnimationJob
diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h
index 99c80210fe..23a6aed610 100644
--- a/src/qml/animations/qanimationgroupjob_p.h
+++ b/src/qml/animations/qanimationgroupjob_p.h
@@ -48,8 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Qml)
-
class Q_QML_PRIVATE_EXPORT QAnimationGroupJob : public QAbstractAnimationJob
{
Q_DISABLE_COPY(QAnimationGroupJob)
diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h
index 04b8e326d8..8fee4e1606 100644
--- a/src/qml/animations/qparallelanimationgroupjob_p.h
+++ b/src/qml/animations/qparallelanimationgroupjob_p.h
@@ -48,8 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Qml)
-
class Q_QML_PRIVATE_EXPORT QParallelAnimationGroupJob : public QAnimationGroupJob
{
Q_DISABLE_COPY(QParallelAnimationGroupJob)
diff --git a/src/qml/animations/qpauseanimationjob_p.h b/src/qml/animations/qpauseanimationjob_p.h
index e3b492eecf..95212526ce 100644
--- a/src/qml/animations/qpauseanimationjob_p.h
+++ b/src/qml/animations/qpauseanimationjob_p.h
@@ -48,8 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Qml)
-
class Q_QML_PRIVATE_EXPORT QPauseAnimationJob : public QAbstractAnimationJob
{
Q_DISABLE_COPY(QPauseAnimationJob)
diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h
index 84d1331b64..25ac3f5eb5 100644
--- a/src/qml/animations/qsequentialanimationgroupjob_p.h
+++ b/src/qml/animations/qsequentialanimationgroupjob_p.h
@@ -48,8 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Qml)
-
class QPauseAnimationJob;
class Q_QML_PRIVATE_EXPORT QSequentialAnimationGroupJob : public QAnimationGroupJob
{
diff --git a/src/qml/debugger/qdebugmessageservice_p.h b/src/qml/debugger/qdebugmessageservice_p.h
index 181c172570..efe056333f 100644
--- a/src/qml/debugger/qdebugmessageservice_p.h
+++ b/src/qml/debugger/qdebugmessageservice_p.h
@@ -61,8 +61,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Qml)
-
class QDebugMessageServicePrivate;
class QDebugMessageService : public QQmlDebugService
diff --git a/src/qml/doc/snippets/qml/imports/timeexample.qml b/src/qml/doc/snippets/qml/imports/timeexample.qml
index f9c2411d02..97668452c0 100644
--- a/src/qml/doc/snippets/qml/imports/timeexample.qml
+++ b/src/qml/doc/snippets/qml/imports/timeexample.qml
@@ -39,7 +39,7 @@
****************************************************************************/
//! [import]
-import com.nokia.TimeExample 1.0
+import TimeExample 1.0
//! [import]
Item {
diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
index 3bf8adc7b3..5787977bc4 100644
--- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
+++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
@@ -67,7 +67,7 @@ and \l {qtqml-cppintegration-definetypes.html}{Defining QML Types from C++}.
\example examples/tutorials/extending/chapter1-basics
A common task when extending QML is to provide a new QML type that supports some
- custom functionality beyond what is provided by the built-in \l {QML Types Provided by Qt Quick}{QtQuick types}.
+ custom functionality beyond what is provided by the built-in \l {Qt Quick QML Types}{QtQuick types}.
For example, this could be done to implement particular data models, or provide
elements with custom painting and drawing capabilities, or access system features
like network programming that are not accessible through built-in QML features.
@@ -479,4 +479,3 @@ Or randomly add and remove slices from time to time using \l{Property Value Sour
See the \l{Integrating QML and C++} documentation for more information.
*/
-
diff --git a/src/qml/doc/src/modules/cppplugins.qdoc b/src/qml/doc/src/modules/cppplugins.qdoc
index 31ff02c2f4..2a08d732c0 100644
--- a/src/qml/doc/src/modules/cppplugins.qdoc
+++ b/src/qml/doc/src/modules/cppplugins.qdoc
@@ -87,12 +87,12 @@
types into the runtime.
For this example, the TimeExample source directory is in
- \c{com/nokia/TimeExample}. The plugin's type namespace will mirror
+ \c{imports/TimeExample}. The plugin's type namespace will mirror
this structure, so the types are registered into the namespace
- "com.nokia.TimeExample".
+ "TimeExample".
Additionally, the project file, in a \c .pro file, defines the project as a plugin library,
- specifies it should be built into the \c com/nokia/TimeExample directory, and registers
+ specifies it should be built into the \c imports/TimeExample directory, and registers
the plugin target name and various other details:
\code
@@ -100,21 +100,21 @@
CONFIG += qt plugin
QT += qml
- DESTDIR = com/nokia/TimeExample
+ DESTDIR = imports/TimeExample
TARGET = qmlqtimeexampleplugin
SOURCES += qexampleqmlplugin.cpp
\endcode
Finally, a \l{Module Definition qmldir Files}{qmldir file} is required
- in the \c com/nokia/TimeExample directory to describe the plugin and the types that it
+ in the \c imports/TimeExample directory to describe the plugin and the types that it
exports. The plugin includes a \c Clock.qml file along with the \c qmlqtimeexampleplugin
that is built by the project (as shown above in the \c .pro file) so both of these
need to be specified in the \c qmldir file:
- \quotefile examples/qml/plugins/com/nokia/TimeExample/qmldir
+ \quotefile examples/qml/plugins/imports/TimeExample/qmldir
Once the project is built and installed, the new \c Time component is
- accessible by any QML component that imports the \c com.nokia.TimeExample
+ accessible by any QML component that imports the \c TimeExample
module
\snippet examples/qml/plugins/plugins.qml 0
diff --git a/src/qml/doc/src/qtqml-cpp.qdoc b/src/qml/doc/src/qtqml-cpp.qdoc
index 4a7ea0c1bb..5fe9292588 100644
--- a/src/qml/doc/src/qtqml-cpp.qdoc
+++ b/src/qml/doc/src/qtqml-cpp.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
\module QtQml
-\title Qt QML Module - C++ Classes
+\title Qt QML Module C++ Classes
\brief The C++ API provided by the Qt QML module
To include the definitions of the module's classes, use the
@@ -46,5 +46,3 @@ QT += qml
For more information on the Qt QML module, see the
\l{Qt QML} module documentation.
*/
-
-
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp
index 36abc3a9e4..2f0e804019 100644
--- a/src/qml/qml/qqmlextensionplugin.cpp
+++ b/src/qml/qml/qqmlextensionplugin.cpp
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
To make this class available as a QML type, create a plugin that registers
this type with a specific \l {QML Modules}{module} using qmlRegisterType(). For this example the plugin
- module will be named \c com.nokia.TimeExample (as defined in the project
+ module will be named \c TimeExample (as defined in the project
file further below).
\snippet examples/qml/plugins/plugin.cpp plugin
@@ -93,27 +93,27 @@ QT_BEGIN_NAMESPACE
ensures the module is imported correctly by any QML components that use this plugin.
The project file defines the project as a plugin library and specifies
- it should be built into the \c com/nokia/TimeExample directory:
+ it should be built into the \c imports/TimeExample directory:
\code
TEMPLATE = lib
CONFIG += qt plugin
QT += qml
- DESTDIR = com/nokia/TimeExample
+ DESTDIR = imports/TimeExample
TARGET = qmlqtimeexampleplugin
...
\endcode
- Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c com/nokia/TimeExample directory
+ Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c imports/TimeExample directory
that describes the plugin. This directory includes a \c Clock.qml file that
should be bundled with the plugin, so it needs to be specified in the \c qmldir
file:
- \quotefile examples/qml/plugins/com/nokia/TimeExample/qmldir
+ \quotefile examples/qml/plugins/imports/TimeExample/qmldir
Once the project is built and installed, the new \c Time element can be
- used by any QML component that imports the \c com.nokia.TimeExample module:
+ used by any QML component that imports the \c TimeExample module:
\snippet examples/qml/plugins/plugins.qml 0
diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp
index 2aef3f2cd7..e90633ac1a 100644
--- a/src/qml/qml/qqmllist.cpp
+++ b/src/qml/qml/qqmllist.cpp
@@ -254,6 +254,32 @@ bool QQmlListReference::canCount() const
}
/*!
+ Return true if at(), count(), append() and clear() are implemented, so you can manipulate
+ the list.
+
+\sa isReadable(), at(), count(), append(), clear()
+*/
+bool QQmlListReference::isManipulable() const
+{
+ return (isValid()
+ && d->property.append
+ && d->property.count
+ && d->property.at
+ && d->property.clear);
+}
+
+
+/*!
+ Return true if at() and count() are implemented, so you can access the elements.
+
+\sa isManipulable(), at(), count()
+*/
+bool QQmlListReference::isReadable() const
+{
+ return (isValid() && d->property.count && d->property.at);
+}
+
+/*!
Appends \a object to the list. Returns true if the operation succeeded, otherwise false.
\sa canAppend()
@@ -366,16 +392,25 @@ can very useful while prototyping.
*/
/*!
+\fn QQmlListProperty::QQmlListProperty(QObject *object, void *data,
+ CountFunction count, AtFunction at)
+
+Construct a readonly QQmlListProperty from a set of operation functions. An opaque \a data handle
+may be passed which can be accessed from within the operation functions. The list property
+remains valid while \a object exists.
+*/
+
+/*!
\fn QQmlListProperty::QQmlListProperty(QObject *object, void *data, AppendFunction append,
- CountFunction count = 0, AtFunction at = 0,
- ClearFunction clear = 0)
+ CountFunction count, AtFunction at,
+ ClearFunction clear)
Construct a QQmlListProperty from a set of operation functions. An opaque \a data handle
may be passed which can be accessed from within the operation functions. The list property
remains valid while \a object exists.
-The \a append operation is compulsory and must be provided, while the \a count, \a at and
-\a clear methods are optional.
+You can pass a null pointer, but than the list will be not designable or changeable by the debugger.
+So provide all function, except it is not possible.
*/
/*!
diff --git a/src/qml/qml/qqmllist.h b/src/qml/qml/qqmllist.h
index bc2feaf22f..e772022636 100644
--- a/src/qml/qml/qqmllist.h
+++ b/src/qml/qml/qqmllist.h
@@ -69,10 +69,11 @@ public:
QQmlListProperty(QObject *o, QList<T *> &list)
: object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at),
clear(qlist_clear), dummy1(0), dummy2(0) {}
- QQmlListProperty(QObject *o, void *d, AppendFunction a, CountFunction c = 0, AtFunction t = 0,
- ClearFunction r = 0)
+ QQmlListProperty(QObject *o, void *d, AppendFunction a, CountFunction c, AtFunction t,
+ ClearFunction r )
: object(o), data(d), append(a), count(c), at(t), clear(r), dummy1(0), dummy2(0) {}
-
+ QQmlListProperty(QObject *o, void *d, CountFunction c, AtFunction t)
+ : object(o), data(d), append(0), count(c), at(t), clear(0), dummy1(0), dummy2(0) {}
bool operator==(const QQmlListProperty &o) const {
return object == o.object &&
data == o.data &&
@@ -132,6 +133,9 @@ public:
bool canClear() const;
bool canCount() const;
+ bool isManipulable() const;
+ bool isReadable() const;
+
bool append(QObject *) const;
QObject *at(int) const;
bool clear() const;
diff --git a/src/qml/qml/qqmlopenmetaobject.cpp b/src/qml/qml/qqmlopenmetaobject.cpp
index a92d822774..5928a6dfb7 100644
--- a/src/qml/qml/qqmlopenmetaobject.cpp
+++ b/src/qml/qml/qqmlopenmetaobject.cpp
@@ -96,6 +96,23 @@ int QQmlOpenMetaObjectType::signalOffset() const
return d->signalOffset;
}
+int QQmlOpenMetaObjectType::propertyCount() const
+{
+ return d->names.count();
+}
+
+QByteArray QQmlOpenMetaObjectType::propertyName(int idx) const
+{
+ Q_ASSERT(idx >= 0 && idx < d->names.count());
+
+ return d->mob.property(idx).name();
+}
+
+QMetaObject *QQmlOpenMetaObjectType::metaObject() const
+{
+ return d->mem;
+}
+
int QQmlOpenMetaObjectType::createProperty(const QByteArray &name)
{
int id = d->mob.propertyCount();
diff --git a/src/qml/qml/qqmlopenmetaobject_p.h b/src/qml/qml/qqmlopenmetaobject_p.h
index 1ca53df772..d037776150 100644
--- a/src/qml/qml/qqmlopenmetaobject_p.h
+++ b/src/qml/qml/qqmlopenmetaobject_p.h
@@ -69,6 +69,10 @@ public:
int propertyOffset() const;
int signalOffset() const;
+ int propertyCount() const;
+ QByteArray propertyName(int) const;
+ QMetaObject *metaObject() const;
+
protected:
virtual void propertyCreated(int, QMetaPropertyBuilder &);
virtual void clear();
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 431a5be01b..c1c4a6c03d 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -849,6 +849,39 @@ void QQmlPropertyCache::update(QQmlEngine *engine, const QMetaObject *metaObject
}
/*! \internal
+ invalidates and updates the PropertyCache if the QMetaObject has changed.
+ This function is used in the tooling to update dynamic properties.
+*/
+void QQmlPropertyCache::invalidate(QQmlEngine *engine, const QMetaObject *metaObject)
+{
+ stringCache.clear();
+ propertyIndexCache.clear();
+ methodIndexCache.clear();
+ signalHandlerIndexCache.clear();
+
+ _hasPropertyOverrides = false;
+ argumentsCache = 0;
+
+ int pc = metaObject->propertyCount();
+ int mc = metaObject->methodCount();
+ int sc = metaObjectSignalCount(metaObject);
+ int reserve = pc + mc + sc;
+
+ if (parent()) {
+ propertyIndexCacheStart = parent()->propertyIndexCache.count() + parent()->propertyIndexCacheStart;
+ methodIndexCacheStart = parent()->methodIndexCache.count() + parent()->methodIndexCacheStart;
+ signalHandlerIndexCacheStart = parent()->signalHandlerIndexCache.count() + parent()->signalHandlerIndexCacheStart;
+ stringCache.linkAndReserve(parent()->stringCache, reserve);
+ append(engine, metaObject, -1);
+ } else {
+ propertyIndexCacheStart = 0;
+ methodIndexCacheStart = 0;
+ signalHandlerIndexCacheStart = 0;
+ update(engine, metaObject);
+ }
+}
+
+/*! \internal
\a index MUST be in the signal index range (see QObjectPrivate::signalIndex()).
This is different from QMetaMethod::methodIndex().
*/
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 4310e4ea40..14be99045f 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -247,6 +247,7 @@ public:
virtual ~QQmlPropertyCache();
void update(QQmlEngine *, const QMetaObject *);
+ void invalidate(QQmlEngine *, const QMetaObject *);
QQmlPropertyCache *copy();
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 045869e15d..12de9ffebd 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -941,7 +941,10 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QObject *assign = objects.pop();
const List &list = lists.top();
- list.qListProperty.append((QQmlListProperty<void>*)&list.qListProperty, assign);
+ if (list.qListProperty.append)
+ list.qListProperty.append((QQmlListProperty<void>*)&list.qListProperty, assign);
+ else
+ VME_EXCEPTION(tr("Cannot assign object to read only list"), -1);
QML_END_INSTR(StoreObjectQList)
QML_BEGIN_INSTR(AssignObjectList)
@@ -959,8 +962,10 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
if (!ptr)
VME_EXCEPTION(tr("Cannot assign object to list"), instr.line);
-
- list.qListProperty.append((QQmlListProperty<void>*)&list.qListProperty, ptr);
+ if (list.qListProperty.append)
+ list.qListProperty.append((QQmlListProperty<void>*)&list.qListProperty, ptr);
+ else
+ VME_EXCEPTION(tr("Cannot assign object to read only list"), -1);
QML_END_INSTR(AssignObjectList)
QML_BEGIN_INSTR(StoreInterface)
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index c858370d27..c46989eb25 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -157,7 +157,7 @@ class QV8QObjectWrapper;
class QQmlVMEVariant;
class QQmlRefCount;
class QQmlVMEMetaObjectEndpoint;
-class Q_AUTOTEST_EXPORT QQmlVMEMetaObject : public QAbstractDynamicMetaObject,
+class Q_QML_PRIVATE_EXPORT QQmlVMEMetaObject : public QAbstractDynamicMetaObject,
public QV8GCCallback::Node
{
public:
diff --git a/src/qml/qml/v8/qv8contextwrapper.cpp b/src/qml/qml/v8/qv8contextwrapper.cpp
index b2c60fe7a8..9f18afc5cb 100644
--- a/src/qml/qml/v8/qv8contextwrapper.cpp
+++ b/src/qml/qml/v8/qv8contextwrapper.cpp
@@ -309,7 +309,6 @@ v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property,
const QVariant &value = cp->propertyValues.at(propertyIdx);
if (value.userType() == qMetaTypeId<QList<QObject*> >()) {
QQmlListProperty<QObject> prop(context->asQQmlContext(), (void*) qintptr(propertyIdx),
- 0,
QQmlContextPrivate::context_count,
QQmlContextPrivate::context_at);
return engine->listWrapper()->newList(prop, qMetaTypeId<QQmlListProperty<QObject> >());