aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob.cpp4
-rw-r--r--src/qml/debugger/qqmldebugserver.cpp20
-rw-r--r--src/qml/debugger/qqmldebugserver_p.h2
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp137
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h98
-rw-r--r--src/qml/debugger/qv8debugservice.cpp16
-rw-r--r--src/qml/debugger/qv8debugservice_p.h5
-rw-r--r--src/qml/doc/qtqml.qdocconf14
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatagroup.qml81
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel.qml (renamed from src/qml/doc/snippets/qml/folderlistmodel.qml)29
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp (renamed from src/qml/doc/snippets/qml/qtbinding/resources/main.cpp)15
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml (renamed from src/qml/doc/snippets/qml/xmlrole.qml)54
-rw-r--r--src/qml/doc/snippets/qml/colors.qml125
-rw-r--r--src/qml/doc/snippets/qml/imports/merged-named-imports.qml15
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc (renamed from src/qml/doc/snippets/qml/qtbinding/resources/main.qml)11
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/resources/example.qrc10
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/resources/resources.pro4
-rw-r--r--src/qml/doc/src/cppclasses/topic.qdoc20
-rw-r--r--src/qml/doc/src/cppintegration/contextproperties.qdoc2
-rw-r--r--src/qml/doc/src/cppintegration/data.qdoc8
-rw-r--r--src/qml/doc/src/cppintegration/definetypes.qdoc20
-rw-r--r--src/qml/doc/src/cppintegration/extending-tutorial.qdoc98
-rw-r--r--src/qml/doc/src/cppintegration/topic.qdoc10
-rw-r--r--src/qml/doc/src/javascript/date.qdoc3
-rw-r--r--src/qml/doc/src/javascript/dynamicobjectcreation.qdoc22
-rw-r--r--src/qml/doc/src/javascript/hostenvironment.qdoc9
-rw-r--r--src/qml/doc/src/javascript/imports.qdoc10
-rw-r--r--src/qml/doc/src/javascript/number.qdoc3
-rw-r--r--src/qml/doc/src/javascript/string.qdoc3
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc28
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc (renamed from src/qml/doc/src/documents/definetypes.qdoc)2
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc (renamed from src/qml/doc/src/documents/networktransparency.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/scope.qdoc (renamed from src/qml/doc/src/documents/scope.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/structure.qdoc (renamed from src/qml/doc/src/documents/structure.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/topic.qdoc (renamed from src/qml/doc/src/documents/topic.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc (renamed from src/qml/doc/src/modules/cppplugins.qdoc)8
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc (renamed from src/qml/doc/src/modules/identifiedmodules.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc (renamed from src/qml/doc/src/modules/legacymodules.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc (renamed from src/qml/doc/src/modules/qmldir.qdoc)7
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/topic.qdoc (renamed from src/qml/doc/src/modules/topic.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/qmlreference.qdoc113
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/basics.qdoc (renamed from src/qml/doc/src/syntax/basics.qdoc)8
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc (renamed from src/qml/doc/src/syntax/directoryimports.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/imports.qdoc (renamed from src/qml/doc/src/syntax/imports.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc (renamed from src/qml/doc/src/syntax/objectattributes.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc (renamed from src/qml/doc/src/syntax/propertybinding.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/signals.qdoc (renamed from src/qml/doc/src/syntax/signals.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc (renamed from src/qml/doc/src/typesystem/basictypes.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc (renamed from src/qml/doc/src/typesystem/objecttypes.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc (renamed from src/qml/doc/src/typesystem/topic.qdoc)0
-rw-r--r--src/qml/doc/src/qmltypereference.qdoc111
-rw-r--r--src/qml/doc/src/qtqml.qdoc215
-rw-r--r--src/qml/doc/src/whatsnew.qdoc39
-rw-r--r--src/qml/qml/ftw/qhashedstring.cpp6
-rw-r--r--src/qml/qml/parser/qqmljs.g4
-rw-r--r--src/qml/qml/parser/qqmljsparser.cpp4
-rw-r--r--src/qml/qml/qml.pri2
-rw-r--r--src/qml/qml/qqml.h18
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor.cpp91
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor_p.h66
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp11
-rw-r--r--src/qml/qml/qqmlcompileddata.cpp1
-rw-r--r--src/qml/qml/qqmlcompiler.cpp5
-rw-r--r--src/qml/qml/qqmlcomponent.cpp69
-rw-r--r--src/qml/qml/qqmlcomponentattached_p.h3
-rw-r--r--src/qml/qml/qqmlcontext.cpp16
-rw-r--r--src/qml/qml/qqmlcustomparser_p.h2
-rw-r--r--src/qml/qml/qqmldata_p.h9
-rw-r--r--src/qml/qml/qqmlengine.cpp109
-rw-r--r--src/qml/qml/qqmlengine.h4
-rw-r--r--src/qml/qml/qqmlengine_p.h5
-rw-r--r--src/qml/qml/qqmlerror.cpp27
-rw-r--r--src/qml/qml/qqmlerror.h2
-rw-r--r--src/qml/qml/qqmlexpression.cpp2
-rw-r--r--src/qml/qml/qqmlextensionplugin.cpp30
-rw-r--r--src/qml/qml/qqmlglobal_p.h6
-rw-r--r--src/qml/qml/qqmlimport.cpp10
-rw-r--r--src/qml/qml/qqmlimport_p.h2
-rw-r--r--src/qml/qml/qqmlinfo.cpp24
-rw-r--r--src/qml/qml/qqmlinfo.h19
-rw-r--r--src/qml/qml/qqmlinstruction.cpp2
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp7
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h1
-rw-r--r--src/qml/qml/qqmllist.cpp4
-rw-r--r--src/qml/qml/qqmllocale.cpp8
-rw-r--r--src/qml/qml/qqmlmetatype.cpp46
-rw-r--r--src/qml/qml/qqmlmetatype_p.h2
-rw-r--r--src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp2
-rw-r--r--src/qml/qml/qqmlparserstatus.cpp2
-rw-r--r--src/qml/qml/qqmlprivate.h2
-rw-r--r--src/qml/qml/qqmlproperty.cpp7
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp51
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h2
-rw-r--r--src/qml/qml/qqmlscript.cpp6
-rw-r--r--src/qml/qml/qqmlscript_p.h2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp31
-rw-r--r--src/qml/qml/qqmltypeloader_p.h11
-rw-r--r--src/qml/qml/qqmlvme.cpp50
-rw-r--r--src/qml/qml/qqmlvme_p.h6
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp5
-rw-r--r--src/qml/qml/v4/qv4jsonobject_p.h1
-rw-r--r--src/qml/qml/v4/qv4qobjectwrapper.cpp10
-rw-r--r--src/qml/qml/v8/qjsengine.cpp4
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp28
-rw-r--r--src/qml/types/qqmlbind.cpp2
-rw-r--r--src/qml/types/qqmlconnections.cpp2
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp134
-rw-r--r--src/qml/types/qqmlinstantiator.cpp10
-rw-r--r--src/qml/types/qqmlinstantiator_p_p.h9
-rw-r--r--src/qml/types/qqmllistmodel.cpp34
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h7
-rw-r--r--src/qml/types/qqmlobjectmodel.cpp3
-rw-r--r--src/qml/types/qquickpackage.cpp3
113 files changed, 1563 insertions, 873 deletions
diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp
index c649370680..b82e1850f7 100644
--- a/src/qml/animations/qsequentialanimationgroupjob.cpp
+++ b/src/qml/animations/qsequentialanimationgroupjob.cpp
@@ -226,14 +226,14 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime)
if (atEnd()) {
//we make sure that we don't exceed the duration here
m_currentTime += m_currentAnimation->currentTime() - newCurrentTime;
- stop();
+ RETURN_IF_DELETED(stop());
}
} else {
//the only case where currentAnimation could be null
//is when all animations have been removed
Q_ASSERT(!firstChild());
m_currentTime = 0;
- stop();
+ RETURN_IF_DELETED(stop());
}
m_previousLoop = m_currentLoop;
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp
index 27e3d226cd..53ad15775c 100644
--- a/src/qml/debugger/qqmldebugserver.cpp
+++ b/src/qml/debugger/qqmldebugserver.cpp
@@ -102,9 +102,8 @@ public:
bool gotHello;
bool blockingMode;
- QMutex messageArrivedMutex;
- QWaitCondition messageArrivedCondition;
- QStringList waitingForMessageNames;
+ QMutex helloMutex;
+ QWaitCondition helloCondition;
QQmlDebugServerThread *thread;
QPluginLoader loader;
QAtomicInt changeServiceStateCalls;
@@ -298,6 +297,7 @@ QQmlDebugServer *QQmlDebugServer::instance()
for (; argsIt != argsItEnd; ++argsIt) {
const QString strArgument = *argsIt;
if (strArgument.startsWith(QLatin1String("port:"))) {
+ pluginName = QLatin1String("qmldbg_tcp");
portFrom = strArgument.mid(5).toInt(&ok);
portTo = portFrom;
QStringList::const_iterator argsNext = argsIt + 1;
@@ -308,7 +308,6 @@ QQmlDebugServer *QQmlDebugServer::instance()
portTo = nextArgument.toInt(&ok);
++argsIt;
}
- pluginName = QLatin1String("qmldbg_tcp");
} else if (strArgument.startsWith(QLatin1String("host:"))) {
hostAddress = strArgument.mid(5);
} else if (strArgument == QLatin1String("block")) {
@@ -331,11 +330,11 @@ QQmlDebugServer *QQmlDebugServer::instance()
QQmlDebugServerPrivate *d = qQmlDebugServer->d_func();
d->blockingMode = block;
- QMutexLocker locker(&d->messageArrivedMutex);
+ QMutexLocker locker(&d->helloMutex);
thread->start();
if (d->blockingMode)
- d->messageArrivedCondition.wait(&d->messageArrivedMutex);
+ d->helloCondition.wait(&d->helloMutex);
} else {
qWarning() << QString(QLatin1String(
@@ -418,10 +417,13 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
if (s_dataStreamVersion > QDataStream().version())
s_dataStreamVersion = QDataStream().version();
}
+
// Send the hello answer immediately, since it needs to arrive before
// the plugins below start sending messages.
+
QByteArray helloAnswer;
{
+ QReadLocker readPluginsLock(&d->pluginsLock);
QQmlDebugStream out(&helloAnswer, QIODevice::WriteOnly);
QStringList pluginNames;
QList<float> pluginVersions;
@@ -447,7 +449,8 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
d->_q_changeServiceState(iter.value()->name(), newState);
}
- d->messageArrivedCondition.wakeAll();
+ QMutexLocker helloLock(&d->helloMutex);
+ d->helloCondition.wakeAll();
} else if (op == 1) {
@@ -487,9 +490,6 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
qWarning() << "QML Debugger: Message received for missing plugin" << name << '.';
} else {
(*iter)->messageReceived(message);
-
- if (d->waitingForMessageNames.removeOne(name))
- d->messageArrivedCondition.wakeAll();
}
} else {
qWarning("QML Debugger: Invalid hello message.");
diff --git a/src/qml/debugger/qqmldebugserver_p.h b/src/qml/debugger/qqmldebugserver_p.h
index 27d54d6947..e285d7cfe7 100644
--- a/src/qml/debugger/qqmldebugserver_p.h
+++ b/src/qml/debugger/qqmldebugserver_p.h
@@ -71,8 +71,6 @@ public:
static QQmlDebugServer *instance();
- void setConnection(QQmlDebugServerConnection *connection);
-
bool hasDebuggingClient() const;
bool blockingMode() const;
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index cb85fc0e1f..0ba939cdca 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
// instance will be set, unset in constructor. Allows static methods to be inlined.
QQmlProfilerService *QQmlProfilerService::instance = 0;
Q_GLOBAL_STATIC(QQmlProfilerService, profilerInstance)
-
+bool QQmlProfilerService::enabled = false;
// convert to a QByteArray that can be sent to the debug client
// use of QDataStream can skew results
@@ -76,12 +76,46 @@ QByteArray QQmlProfilerData::toByteArray() const
if (messageType == (int)QQmlProfilerService::Event &&
detailType == (int)QQmlProfilerService::AnimationFrame)
ds << framerate << animationcount;
+ if (messageType == (int)QQmlProfilerService::PixmapCacheEvent) {
+ ds << detailData;
+ switch (detailType) {
+ case QQmlProfilerService::PixmapSizeKnown: ds << line << column; break;
+ case QQmlProfilerService::PixmapReferenceCountChanged: ds << animationcount; break;
+ case QQmlProfilerService::PixmapCacheCountChanged: ds << animationcount; break;
+ default: break;
+ }
+ }
+ if (messageType == (int)QQmlProfilerService::SceneGraphFrame) {
+ switch (detailType) {
+ // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime
+ case QQmlProfilerService::SceneGraphRendererFrame: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
+ // AdaptationLayerFrame: glyphCount (which is an integer), glyphRenderTime, glyphStoreTime
+ case QQmlProfilerService::SceneGraphAdaptationLayerFrame: ds << (int)subtime_1 << subtime_2 << subtime_3; break;
+ // ContextFrame: compiling material time
+ case QQmlProfilerService::SceneGraphContextFrame: ds << subtime_1; break;
+ // RenderLoop: syncTime, renderTime, swapTime
+ case QQmlProfilerService::SceneGraphRenderLoopFrame: ds << subtime_1 << subtime_2 << subtime_3; break;
+ // TexturePrepare: bind, convert, swizzle, upload, mipmap
+ case QQmlProfilerService::SceneGraphTexturePrepare: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4 << subtime_5; break;
+ // TextureDeletion: deletionTime
+ case QQmlProfilerService::SceneGraphTextureDeletion: ds << subtime_1; break;
+ // PolishAndSync: polishTime, waitTime, syncTime, animationsTime,
+ case QQmlProfilerService::SceneGraphPolishAndSync: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
+ // WindowsRenderLoop: GL time, make current time, SceneGraph time
+ case QQmlProfilerService::SceneGraphWindowsRenderShow: ds << subtime_1 << subtime_2 << subtime_3; break;
+ // WindowsAnimations: update time
+ case QQmlProfilerService::SceneGraphWindowsAnimations: ds << subtime_1; break;
+ // WindowsRenderWindow: polish time
+ case QQmlProfilerService::SceneGraphWindowsPolishFrame: ds << subtime_1; break;
+ default:break;
+ }
+ }
+
return data;
}
QQmlProfilerService::QQmlProfilerService()
- : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1),
- m_enabled(false)
+ : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1)
{
m_timer.start();
@@ -131,6 +165,11 @@ void QQmlProfilerService::animationFrame(qint64 delta)
profilerInstance()->animationFrameImpl(delta);
}
+void QQmlProfilerService::sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5)
+{
+ profilerInstance()->sceneGraphFrameImpl(frameType, value1, value2, value3, value4, value5);
+}
+
void QQmlProfilerService::sendProfilingData()
{
profilerInstance()->sendMessages();
@@ -160,88 +199,136 @@ bool QQmlProfilerService::stopProfilingImpl()
void QQmlProfilerService::sendStartedProfilingMessageImpl()
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)StartTrace,
- QString(), -1, -1, 0, 0, 0};
+ QString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
QQmlDebugService::sendMessage(ed.toByteArray());
}
void QQmlProfilerService::addEventImpl(EventType event)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)event,
- QString(), -1, -1, 0, 0, 0};
+ QString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(ed);
}
void QQmlProfilerService::startRange(RangeType range, BindingType bindingType)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeStart, (int)range,
- QString(), -1, -1, 0, 0, (int)bindingType};
+ QString(), -1, -1, 0, 0, (int)bindingType,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeData(RangeType range, const QString &rData)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeData, (int)range,
- rData, -1, -1, 0, 0, 0};
+ rData, -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeData(RangeType range, const QUrl &rData)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeData, (int)range,
- rData.toString(), -1, -1, 0, 0, 0};
+ rData.toString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeLocation(RangeType range, const QString &fileName, int line, int column)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeLocation, (int)range,
- fileName, line, column, 0, 0, 0};
+ fileName, line, column, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeLocation(RangeType range, const QUrl &fileName, int line, int column)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeLocation, (int)range,
- fileName.toString(), line, column, 0, 0, 0};
+ fileName.toString(), line, column, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::endRange(RangeType range)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeEnd, (int)range,
- QString(), -1, -1, 0, 0, 0};
+ QString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url)
+{
+ // assuming enabled checked by caller
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType,
+ url.toString(), -1, -1, -1, -1, -1,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height)
+{
+ // assuming enabled checked by caller
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType,
+ url.toString(), width, height, -1, -1, -1,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count)
+{
+ // assuming enabled checked by caller
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType,
+ url.toString(), -1, -1, -1, count, -1,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::sceneGraphFrameImpl(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5)
+{
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
+ return;
+
+ // because I already have some space to store ints in the struct, I'll use it to store the frame data
+ // even though the field names do not match
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)SceneGraphFrame, (int)frameType, QString(),
+ -1, -1, -1, -1, -1,
+ value1, value2, value3, value4, value5};
processMessage(rd);
}
void QQmlProfilerService::animationFrameImpl(qint64 delta)
{
Q_ASSERT(QQmlDebugService::isDebuggingEnabled());
- if (!m_enabled)
+ if (!enabled)
return;
int animCount = QUnifiedTimer::instance()->runningAnimationCount();
@@ -250,7 +337,8 @@ void QQmlProfilerService::animationFrameImpl(qint64 delta)
// trim fps to integer
int fps = 1000 / delta;
QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)AnimationFrame,
- QString(), -1, -1, fps, animCount, 0};
+ QString(), -1, -1, fps, animCount, 0,
+ 0, 0, 0, 0, 0};
processMessage(ed);
}
}
@@ -267,12 +355,12 @@ void QQmlProfilerService::processMessage(const QQmlProfilerData &message)
bool QQmlProfilerService::profilingEnabled()
{
- return m_enabled;
+ return enabled;
}
void QQmlProfilerService::setProfilingEnabled(bool enable)
{
- m_enabled = enable;
+ enabled = enable;
}
/*
@@ -281,6 +369,7 @@ void QQmlProfilerService::setProfilingEnabled(bool enable)
void QQmlProfilerService::sendMessages()
{
QMutexLocker locker(&m_dataMutex);
+
QList<QByteArray> messages;
for (int i = 0; i < m_data.count(); ++i)
messages << m_data.at(i).toByteArray();
@@ -303,7 +392,7 @@ void QQmlProfilerService::stateAboutToBeChanged(QQmlDebugService::State newState
return;
if (state() == Enabled
- && m_enabled) {
+ && enabled) {
stopProfilingImpl();
sendMessages();
}
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index a50fb5ea08..fb08a30c6a 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -74,12 +74,18 @@ struct Q_AUTOTEST_EXPORT QQmlProfilerData
//###
QString detailData; //used by RangeData and RangeLocation
- int line; //used by RangeLocation
- int column; //used by RangeLocation
+ int line; //used by RangeLocation, also as "width" for pixmaps
+ int column; //used by RangeLocation, also as "height" for pixmaps
int framerate; //used by animation events
- int animationcount; //used by animation events
+ int animationcount; //used by animation events, also as "cache/reference count" for pixmaps
int bindingType;
+ qint64 subtime_1;
+ qint64 subtime_2;
+ qint64 subtime_3;
+ qint64 subtime_4;
+ qint64 subtime_5;
+
QByteArray toByteArray() const;
};
@@ -99,6 +105,8 @@ public:
RangeLocation,
RangeEnd,
Complete, // end of transmission
+ PixmapCacheEvent,
+ SceneGraphFrame,
MaximumMessage
};
@@ -132,14 +140,43 @@ public:
MaximumBindingType
};
+ enum PixmapEventType {
+ PixmapSizeKnown,
+ PixmapReferenceCountChanged,
+ PixmapCacheCountChanged,
+ PixmapLoadingStarted,
+ PixmapLoadingFinished,
+ PixmapLoadingError,
+
+ MaximumPixmapEventType
+ };
+
+ enum SceneGraphFrameType {
+ SceneGraphRendererFrame,
+ SceneGraphAdaptationLayerFrame,
+ SceneGraphContextFrame,
+ SceneGraphRenderLoopFrame,
+ SceneGraphTexturePrepare,
+ SceneGraphTextureDeletion,
+ SceneGraphPolishAndSync,
+ SceneGraphWindowsRenderShow,
+ SceneGraphWindowsAnimations,
+ SceneGraphWindowsPolishFrame,
+
+ MaximumSceneGraphFrameType
+ };
+
static void initialize();
static bool startProfiling();
static bool stopProfiling();
static void sendStartedProfilingMessage();
+ static bool profilingEnabled();
+
static void addEvent(EventType);
static void animationFrame(qint64);
+ static void sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2 = -1, qint64 value3 = -1, qint64 value4 = -1, qint64 value5 = -1);
static void sendProfilingData();
QQmlProfilerService();
@@ -163,15 +200,22 @@ private:
void rangeLocation(RangeType, const QUrl &, int, int);
void endRange(RangeType);
+ // overloading depending on parameters
+ void pixmapEventImpl(PixmapEventType eventType, const QUrl &url);
+ void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height);
+ void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count);
+
+ void sceneGraphFrameImpl(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5);
+
- bool profilingEnabled();
void setProfilingEnabled(bool enable);
void sendMessages();
void processMessage(const QQmlProfilerData &);
+public:
+ static bool enabled;
private:
QElapsedTimer m_timer;
- bool m_enabled;
QVector<QQmlProfilerData> m_data;
QMutex m_dataMutex;
QMutex m_initializeMutex;
@@ -183,6 +227,7 @@ private:
friend struct QQmlHandlingSignalProfiler;
friend struct QQmlObjectCreatingProfiler;
friend struct QQmlCompilingProfiler;
+ friend struct QQmlPixmapProfiler;
};
//
@@ -288,6 +333,49 @@ struct QQmlCompilingProfiler {
bool enabled;
};
+struct QQmlPixmapProfiler {
+ QQmlPixmapProfiler() {
+ QQmlProfilerService *instance = QQmlProfilerService::instance;
+ enabled = instance ?
+ instance->profilingEnabled() : false;
+ }
+
+ ~QQmlPixmapProfiler() {}
+
+ void startLoading(const QUrl &pixmapUrl) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingStarted, pixmapUrl);
+ }
+ }
+ void finishLoading(const QUrl &pixmapUrl) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingFinished, pixmapUrl);
+ }
+ }
+ void errorLoading(const QUrl &pixmapUrl) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingError, pixmapUrl);
+ }
+ }
+ void cacheCountChanged(const QUrl &pixmapUrl, int cacheCount) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapCacheCountChanged, pixmapUrl, cacheCount);
+ }
+ }
+ void referenceCountChanged(const QUrl &pixmapUrl, int referenceCount) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount);
+ }
+ }
+ void setSize(const QUrl &pixmapUrl, int width, int height) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, width, height);
+ }
+ }
+
+ bool enabled;
+};
+
QT_END_NAMESPACE
#endif // QQMLPROFILERSERVICE_P_H
diff --git a/src/qml/debugger/qv8debugservice.cpp b/src/qml/debugger/qv8debugservice.cpp
index f0f7f7a28d..eeab21d6ab 100644
--- a/src/qml/debugger/qv8debugservice.cpp
+++ b/src/qml/debugger/qv8debugservice.cpp
@@ -186,9 +186,14 @@ void QV8DebugService::signalEmitted(const QString &signal)
// executed in the gui thread
void QV8DebugService::init()
{
-// ### FIXME: v4
-// v8::Debug::SetMessageHandler2(DebugMessageHandler);
-// v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
+#if 0 // ### FIXME: v4
+ Q_D(QV8DebugService);
+ if (!d->debugIsolate)
+ d->debugIsolate = v8::Isolate::GetCurrent();
+ v8::Debug::SetMessageHandler2(DebugMessageHandler);
+ v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
+ QV4Compiler::enableV4(false);
+#endif
}
// executed in the gui thread
@@ -268,7 +273,10 @@ void QV8DebugService::messageReceived(const QByteArray &message)
void QV8DebugService::sendDebugMessage(const QString &message)
{
-// ### FIXME: v4 v8::Debug::SendCommand(message.utf16(), message.size());
+#if 0 // ### FIXME: v4
+ Q_D(QV8DebugService);
+ v8::Debug::SendCommand(message.utf16(), message.size(), 0, d->debugIsolate);
+#endif
}
void QV8DebugService::processDebugMessages()
diff --git a/src/qml/debugger/qv8debugservice_p.h b/src/qml/debugger/qv8debugservice_p.h
index 00ecf557c3..e6f05a2397 100644
--- a/src/qml/debugger/qv8debugservice_p.h
+++ b/src/qml/debugger/qv8debugservice_p.h
@@ -54,6 +54,11 @@
//
#include "qqmldebugservice_p.h"
+#ifdef Q_OS_WINCE
+# ifdef DebugBreak
+# undef DebugBreak
+# endif
+#endif
#include <private/qv8debug_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf
index 4ce44ba46e..2198428a38 100644
--- a/src/qml/doc/qtqml.qdocconf
+++ b/src/qml/doc/qtqml.qdocconf
@@ -18,7 +18,7 @@ qhp.QtQml.indexRoot =
qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc
qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION
qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION
-qhp.QtQml.subprojects = classes examples
+qhp.QtQml.subprojects = qmltypes classes examples
qhp.QtQml.subprojects.classes.title = C++ Classes
qhp.QtQml.subprojects.classes.indexTitle = Qt QML C++ Classes
qhp.QtQml.subprojects.classes.selectors = class fake:headerfile
@@ -26,15 +26,21 @@ qhp.QtQml.subprojects.classes.sortPages = true
qhp.QtQml.subprojects.examples.title = Examples
qhp.QtQml.subprojects.examples.indexTitle = Qt Quick Code Samples
qhp.QtQml.subprojects.examples.selectors = fake:example
+qhp.QtQml.subprojects.qmltypes.title = QML Types
+qhp.QtQml.subprojects.qmltypes.indexTitle = Qt QML QML Types
+qhp.QtQml.subprojects.qmltypes.selectors = fake:qmlclass
+qhp.QtQml.subprojects.qmltypes.sortPages = true
tagfile = ../../../doc/qtqml/qtqml.tags
-depends += qtcore qtxmlpatterns qtgui qtquick
+depends += qtcore qtxmlpatterns qtgui qtquick qtdoc
-headerdirs += ..
+headerdirs += .. \
+ ../../imports/models
-sourcedirs += ..
+sourcedirs += .. \
+ ../../imports/models
exampledirs += ../../../examples/qml \
../ \
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
new file mode 100644
index 0000000000..4254b50e63
--- /dev/null
+++ b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 100
+
+ VisualDataModel {
+ id: visualModel
+ model: ListModel {
+ ListElement { name: "Apple" }
+ ListElement { name: "Orange" }
+ }
+
+ groups: [
+ VisualDataGroup { name: "selected" }
+ ]
+
+ delegate: Rectangle {
+ id: item
+ height: 25
+ width: 200
+ Text {
+ text: {
+ var text = "Name: " + name
+ if (item.VisualDataModel.inSelected)
+ text += " (" + item.VisualDataModel.selectedIndex + ")"
+ return text;
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: item.VisualDataModel.inSelected = !item.VisualDataModel.inSelected
+ }
+ }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: visualModel
+ }
+}
+//![0]
diff --git a/src/qml/doc/snippets/qml/folderlistmodel.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
index b43949c487..0513c5b5f2 100644
--- a/src/qml/doc/snippets/qml/folderlistmodel.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
@@ -37,25 +37,28 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
//![0]
import QtQuick 2.0
-import Qt.labs.folderlistmodel 1.0
-ListView {
- width: 200; height: 400
+Rectangle {
+ width: 200; height: 100
- FolderListModel {
- id: folderModel
- nameFilters: ["*.qml"]
+ VisualDataModel {
+ id: visualModel
+ model: ListModel {
+ ListElement { name: "Apple" }
+ ListElement { name: "Orange" }
+ }
+ delegate: Rectangle {
+ height: 25
+ width: 100
+ Text { text: "Name: " + name}
+ }
}
- Component {
- id: fileDelegate
- Text { text: fileName }
+ ListView {
+ anchors.fill: parent
+ model: visualModel
}
-
- model: folderModel
- delegate: fileDelegate
}
//![0]
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp
index 844c850366..da1086146c 100644
--- a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -37,18 +37,23 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-#include <QApplication>
#include <QQuickView>
#include <QQmlContext>
+#include <QApplication>
+#include <QDirModel>
+
//![0]
-int main(int argc, char *argv[])
+int main(int argc, char ** argv)
{
QApplication app(argc, argv);
QQuickView view;
- view.setSource(QUrl("qrc:/main.qml"));
+
+ QDirModel model;
+ view.rootContext()->setContextProperty("dirModel", &model);
+
+ view.setSource(QUrl::fromLocalFile("view.qml"));
view.show();
return app.exec();
diff --git a/src/qml/doc/snippets/qml/xmlrole.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
index 0f75135da2..1e8cfade96 100644
--- a/src/qml/doc/snippets/qml/xmlrole.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
@@ -37,45 +37,29 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.XmlListModel 2.0
-
-Rectangle {
- width: 300; height: 200
-
//![0]
-XmlListModel {
- id: model
-//![0]
- source: "xmlrole.xml"
-
-//![1]
- // XmlRole queries will be made on <book> elements
- query: "/catalogue/book"
-
- // query the book title
- XmlRole { name: "title"; query: "title/string()" }
+import QtQuick 2.0
- // query the book's year
- XmlRole { name: "year"; query: "year/number()" }
+ListView {
+ id: view
+ width: 300
+ height: 400
- // query the book's type (the '@' indicates 'type' is an attribute, not an element)
- XmlRole { name: "type"; query: "@type/string()" }
+ model: VisualDataModel {
+ model: dirModel
- // query the book's first listed author (note in XPath the first index is 1, not 0)
- XmlRole { name: "first_author"; query: "author[1]/string()" }
-}
-//![1]
+ delegate: Rectangle {
+ width: 200; height: 25
+ Text { text: filePath }
-ListView {
- width: 300; height: 200
- model: model
- delegate: Column {
- Text { text: title + " (" + type + ")"; font.bold: true }
- Text { text: first_author }
- Text { text: year }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (model.hasModelChildren)
+ view.model.rootIndex = view.model.modelIndex(index)
+ }
+ }
+ }
}
}
-
-}
+//![0]
diff --git a/src/qml/doc/snippets/qml/colors.qml b/src/qml/doc/snippets/qml/colors.qml
deleted file mode 100644
index 2885f13c81..0000000000
--- a/src/qml/doc/snippets/qml/colors.qml
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- width: 160; height: 250
-
- Image {
- width: 160; height: 200
- source: "pics/checker.svg"
- fillMode: Image.Tile
-
- //! [colors]
- Rectangle {
- color: "steelblue"
- width: 40; height: 40
- }
- Rectangle {
- color: "transparent"
- y: 40; width: 40; height: 40
- }
- Rectangle {
- color: "#FF0000"
- y: 80; width: 40; height: 40
- }
- Rectangle {
- color: "#800000FF"
- y: 120; width: 40; height: 40
- }
- Rectangle {
- color: "#00000000" // ARGB fully transparent
- y: 160
- width: 40; height: 40
- }
- //! [colors]
-
- Rectangle {
- x: 40
- width: 120; height: 200
-
- Text {
- font.pixelSize: 16
- text: "steelblue"
- x: 10; height: 40
- verticalAlignment: Text.AlignVCenter
- }
- Text {
- font.pixelSize: 16
- text: "transparent"
- x: 10; y: 40; height: 40
- verticalAlignment: Text.AlignVCenter
- }
- Text {
- font.pixelSize: 16
- text: "FF0000"
- x: 10; y: 80; height: 40
- verticalAlignment: Text.AlignVCenter
- }
- Text {
- font.pixelSize: 16
- text: "800000FF"
- x: 10; y: 120; height: 40
- verticalAlignment: Text.AlignVCenter
- }
- Text {
- font.pixelSize: 16
- text: "00000000"
- x: 10; y: 160; height: 40
- verticalAlignment: Text.AlignVCenter
- }
- }
- }
-
- Image {
- y: 210
- width: 40; height: 40
- source: "pics/checker.svg"
- fillMode: Image.Tile
- }
-
- Text {
- font.pixelSize: 16
- text: "(background)"
- x: 50; y: 210; height: 40
- verticalAlignment: Text.AlignVCenter
- }
-}
diff --git a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
index c95d9e66eb..65e2bfd4ce 100644
--- a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
+++ b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
@@ -39,9 +39,16 @@
****************************************************************************/
//! [imports]
-import QtQuick 2.0 as Nokia
-import Ovi 1.0 as Nokia
-//! [imports]
+import QtQuick 2.0 as Project
+import QtMultimedia 5.0 as Project
+
+Project.Rectangle {
+ width: 100; height: 50
-Item {
+ Project.Audio {
+ source: "music.wav"
+ autoPlay: true
+ }
}
+//! [imports]
+
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc
index 410b3f68d1..c3b85ce15a 100644
--- a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc
@@ -39,8 +39,13 @@
****************************************************************************/
//![0]
-// main.qml
-import QtQuick 2.0
+<!DOCTYPE RCC>
+<RCC version="1.0">
-Image { source: "images/background.png" }
+<qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/background.png</file>
+</qresource>
+
+</RCC>
//![0]
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc b/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc
deleted file mode 100644
index 5e4941512b..0000000000
--- a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
-
-<qresource prefix="/">
- <file>main.qml</file>
- <file>images/background.png</file>
-</qresource>
-
-</RCC>
-
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro b/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro
deleted file mode 100644
index 5aee288a6e..0000000000
--- a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-QT += qml
-
-SOURCES += main.cpp
-RESOURCES += example.qrc
diff --git a/src/qml/doc/src/cppclasses/topic.qdoc b/src/qml/doc/src/cppclasses/topic.qdoc
index 8b97048c03..7c21793cfd 100644
--- a/src/qml/doc/src/cppclasses/topic.qdoc
+++ b/src/qml/doc/src/cppclasses/topic.qdoc
@@ -29,7 +29,7 @@
\title Important C++ Classes Provided By The Qt QML Module
\brief Overview of the C++ classes provided by the Qt QML module
-The Qt QML module provides C++ classes which implement the QML framework.
+The \l{Qt QML} module provides C++ classes which implement the QML framework.
Clients can use these classes to interact with the QML run-time (for example,
by injecting data or invoking methods on objects), and to instantiate a
hierarchy of objects from a QML document. The Qt QML module provides more
@@ -88,7 +88,7 @@ properties of a QQmlContext, and how to access the context for an object.
Dynamic object instantiation and dynamic expression evaluation are both core
concepts in QML. QML documents define object types which can be instantiated
at run-time using a QQmlComponent. An instance of the QQmlComponent class can
-be created in C++ directly, or via the \l{QML:Qt::createComponent()}
+be created in C++ directly, or via the \l{QtQml2::Qt::createComponent()}
{Qt.createComponent()} function in imperative QML code. Arbitrary expressions
can be calculated in C++ via the QQmlExpression class, and such expressions
can interact directly the QML context.
@@ -113,4 +113,20 @@ engine.
See the \l{QQmlExpression} class documentation for in depth information about
how to use QQmlExpression in an application.
+\section1 Usage of the Classes within QML Applications
+
+These pages describe how to create QML applications which interact with the
+C++ classes:
+
+\list
+\li \l{qtqml-cppintegration-topic.html}{Integrating QML and C++}
+ \list
+ \li \l{qtqml-cppintegration-exposecppattributes.html}{Exposing Attributes of C++ Classes to QML}
+ \li \l{qtqml-cppintegration-definetypes.html}{Defining QML Types from C++}
+ \li \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context Properties}
+ \li \l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++}
+ \li \l{qtqml-cppintegration-data.html}{Data Type Conversion Between QML and C++}
+ \endlist
+\endlist
+
*/
diff --git a/src/qml/doc/src/cppintegration/contextproperties.qdoc b/src/qml/doc/src/cppintegration/contextproperties.qdoc
index aaac43e470..1c2bced738 100644
--- a/src/qml/doc/src/cppintegration/contextproperties.qdoc
+++ b/src/qml/doc/src/cppintegration/contextproperties.qdoc
@@ -74,7 +74,7 @@ QML code invokes a method on the object instance:
\endtable
(Note that date/time values returned from C++ to QML can be formatted through
-\l{QML:Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.)
+\l{QtQml2::Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.)
If the QML item needs to receive signals from the context property, it can connect to them using the
\l Connections type. For example, if \c ApplicationData has a signal named \c
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc
index ba8ad47bab..74a93436f5 100644
--- a/src/qml/doc/src/cppintegration/data.qdoc
+++ b/src/qml/doc/src/cppintegration/data.qdoc
@@ -119,12 +119,12 @@ when passed from C++ to QML and vice-versa:
\li \l enumeration
\endtable
-(Note that classes provided by the QtGui module, such as QColor, QFont,
-QQuaternion and QMatrix4x4, are only available from QML when the \l QtQuick
-module is imported.)
+\note Classes provided by the \l {Qt GUI} module, such as QColor, QFont,
+QQuaternion and QMatrix4x4, are only available from QML when the \l {Qt Quick}
+module is included.
As a convenience, many of these types can be specified in QML by string values,
-or by a related method provided by the \l {QML:Qt} object. For example, the \l
+or by a related method provided by the \l {QtQml2::Qt} object. For example, the \l
{Image::sourceSize} property is of type \l size (which automatically translates
to the QSize type) and can be specified by a string value formatted as
"width\c{x}height", or by the Qt.size() function:
diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc
index be5f26a865..995fb1bce8 100644
--- a/src/qml/doc/src/cppintegration/definetypes.qdoc
+++ b/src/qml/doc/src/cppintegration/definetypes.qdoc
@@ -40,7 +40,7 @@ as an instantiable \l{qtqml-typesystem-objecttypes.html}{QML object type} from
QML, or enabling a singleton instance of the class to be imported and used
from QML.
-Additionally, the QtQml module provides mechanisms for implementing QML-specific
+Additionally, the \l {Qt QML} module provides mechanisms for implementing QML-specific
features such as \e{attached properties} and \e{default properties} in C++.
(Note that a number of the important concepts covered in this document are
@@ -133,7 +133,7 @@ not be instantiable
should not be instantiable from QML
\endlist
-The QtQml module provides several methods for registering non-instantiable
+The \l {Qt QML} module provides several methods for registering non-instantiable
types:
\list
@@ -291,7 +291,7 @@ qmlRegisterRevision<BaseType,1>("MyTypes", 1, 1);
\endcode
This is useful when deriving from base classes provided by other authors,
-e.g. when extending classes from the QtQuick library.
+e.g. when extending classes from the Qt Quick module.
\section1 Defining QML-Specific Types and Attributes
@@ -675,19 +675,19 @@ to be declared for an item without explicitly assigning them to the
\l{Item::}{children} property.)
-\section2 Defining Visual Items with the QtQuick Module
+\section2 Defining Visual Items with the Qt Quick Module
-When building user interfaces with the QtQuick module, all QML objects that are
+When building user interfaces with the \l {Qt Quick} module, all QML objects that are
to be visually rendered must derive from the \l Item type, as it is the base
-type for all visual objects in the QtQuick module. This \l Item type is
-implemented by the QQuickItem C++ class, which is provided as part of the
-QtQuick C++ module. Therefore, this class should be subclassed when it is
+type for all visual objects in \l {Qt Quick}. This \l Item type is
+implemented by the QQuickItem C++ class, which is provided by the
+\l {Qt Quick} module. Therefore, this class should be subclassed when it is
necessary to implement a visual type in C++ that can be integrated into a
QML-based user interface.
See the QQuickItem documentation for more information. Additionally, the
\l{Writing QML Extensions with C++} tutorial demonstrates how a QQuickItem-based
-visual item can be implemented in C++ and integrated into a QtQuick-based user
+visual item can be implemented in C++ and integrated into a Qt Quick-based user
interface.
@@ -699,7 +699,7 @@ its properties have been set. For example, this may be the case if the
initialization is costly, or if the initialization should not be performed until
all property values have been initialized.
-The QtQml module provides the QQmlParserStatus to be subclass for these
+The \l {Qt QML} module provides the QQmlParserStatus to be subclass for these
purposes. It defines a number of virtual methods that are invoked invoked at
various stages during component instantiation. To receive these notifications, a
C++ class should inherit QQmlParserStatus and also notify the Qt meta system
diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
index 3253752e47..d0fb03a03c 100644
--- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
+++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
@@ -30,7 +30,7 @@
\title Writing QML Extensions with C++
\brief tutorial about extending QML with Qt C++
-The QtQml C++ module provides a set of APIs for extending QML through
+The \l {Qt QML} module provides a set of APIs for extending QML through
C++ extensions. You can write extensions to add your own QML types, extend existing
Qt types, or call C/C++ functions that are not accessible from ordinary QML code.
@@ -39,17 +39,17 @@ core QML features, including properties, signals and bindings. It also shows how
extensions can be deployed through plugins.
You can find the source code for this tutorial in \c Qt's
-examples/quick/tutorials/extending directory.
+examples/qml/tutorials/extending directory.
Tutorial chapters:
\list 1
-\li \l{quick/tutorials/extending/chapter1-basics}{Creating a New Type}
-\li \l{quick/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals}
-\li \l{quick/tutorials/extending/chapter3-bindings}{Property Binding}
-\li \l{quick/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types}
-\li \l{quick/tutorials/extending/chapter5-listproperties}{Using List Property Types}
-\li \l{quick/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin}
+\li \l{tutorials/extending/chapter1-basics}{Creating a New Type}
+\li \l{tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals}
+\li \l{tutorials/extending/chapter3-bindings}{Property Binding}
+\li \l{tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types}
+\li \l{tutorials/extending/chapter5-listproperties}{Using List Property Types}
+\li \l{tutorials/extending/chapter6-plugins}{Writing an Extension Plugin}
\li \l{qml-extending-tutorial7.html}{In Summary}
\endlist
@@ -104,7 +104,7 @@ this new class must:
Here is our \c PieChart class, defined in \c piechart.h:
-\snippet quick/tutorials/extending/chapter1-basics/piechart.h 0
+\snippet tutorials/extending/chapter1-basics/piechart.h 0
The class inherits from QQuickPaintedItem because we want to override
QQuickPaintedItem::paint() in perform drawing operations with the QPainter API.
@@ -120,15 +120,15 @@ simply sets and returns the \c m_name and \c m_color values as appropriate, and
implements \c paint() to draw a simple pie chart. It also turns off the
QGraphicsItem::ItemHasNoContents flag to enable painting:
-\snippet quick/tutorials/extending/chapter1-basics/piechart.cpp 0
+\snippet tutorials/extending/chapter1-basics/piechart.cpp 0
\dots 0
-\snippet quick/tutorials/extending/chapter1-basics/piechart.cpp 1
+\snippet tutorials/extending/chapter1-basics/piechart.cpp 1
Now that we have defined the \c PieChart type, we will use it from QML. The \c app.qml
file creates a \c PieChart item and display the pie chart's details
using a standard QML \l Text item:
-\snippet quick/tutorials/extending/chapter1-basics/app.qml 0
+\snippet tutorials/extending/chapter1-basics/app.qml 0
Notice that although the color is specified as a string in QML, it is automatically
converted to a QColor object for the PieChart \c color property. Automatic conversions are
@@ -142,20 +142,20 @@ you don't register the type, \c app.qml won't be able to create a \c PieChart.
Here is the application \c main.cpp:
-\snippet quick/tutorials/extending/chapter1-basics/main.cpp 0
+\snippet tutorials/extending/chapter1-basics/main.cpp 0
This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart",
in a type namespace called "Charts", with a version of 1.0.
Lastly, we write a \c .pro project file that includes the files and the \c declarative library:
-\quotefile quick/tutorials/extending/chapter1-basics/chapter1-basics.pro
+\quotefile tutorials/extending/chapter1-basics/chapter1-basics.pro
Now we can build and run the application:
\image extending-tutorial-chapter1.png
-Try it yourself with the code in Qt's \c examples/quick/tutorials/extending/chapter1-basics directory.
+Try it yourself with the code in Qt's \c examples/qml/tutorials/extending/chapter1-basics directory.
*/
@@ -168,20 +168,20 @@ Suppose we want \c PieChart to have a "clearChart()" method that erases the
chart and then emits a "chartCleared" signal. Our \c app.qml would be able
to call \c clearChart() and receive \c chartCleared() signals like this:
-\snippet quick/tutorials/extending/chapter2-methods/app.qml 0
+\snippet tutorials/extending/chapter2-methods/app.qml 0
\image extending-tutorial-chapter2.png
To do this, we add a \c clearChart() method and a \c chartCleared() signal
to our C++ class:
-\snippet quick/tutorials/extending/chapter2-methods/piechart.h 0
+\snippet tutorials/extending/chapter2-methods/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter2-methods/piechart.h 1
+\snippet tutorials/extending/chapter2-methods/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter2-methods/piechart.h 2
+\snippet tutorials/extending/chapter2-methods/piechart.h 2
\dots
-\snippet quick/tutorials/extending/chapter2-methods/piechart.h 3
+\snippet tutorials/extending/chapter2-methods/piechart.h 3
The use of Q_INVOKABLE makes the \c clearChart() method available to the
Qt Meta-Object system, and in turn, to QML. Note that it could have
@@ -191,7 +191,7 @@ slots are also callable from QML. Both of these approaches are valid.
The \c clearChart() method simply changes the color to Qt::transparent,
repaints the chart, then emits the \c chartCleared() signal:
-\snippet quick/tutorials/extending/chapter2-methods/piechart.cpp 0
+\snippet tutorials/extending/chapter2-methods/piechart.cpp 0
Now when we run the application and click the window, the pie chart
disappears, and the application outputs:
@@ -200,7 +200,7 @@ disappears, and the application outputs:
The chart has been cleared
\endcode
-Try out the example yourself with the updated code in Qt's \c examples/quick/tutorials/extending/chapter2-methods directory.
+Try out the example yourself with the updated code in Qt's \c examples/qml/tutorials/extending/chapter2-methods directory.
*/
@@ -216,7 +216,7 @@ other types' values when property values are changed.
Let's enable property bindings for the \c color property. That means
if we have code like this:
-\snippet quick/tutorials/extending/chapter3-bindings/app.qml 0
+\snippet tutorials/extending/chapter3-bindings/app.qml 0
\image extending-tutorial-chapter3.png
@@ -231,17 +231,17 @@ It's easy to enable property binding for the \c color property.
We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal
is emitted whenever the value changes.
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 0
+\snippet tutorials/extending/chapter3-bindings/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 1
+\snippet tutorials/extending/chapter3-bindings/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 2
+\snippet tutorials/extending/chapter3-bindings/piechart.h 2
\dots
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 3
+\snippet tutorials/extending/chapter3-bindings/piechart.h 3
Then, we emit this signal in \c setPieSlice():
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.cpp 0
+\snippet tutorials/extending/chapter3-bindings/piechart.cpp 0
It's important for \c setColor() to check that the color value has actually changed
before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and
@@ -299,43 +299,43 @@ For example, let's replace the use of the \c property with a type called
"PieSlice" that has a \c color property. Instead of assigning a color,
we assign an \c PieSlice value which itself contains a \c color:
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/app.qml 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/app.qml 0
Like \c PieChart, this new \c PieSlice type inherits from QQuickPaintedItem and declares
its properties with Q_PROPERTY():
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0
To use it in \c PieChart, we modify the \c color property declaration
and associated method signatures:
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 2
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 3
There is one thing to be aware of when implementing \c setPieSlice(). The \c PieSlice
is a visual item, so it must be set as a child of the \c PieChart using
QQuickItem::setParentItem() so that the \c PieChart knows to paint this child
item when its contents are drawn:
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0
Like the \c PieChart type, the \c PieSlice type has to be registered
using qmlRegisterType() to be used from QML. As with \c PieChart, we'll add the
type to the "Charts" type namespace, version 1.0:
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 0
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1
+\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 1
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2
+\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 2
-Try it out with the code in Qt's \c examples/quick/tutorials/extending/chapter4-customPropertyTypes directory.
+Try it out with the code in Qt's \c examples/qml/tutorials/extending/chapter4-customPropertyTypes directory.
*/
@@ -349,7 +349,7 @@ Right now, a \c PieChart can only have one \c PieSlice. Ideally a chart would
have multiple slices, with different colors and sizes. To do this, we could
have a \c slices property that accepts a list of \c PieSlice items:
-\snippet quick/tutorials/extending/chapter5-listproperties/app.qml 0
+\snippet tutorials/extending/chapter5-listproperties/app.qml 0
\image extending-tutorial-chapter5.png
@@ -360,11 +360,11 @@ function with a \c slices() function that returns a list of slices, and add
an internal \c append_slice() function (discussed below). We also use a QList to
store the internal list of slices as \c m_slices:
-\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 0
+\snippet tutorials/extending/chapter5-listproperties/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 1
+\snippet tutorials/extending/chapter5-listproperties/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 2
+\snippet tutorials/extending/chapter5-listproperties/piechart.h 2
Although the \c slices property does not have an associated \c WRITE function,
it is still modifiable because of the way QQmlListProperty works.
@@ -373,7 +373,7 @@ return a QQmlListProperty value and indicate that the internal
\c PieChart::append_slice() function is to be called whenever a request is made from QML
to add items to the list:
-\snippet quick/tutorials/extending/chapter5-listproperties/piechart.cpp 0
+\snippet tutorials/extending/chapter5-listproperties/piechart.cpp 0
The \c append_slice() function simply sets the parent item as before,
and adds the new item to the \c m_slices list. As you can see, the append function for a
@@ -384,7 +384,7 @@ The \c PieSlice class has also been modified to include \c fromAngle and \c angl
properties and to draw the slice according to these values. This is a straightforward
modification if you have read the previous pages in this tutorial, so the code is not shown here.
-The complete code can be seen in the updated \c examples/quick/tutorials/extending/chapter5-listproperties directory.
+The complete code can be seen in the updated \c examples/qml/tutorials/extending/chapter5-listproperties directory.
*/
@@ -407,22 +407,22 @@ and registers our QML types in the inherited \l{QQmlExtensionPlugin::}{registerT
Here is the \c ChartsPlugin definition in \c chartsplugin.h:
-\snippet quick/tutorials/extending/chapter6-plugins/chartsplugin.h 0
+\snippet tutorials/extending/chapter6-plugins/chartsplugin.h 0
And its implementation in \c chartsplugin.cpp:
-\snippet quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0
+\snippet tutorials/extending/chapter6-plugins/chartsplugin.cpp 0
Then, we write a \c .pro project file that defines the project as a plugin library
and specifies with DESTDIR that library files should be built into a "lib" subdirectory:
-\quotefile quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
+\quotefile tutorials/extending/chapter6-plugins/chapter6-plugins.pro
Finally, we add a \l{qtqml-modules-qmldir.html}{qmldir} file that is
parsed by the QML engine. In this file, we specify that a plugin named
"chapter6-plugin" (the name of the example project) can be found in the "lib" subdirectory:
-\quotefile quick/tutorials/extending/chapter6-plugins/Charts/qmldir
+\quotefile tutorials/extending/chapter6-plugins/Charts/qmldir
Now we have a plugin, and instead of having a main.cpp and an executable, we can build
the project and then load the QML file using the \l{Prototyping with qmlscene}{qmlscene tool},
diff --git a/src/qml/doc/src/cppintegration/topic.qdoc b/src/qml/doc/src/cppintegration/topic.qdoc
index 48f430c919..4d12ab9d08 100644
--- a/src/qml/doc/src/cppintegration/topic.qdoc
+++ b/src/qml/doc/src/cppintegration/topic.qdoc
@@ -29,7 +29,7 @@
\title Integrating QML and C++
\brief Description of how to integrate QML and C++ code
-QML is designed to be easily extensible through C++ code. The classes in the QtQml C++ module
+QML is designed to be easily extensible through C++ code. The classes in the \l {Qt QML} module
enables QML objects to be loaded and manipulated from C++, and the nature of QML engine's
integration with Qt's \l{Meta Object System}{meta object system} enables C++ functionality to be
invoked directly from QML. This allows the development of hybrid applications which are implemented
@@ -43,7 +43,7 @@ with QML and JavaScript within \l{qtqml-documents-topic.html}{QML documents}, an
C++
\li Use and invoke some C++ functionality from QML (for example, to invoke your application logic,
use a data model implemented in C++, or call some functions in a third-party C++ library)
-\li Access functionality in the QtQml or QtQuick C++ API (for example, to dynamically generate
+\li Access functionality in the \l {Qt QML} or \l {Qt Quick} C++ API (for example, to dynamically generate
images using QQuickImageProvider)
\li Implement your own \l{qtqml-typesystem-objecttypes.html}{QML object types} from C++
\unicode{0x2014} whether for use within your own specific application, or for distribution to others
@@ -71,7 +71,7 @@ methods and signals to be accessed from QML
These are the most common methods of accessing C++ functionality from QML code; for more options and
details, see the main documentation pages that are described in the sections further below.
-Additionally, aside from the ability to access C++ functionality from QML, the Qt QML module also
+Additionally, aside from the ability to access C++ functionality from QML, the \l {Qt QML} module also
provides ways to do the reverse and manipulate QML objects from C++ code. See
\l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++} for more
details.
@@ -104,7 +104,7 @@ registered for other purposes: for example, it could be registered as a \e {Sing
single class instance to be imported by QML code, or it could be registered to enable the
enumeration values of a non-instantiable class to be accessible from QML.
-Additionally, the QtQml module provides mechanisms to define QML types that integrate with QML
+Additionally, the \l {Qt QML} module provides mechanisms to define QML types that integrate with QML
concepts like attached properties and default properties.
For more information on registering and creating custom QML types from C++, see the \l
@@ -115,7 +115,7 @@ For more information on registering and creating custom QML types from C++, see
C++ objects and values can be embedded directly into the context (or \e scope) of loaded QML objects
using \e {context properties} and \e {context objects}. This is achieved through the QQmlContext
-class provided by the QtQml module, which exposes data to the context of a QML component, allowing
+class provided by the \l {Qt QML} module, which exposes data to the context of a QML component, allowing
data to be injected from C++ into QML.
See \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context
diff --git a/src/qml/doc/src/javascript/date.qdoc b/src/qml/doc/src/javascript/date.qdoc
index 9f696930d2..7da24d4092 100644
--- a/src/qml/doc/src/javascript/date.qdoc
+++ b/src/qml/doc/src/javascript/date.qdoc
@@ -27,7 +27,7 @@
/*!
\qmltype Date
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief Provides date functions
The QML Date object extends the JS Date object with
@@ -223,4 +223,3 @@
}
\endcode
*/
-
diff --git a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
index 09faa61672..e54404d2fd 100644
--- a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
+++ b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
@@ -35,15 +35,15 @@ useful to delay instantiation of objects until necessary, thereby improving
application startup time. It also allows visual objects to be dynamically
created and added to the scene in reaction to user input or other events.
-See the \l {declarative/toys/dynamicscene}{Dynamic Scene example} for a
+See the \l {QML Example - Dynamic Scene}{Dynamic Scene example} for a
demonstration of the concepts discussed on this page.
\section1 Creating Objects Dynamically
There are two ways to create objects dynamically from JavaScript. You can
-either call \l {QML:Qt::createComponent()}{Qt.createComponent()} to
-dynamically create a \l Component object, or use \l{QML:Qt::createQmlObject()}
+either call \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} to
+dynamically create a \l Component object, or use \l{QtQml2::Qt::createQmlObject()}
{Qt.createQmlObject()} to create an object from a string of QML. Creating a
component is better if you have an existing component defined in a QML document
and you want to dynamically create instances of that component. Otherwise,
@@ -54,7 +54,7 @@ generated at runtime.
\section2 Creating a Component Dynamically
To dynamically load a component defined in a QML file, call the
-\l {QML:Qt::createComponent()}{Qt.createComponent()} function in the
+\l {QtQml2::Qt::createComponent()}{Qt.createComponent()} function in the
\l {QmlGlobalQtObject}{Qt object}.
This function takes the URL of the QML file as its only argument and creates
a \l Component object from this URL.
@@ -66,7 +66,7 @@ can take one or two arguments:
\li The first is the parent for the new object. The parent can be a graphical
object (i.e. of the \l Item type) or non-graphical object (i.e. of the
\l QtObject or C++ QObject type). Only graphical objects with graphical
- parent objects will be rendered to the QtQuick visual canvas. If you wish
+ parent objects will be rendered to the \l {Qt Quick} visual canvas. If you wish
to set the parent later you can safely pass \c null to this function.
\li The second is optional and is a map of property-value pairs that define
initial any property values for the object. Property values specified by
@@ -109,11 +109,11 @@ the \c finishCreation() function and call \l {Component::createObject()}
Notice in both instances, \l {Component::createObject()}{createObject()} is
called with \c appWindow passed as the parent argument, since the dynamically
-created object is a visual (QtQuick) object. The created object will become a
+created object is a visual (Qt Quick) object. The created object will become a
child of the \c appWindow object in \c main.qml, and appear in the scene.
When using files with relative paths, the path should
-be relative to the file where \l {QML:Qt::createComponent()}
+be relative to the file where \l {QtQml2::Qt::createComponent()}
{Qt.createComponent()} is executed.
To connect signals to (or receive signals from) dynamically created objects,
@@ -127,7 +127,7 @@ It is also possible to instantiate components without blocking via the
\section2 Creating an Object from a String of QML
If the QML is not defined until runtime, you can create a QML object from
-a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+a string of QML using the \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}
function, as in the following example:
\snippet qml/createQmlObject.qml 0
@@ -153,9 +153,9 @@ first, the bindings in the dynamic object will no longer work.
The actual creation context depends on how an object is created:
\list
-\li If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the
+\li If \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} is used, the
creation context is the QQmlContext in which this method is called
-\li If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} is called, the
+\li If \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()} is called, the
creation context is the context of the parent object passed to this method
\li If a \c {Component{}} object is defined and \l {Component::createObject()}
{createObject()} or \l {Component::incubateObject()}{incubateObject()} is
@@ -221,7 +221,7 @@ Item {
This would result in an error, since objects can only be dynamically
destroyed if they were dynamically created.
-Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+Objects created with \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}
can similarly be destroyed using \c destroy():
\snippet qml/createQmlObject.qml 0
diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc
index a63ef617c0..3bd64ac115 100644
--- a/src/qml/doc/src/javascript/hostenvironment.qdoc
+++ b/src/qml/doc/src/javascript/hostenvironment.qdoc
@@ -166,6 +166,15 @@ Item {
}
\endqml
+\li The \c with statement is deprecated. Using the \c with statement will issue a warning
+at loading time and we plan on removing support for it in Qt 5.2. It is generally considered
+a language feature that is not recommended for use due reducing the readability of code and disabling
+many optimizations in the engine. It is also forbidden in ECMAScript 5 strict mode.
+
+\li JavaScript binding expressions are executed in non-strict mode. However we
+plan on changing the default for bindings in Qt 5.2 to execute always in
+ECMAScript 5 strict mode.
+
\endlist
diff --git a/src/qml/doc/src/javascript/imports.qdoc b/src/qml/doc/src/javascript/imports.qdoc
index 800091689c..809b74ed52 100644
--- a/src/qml/doc/src/javascript/imports.qdoc
+++ b/src/qml/doc/src/javascript/imports.qdoc
@@ -71,13 +71,13 @@ parameters and return values when calling such functions from QML.
\section1 Imports Within JavaScript Resources
-In QtQuick 2.0, support has been added to allow JavaScript resources to import
+In \c {QtQuick 2.0}, support has been added to allow JavaScript resources to import
other JavaScript resources and also QML type namespaces using a variation of
the standard QML import syntax (where all of the previously described rules and
qualifications apply).
Due to the ability of a JavaScript resource to import another script or QML
-module in this fashion in QtQuick 2.0, some extra semantics are defined:
+module in this fashion in \c {QtQuick 2.0}, some extra semantics are defined:
\list
\li a script with imports will not inherit imports from the QML document which imported it (so accessing Component.errorString will fail, for example)
\li a script without imports will inherit imports from the QML document which imported it (so accessing Component.errorString will succeed, for example)
@@ -125,14 +125,14 @@ When a JavaScript file is imported, it must be imported with a qualifier. The
functions in that file are then accessible from the importing script via the
qualifier (that is, as \tt{Qualifier.functionName(params)}). Sometimes it is
desirable to have the functions made available in the importing context without
-needing to qualify them, and in this circumstance the \l{QML:Qt::include()}
+needing to qualify them, and in this circumstance the \l{QtQml2::Qt::include()}
{Qt.include()} function may be used to include one JavaScript file from another.
This copies all functions from the other file into the current file's
namespace, but ignores all pragmas and imports defined in that file.
For example, the QML code below left calls \c showCalculations() in \c script.js,
which in turn can call \c factorial() in \c factorial.js, as it has included
-\c factorial.js using \l {QML:Qt::include()}{Qt.include()}.
+\c factorial.js using \l {QtQml2::Qt::include()}{Qt.include()}.
\table
\row
@@ -142,7 +142,7 @@ which in turn can call \c factorial() in \c factorial.js, as it has included
\li \snippet qml/integrating-javascript/includejs/factorial.js 0
\endtable
-Notice that calling \l {QML:Qt::include()}{Qt.include()} copies all functions
+Notice that calling \l {QtQml2::Qt::include()}{Qt.include()} copies all functions
from \c factorial.js into the \c MyScript namespace, which means the QML
component can also access \c factorial() directly as \c MyScript.factorial().
diff --git a/src/qml/doc/src/javascript/number.qdoc b/src/qml/doc/src/javascript/number.qdoc
index 1e7894f3d1..20fe40c86f 100644
--- a/src/qml/doc/src/javascript/number.qdoc
+++ b/src/qml/doc/src/javascript/number.qdoc
@@ -27,7 +27,7 @@
/*!
\qmltype Number
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief The Number object provides represents a number value
The QML Number object extends the JS Number object with
@@ -102,4 +102,3 @@
d = Number.fromLocaleString(german, "1.234") // d == 1234.0
\endcode
*/
-
diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc
index cc3004d93f..ab7d7a4ebe 100644
--- a/src/qml/doc/src/javascript/string.qdoc
+++ b/src/qml/doc/src/javascript/string.qdoc
@@ -27,7 +27,7 @@
/*!
\qmltype String
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief The String object represents a string value
The QML String object extends the JS String object with
@@ -48,4 +48,3 @@
console.log(message.arg(count))
\endcode
*/
-
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 4a4de0531c..386f9f49df 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -47,6 +47,20 @@
#include <QtQml> to use this macro.
*/
+/*!
+ \fn void qmlClearTypeRegistrations()
+ \relates QQmlEngine
+
+ Clears all stored type registrations, such as those produced with \l qmlRegisterType.
+
+ Do not call this function while a QQmlEngine exists or behavior will be undefined.
+ Any existing QQmlEngines must be deleted before calling this function. This function
+ only affects the application global cache. Delete the QQmlEngine to clear all cached
+ data relating to that engine.
+
+ #include <QtQml> to use this method.
+*/
+
/*!
\fn int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
@@ -222,7 +236,7 @@
Usage:
\code
- // first, define the singleton type provider function (callback).
+ // First, define the singleton type provider function (callback).
static QJSValue *example_qjsvalue_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
@@ -233,7 +247,8 @@
return example;
}
- // second, register the singleton type provider with QML by calling this function in an initialization function.
+ // Second, register the singleton type provider with QML by calling this function in an initialization function.
+ #include <QtQml>
...
qmlRegisterSingletonType("Qt.example.qjsvalueApi", 1, 0, "MyApi", example_qjsvalue_singletontype_provider);
...
@@ -299,7 +314,7 @@
Usage:
\code
- // first, define your QObject which provides the functionality.
+ // First, define your QObject which provides the functionality.
class SingletonTypeExample : public QObject
{
Q_OBJECT
@@ -325,7 +340,7 @@
int m_someProperty;
};
- // second, define the singleton type provider function (callback).
+ // Second, define the singleton type provider function (callback).
static QObject *example_qobject_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
@@ -335,7 +350,8 @@
return example;
}
- // third, register the singleton type provider with QML by calling this function in an initialization function.
+ // Third, register the singleton type provider with QML by calling this function in an initialization function.
+ #include <QtQml>
...
qmlRegisterSingletonType<SingletonTypeExample>("Qt.example.qobjectSingleton", 1, 0, "MyApi", example_qobject_singletontype_provider);
...
@@ -390,7 +406,7 @@
url must be an absolute URL, i.e. url.isRelative() == false.
Normally QML files can be loaded as types directly from other QML files, or using a qmldir file. This function allows
- registration of files to types from a C++ module, such as when the type mapping needs to be procedurally determined at startup.
+ registration of files to types from C++ code, such as when the type mapping needs to be procedurally determined at startup.
#include <QtQml> to use this function.
diff --git a/src/qml/doc/src/documents/definetypes.qdoc b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc
index b9df6a4381..4e1d4a2c86 100644
--- a/src/qml/doc/src/documents/definetypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc
@@ -29,7 +29,7 @@
\title Defining Object Types through QML Documents
\brief Description of how a QML document is a reusable type definition
-One of the core features of QML is that it enables QML object types to be easily defined in a lightweight manner through QML documents to suit the needs of individual QML applications. The standard QtQuick module provides various types like \l Rectangle, \l Text and \l Image for building a QML application; beyond these, you can easily define your own QML types to be reused within your application. This ability to create your own types forms the building blocks of any QML application.
+One of the core features of QML is that it enables QML object types to be easily defined in a lightweight manner through QML documents to suit the needs of individual QML applications. The standard \l {Qt Quick} module provides various types like \l Rectangle, \l Text and \l Image for building a QML application; beyond these, you can easily define your own QML types to be reused within your application. This ability to create your own types forms the building blocks of any QML application.
\section1 Defining an Object Type with a QML File
diff --git a/src/qml/doc/src/documents/networktransparency.qdoc b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
index ea46b3381e..ea46b3381e 100644
--- a/src/qml/doc/src/documents/networktransparency.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
diff --git a/src/qml/doc/src/documents/scope.qdoc b/src/qml/doc/src/qmllanguageref/documents/scope.qdoc
index 9da77a4905..9da77a4905 100644
--- a/src/qml/doc/src/documents/scope.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/scope.qdoc
diff --git a/src/qml/doc/src/documents/structure.qdoc b/src/qml/doc/src/qmllanguageref/documents/structure.qdoc
index c8176f7e0f..c8176f7e0f 100644
--- a/src/qml/doc/src/documents/structure.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/structure.qdoc
diff --git a/src/qml/doc/src/documents/topic.qdoc b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
index f8a402476c..aed89f6423 100644
--- a/src/qml/doc/src/documents/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
@@ -91,13 +91,13 @@ separation between UI definition and logic implementation.
In the following example, the client developer defines a \c Button type with
a document in a file:
-\snippet ../src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml 0
+\snippet ../quick/doc/snippets/qml/qml-extending-types/components/Button.qml 0
The \c Button type can then be used in an application:
\table
\row
-\li \snippet ../src/quick/doc/snippets/qml/qml-extending-types/components/application.qml 0
+\li \snippet ../quick/doc/snippets/qml/qml-extending-types/components/application.qml 0
\li \image button-types.png
\endtable
diff --git a/src/qml/doc/src/modules/cppplugins.qdoc b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc
index af2a36c903..7ac1d400eb 100644
--- a/src/qml/doc/src/modules/cppplugins.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc
@@ -68,7 +68,7 @@
as a new QML type. It provides the current time through \c hour and \c minute
properties.
- \snippet qml/plugins/plugin.cpp 0
+ \snippet plugins/plugin.cpp 0
\dots
To make this type available, we create a plugin class named \c QExampleQmlPlugin
@@ -78,7 +78,7 @@
definition to register the plugin with the Qt meta object system using a unique
identifier for the plugin.
- \snippet qml/plugins/plugin.cpp plugin
+ \snippet plugins/plugin.cpp plugin
The \c TimeModel class receives a \c{1.0} version of this plugin library, as
a QML type called \c Time. The Q_ASSERT() macro can ensure the type namespace is
@@ -111,13 +111,13 @@
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 qml/plugins/imports/TimeExample/qmldir
+ \quotefile 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 TimeExample
module
- \snippet qml/plugins/plugins.qml 0
+ \snippet plugins/plugins.qml 0
The full source code is available in the \l {qml/plugins}{plugins example}.
diff --git a/src/qml/doc/src/modules/identifiedmodules.qdoc b/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc
index 34d4b864a8..34d4b864a8 100644
--- a/src/qml/doc/src/modules/identifiedmodules.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc
diff --git a/src/qml/doc/src/modules/legacymodules.qdoc b/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc
index 26981334b7..26981334b7 100644
--- a/src/qml/doc/src/modules/legacymodules.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc
diff --git a/src/qml/doc/src/modules/qmldir.qdoc b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
index de3698c533..57d54e27e0 100644
--- a/src/qml/doc/src/modules/qmldir.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
@@ -223,6 +223,11 @@ cannot be used if an earlier version is imported. If the client had imported
version 1.0 of the module, they can use the \c MyButton type but \b not the
\c MyWindow type.
+A version cannot be imported if no types have been explicitly exported for that
+version. If a module provides a \c MyButton type in version 1.0 and a
+\c MyWindow type in version 1.1, you cannot import version 1.2 or version 2.0 of
+that module.
+
A type can be defined by different files in different versions. In this case,
the most closely matching version will be used when imported by clients.
For example, if a module had specified the following types via its \c qmldir
@@ -363,7 +368,7 @@ Module {
// The name of the type containing attached properties
// and methods.
- attachedType: "QDeclarativeAnimationAttached"
+ attachedType: "QQuickAnimationAttached"
// The list of exports determines how a type can be imported.
// Each string has the format "URI/Name version" and matches the
diff --git a/src/qml/doc/src/modules/topic.qdoc b/src/qml/doc/src/qmllanguageref/modules/topic.qdoc
index 597e7b7ca3..597e7b7ca3 100644
--- a/src/qml/doc/src/modules/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/topic.qdoc
diff --git a/src/qml/doc/src/qmllanguageref/qmlreference.qdoc b/src/qml/doc/src/qmllanguageref/qmlreference.qdoc
new file mode 100644
index 0000000000..0bc8f90238
--- /dev/null
+++ b/src/qml/doc/src/qmllanguageref/qmlreference.qdoc
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlreference.html
+\title The QML Reference
+\brief A declarative language for application development
+
+QML is a declarative language for creating highly dynamic applications. With
+QML, application building blocks such as UI components are \e declared and
+various properties set to define the application behavior. When coupled with
+JavaScript, application behavior becomes scriptable. In addition, QML heavily
+uses Qt, which allows types and other Qt features to be accessible directly from
+QML applications.
+
+This reference guide describes the features of the QML language. Many of the
+QML types in the guide originate from the \l{Qt QML} or \l{Qt Quick}
+modules.
+
+\list
+ \li \l{qtqml-syntax-basics.html}{QML Syntax Basics}
+ \list
+ \li \l{qtqml-syntax-imports.html}{Import Statements}
+ \li \l{qtqml-syntax-basics.html#object-declarations}{Object Declarations}
+ \list
+ \li \l{qtqml-syntax-basics.html#child-objects}{Child Objects}
+ \endlist
+ \li \l{qtqml-syntax-basics.html#comments}{Comments}
+ \endlist
+
+ \li \l{qtqml-syntax-objectattributes.html}{QML Object Attributes}
+ \list
+ \li \l{qtqml-syntax-objectattributes.html#the-id-attribute}{The \e id Attribute}
+ \li \l{qtqml-syntax-objectattributes.html#property-attributes}{Property Attributes}
+ \li \l{qtqml-syntax-objectattributes.html#signal-attributes}{Signal Attributes}
+ \li \l{qtqml-syntax-objectattributes.html#method-attributes}{Method Attributes}
+ \li \l{qtqml-syntax-objectattributes.html#attached-properties-and-attached-signal-handlers}{Attached Properties and Attached Signal Handlers}
+ \endlist
+
+ \li \l{qtqml-syntax-propertybinding.html}{Property Binding}
+
+ \li \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
+
+ \li \l{qtqml-javascript-topic.html}{Integrating QML and JavaScript}
+ \list
+ \li \l{qtqml-javascript-expressions.html}{Using JavaScript Expressions with QML}
+ \li \l{qtqml-javascript-dynamicobjectcreation.html}{Dynamic QML Object Creation from JavaScript}
+ \li \l{qtqml-javascript-resources.html}{Defining JavaScript Resources In QML}
+ \li \l{qtqml-javascript-imports.html}{Importing JavaScript Resources In QML}
+ \li \l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment}
+ \endlist
+
+ \li \l{qtqml-typesystem-topic.html}{The QML Type System}
+ \list
+ \li \l{qtqml-typesystem-basictypes.html}{Basic Types}
+ \li \l{qtqml-typesystem-topic.html#javascript-types}{JavaScript Types}
+ \li \l{qtqml-typesystem-objecttypes.html}{QML Object Types}
+ \list
+ \li \l{qtqml-documents-definetypes.html}{Defining Object Types from QML}
+ \li \l{qtqml-cppintegration-definetypes.html}{Defining Object Types from C++}
+ \endlist
+ \endlist
+
+ \li \l{qtqml-modules-topic.html}{QML Modules}
+ \list
+ \li \l{qtqml-modules-qmldir.html}{Specifying A QML Module}
+ \li \l{qtqml-modules-topic.html#supported-qml-module-types}{Supported QML Module Types}
+ \list
+ \li \l{qtqml-modules-identifiedmodules.html}{Identified Modules}
+ \li \l{qtqml-modules-legacymodules.html}{Legacy Modules}
+ \endlist
+ \li \l{qtqml-modules-cppplugins.html}{Providing Types and Functionality in a C++ Plugin}
+ \endlist
+
+ \li \l{qtqml-documents-topic.html}{QML Documents}
+ \list
+ \li \l{qtqml-documents-structure.html}{Structure of a QML Document}
+ \li \l{Syntax of the QML Language}
+ \li \l{qtqml-documents-definetypes.html}{Defining Object Types through QML Documents}
+ \list
+ \li \l{qtqml-documents-definetypes.html#defining-an-object-type-with-a-qml-file}{Defining an Object Type with a QML File}
+ \li \l{qtqml-documents-definetypes.html#accessible-attributes-of-custom-types}{Accessible Attributes of Custom Types}
+ \endlist
+ \li \l{qtqml-documents-networktransparency.html}{Resource Loading and Network Transparency}
+ \li \l{qtqml-documents-scope.html}{Scope and Naming Resolution}
+ \endlist
+\endlist
+
+*/
diff --git a/src/qml/doc/src/syntax/basics.qdoc b/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc
index d20f66d80a..cdfab3cd3f 100644
--- a/src/qml/doc/src/syntax/basics.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc
@@ -89,9 +89,9 @@ Rectangle {
}
\endqml
-This declares an object of type \l Rectangle, followed by a set of curly braces that encompasses the attributes defined for that object. The \l Rectangle type is a type made available by the \l QtQuick module, and the attributes defined in this case are the values of the rectangle's \c width, \c height and \c color properties. (These are properties made available by the \l Rectangle type, as described in the \l Rectangle documentation.)
+This declares an object of type \l Rectangle, followed by a set of curly braces that encompasses the attributes defined for that object. The \l Rectangle type is a type made available by the \c QtQuick module, and the attributes defined in this case are the values of the rectangle's \c width, \c height and \c color properties. (These are properties made available by the \l Rectangle type, as described in the \l Rectangle documentation.)
-The above object can be loaded by the engine if it is part of a \l{qtqml-documents-topic.html}{QML document}. That is, if the source code is complemented with \e import statement that imports the QtQuick module (to make the \l Rectangle type available), as below:
+The above object can be loaded by the engine if it is part of a \l{qtqml-documents-topic.html}{QML document}. That is, if the source code is complemented with \e import statement that imports the \c QtQuick module (to make the \l Rectangle type available), as below:
\qml
import QtQuick 2.0
@@ -103,7 +103,7 @@ Rectangle {
}
\endqml
-When placed into a \c .qml file and loaded by the QML engine, the above code creates a \l Rectangle object using the \l Rectangle type supplied by the QtQuick module:
+When placed into a \c .qml file and loaded by the QML engine, the above code creates a \l Rectangle object using the \l Rectangle type supplied by the \c QtQuick module:
\image qtqml-syntax-basics-object-declaration.png
@@ -140,7 +140,7 @@ Rectangle {
When this code is loaded by the engine, it creates an object tree with a \l Rectangle object at the root; this object has a \l Gradient child object, which in turn has two \l GradientStop children.
Note, however, that this is a parent-child relationship in the context of the QML object tree, not
-in the context of the visual scene. The concept of a parent-child relationship in a visual scene is provided by the \l Item type from the \l QtQuick module, which is the base type for most QML types, as most QML objects are intended to be visually rendered. For example, \l Rectangle and \l Text are both \l {Item}-based types, and below, a \l Text object has been declared as a visual child of a \l Rectangle object:
+in the context of the visual scene. The concept of a parent-child relationship in a visual scene is provided by the \l Item type from the \c QtQuick module, which is the base type for most QML types, as most QML objects are intended to be visually rendered. For example, \l Rectangle and \l Text are both \l {Item}-based types, and below, a \l Text object has been declared as a visual child of a \l Rectangle object:
\qml
import QtQuick 2.0
diff --git a/src/qml/doc/src/syntax/directoryimports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc
index 7a6fb58c27..7a6fb58c27 100644
--- a/src/qml/doc/src/syntax/directoryimports.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc
diff --git a/src/qml/doc/src/syntax/imports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
index eda7dbf006..1496a1e5c9 100644
--- a/src/qml/doc/src/syntax/imports.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
@@ -144,7 +144,7 @@ the types should be imported into a particular document-local namespace. If a
namespace is specified, then any references to the types made available by the
import must be prefixed by the local namespace qualifier.
-Below, the QtQuick module is imported into the namespace "CoreItems". Now, any
+Below, the \c QtQuick module is imported into the namespace "CoreItems". Now, any
references to types from the \c QtQuick module must be prefixed with the
\c CoreItems name:
@@ -178,7 +178,7 @@ CoreItems.Rectangle {
width: 100; height: 100
MyModule.Text { text: "Hello from my custom text item!" }
- CoreItems.Text { text: "Hello from QtQuick!" }
+ CoreItems.Text { text: "Hello from Qt Quick!" }
}
\endqml
diff --git a/src/qml/doc/src/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
index f336d14b14..f336d14b14 100644
--- a/src/qml/doc/src/syntax/objectattributes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
diff --git a/src/qml/doc/src/syntax/propertybinding.qdoc b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
index 6803901efd..6803901efd 100644
--- a/src/qml/doc/src/syntax/propertybinding.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
diff --git a/src/qml/doc/src/syntax/signals.qdoc b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
index 6c90ddcf0a..6344d16caa 100644
--- a/src/qml/doc/src/syntax/signals.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
@@ -27,7 +27,6 @@
/*!
\page qtqml-syntax-signals.html
-\ingroup qml-features
\title Signal and Handler Event System
\brief the event sytem in QML
@@ -115,7 +114,7 @@ Even though the \l MouseArea documentation does not document a signal handler na
\section2 Using the Connections Type
-In some cases it may be desirable to access a signal outside of the object that emits it. For these purposes, the QtQuick module provides the \l Connections type for connecting to signals of arbitrary objects. A \l Connections object can receive any signal from its specified \l {Connections::target}{target}.
+In some cases it may be desirable to access a signal outside of the object that emits it. For these purposes, the \c QtQuick module provides the \l Connections type for connecting to signals of arbitrary objects. A \l Connections object can receive any signal from its specified \l {Connections::target}{target}.
For example, the \c onClicked handler in the earlier example could have been received by the root \l Rectangle instead, by placing the \c onClicked handler in a \l Connections object that has its \l {Connections::target}{target} set to the \l MouseArea:
@@ -294,4 +293,3 @@ output:
*/
-
diff --git a/src/qml/doc/src/typesystem/basictypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
index 6f468d42bc..7d2d662e4e 100644
--- a/src/qml/doc/src/typesystem/basictypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
@@ -67,7 +67,7 @@ The basic types supported natively in the QML language are listed below:
\section2 Basic Types Provided By QML Modules
QML modules may extend the QML language with more basic types.
-For example, the basic types provided by the QtQuick module are listed below:
+For example, the basic types provided by the \c QtQuick module are listed below:
\annotatedlist qtquickbasictypes
Currently only QML modules which are provided by Qt may provide their
@@ -241,7 +241,7 @@ property is only invoked when the property is reassigned to a different object v
\brief a resource locator.
The \c url type refers to a resource locator (like a file name, for example). It can be either
- absolute, e.g. "http://qt.nokia.com", or relative, e.g. "pics/logo.png". A relative URL is
+ absolute, e.g. "http://qt-project.org", or relative, e.g. "pics/logo.png". A relative URL is
resolved relative to the URL of the containing component.
For example, the following assigns a valid URL to the \l {Image::source}
diff --git a/src/qml/doc/src/typesystem/objecttypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
index 9209ebe68e..9209ebe68e 100644
--- a/src/qml/doc/src/typesystem/objecttypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
diff --git a/src/qml/doc/src/typesystem/topic.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc
index 76e28f7ef1..76e28f7ef1 100644
--- a/src/qml/doc/src/typesystem/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc
diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc
index 799945fa37..3def3209cc 100644
--- a/src/qml/doc/src/qmltypereference.qdoc
+++ b/src/qml/doc/src/qmltypereference.qdoc
@@ -24,20 +24,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
/*!
\qmlmodule QtQml 2
\title Qt QML QML Types
\ingroup qmlmodules
\brief List of QML types provided by the Qt QML module
-The \c QtQml module provides the definition and implementation of various
+The \l{Qt QML} module provides the definition and implementation of various
convenience types which can be used with the QML language, including some
elementary QML types which can provide the basis for further extensions to the
-QML language.
-
-The \c QtQml module provides the \c QtObject and \c Component object types
-which may be used in QML documents. These types are non-visual and provide
-building-blocks for extensions to QML.
+QML language. The \l QtObject and \l Component object types are non-visual and
+provide building-blocks for extensions to QML.
\section1 Importing QtQml
@@ -53,15 +51,20 @@ import QtQml 2.0
\endqml
Most clients will never need to use the \c QtQml import, as all of the types
-and functionality provided by the \c QtQml namespace are also provided by the
-\c QtQuick namespace which may be imported as follows:
+are also provided by the \c QtQuick namespace which may be imported as
+follows:
\qml
import QtQuick 2.0
\endqml
-See the \l{Qt Quick} module documentation for more information about the
-\c QtQuick namespace and what it provides to QML application developers.
+See the \l{Qt Quick} module documentation for more information about the \c
+QtQuick namespace and what it provides to QML application developers.
+
+The QML types for creating lists and models, such as \l ListModel and \l
+ListElement, are moved to a submodule, \c QtQml.Models. The \l{Qt QML Models QML
+Types}{Qt QML Models} page has more information.
+
The documentation for the types below applies equally to the types of the same
name provided by the \l{Qt Quick} module, as they are in fact identical.
@@ -78,82 +81,6 @@ provided:
The following \l{qtqml-typesystem-objecttypes.html}{QML object types} are
provided:
-\section2 QtObject
-
-The \c QtObject type provides a basic instantiable object which can be used in
-QML applications. It is non-visual, but may have properties, methods, signals
-and signal handlers.
-
-For example, the following QtObject has several properties, one of which has
-been assigned a \l{Property Binding}
-{binding}, and a \l{Signal and Handler Event System}{signal handler} for
-the default change signal which exists for one of its properties:
-
-\code
- import QtQuick 2.0
-
- QtObject {
- property int a: 15
- property int b: a + 22
- property int changeCount: 0
-
- onAChanged: {
- changeCount += 1;
- }
- }
-\endcode
-
-\section2 Component
-
-The \c Component type provides a basic re-usable component which allows
-instances of another type to be instantiated on-demand. It may be given an
-\c id and it has a default property which is the object type to instantiate,
-but no other properties may be added to it.
-
-For example, the following QtObject has two different \l Component
-properties, and it uses those components to dynamically construct objects at
-run-time:
-
-\code
- import QtQuick 2.0
-
- QtObject {
- id: root
- property bool which: true
-
- property Component a: Component {
- id: firstComponent
- QtObject {
- property int answer: 42
- function activate() {
- console.log("The answer is: " + answer);
- }
- }
- }
-
- property Component b: Component {
- id: secondComponent
- QtObject {
- property string message: "Hello, World!"
- function activate() {
- console.log(message);
- }
- }
- }
-
- function activateDynamicObject() {
- var o = {};
- if (which) {
- which = false;
- o = a.createObject(null); // no parent
- } else {
- which = true;
- o = b.createObject(null); // no parent
- }
- o.activate();
- }
- }
-\endcode
*/
/*!
@@ -171,7 +98,7 @@ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" }
\endqml
To read a date value returned from a C++ extension class, use
-\l{QML:Qt::formatDate()}{Qt.formatDate()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+\l{QtQml2::Qt::formatDate()}{Qt.formatDate()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
When integrating with C++, note that any QDate value
\l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically
@@ -202,7 +129,7 @@ MyTimePicker { time: "14:22:15" }
\endqml
To read a time value returned from a C++ extension class, use
-\l{QML:Qt::formatTime()}{Qt.formatTime()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+\l{QtQml2::Qt::formatTime()}{Qt.formatTime()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
Note that when converting historical times to and from javascript that QDateTime and the JS Date object
have different methods of calculating historical daylight savings time application. This can lead to variations of one hour
@@ -231,7 +158,7 @@ To create a \c point value, specify it as a "x,y" string:
CustomObject { myPointProperty: "0,20" }
\endqml
-Or use the \l{QML:Qt::point()}{Qt.point()} function:
+Or use the \l{QtQml2::Qt::point()}{Qt.point()} function:
\qml
CustomObject { myPointProperty: Qt.point(0, 20) }
@@ -269,7 +196,7 @@ To create a \c size value, specify it as a "width x height" string:
Image { sourceSize: "150x50" }
\endqml
-Or use the \l{QML:Qt::size()}{Qt.size()} function:
+Or use the \l{QtQml2::Qt::size()}{Qt.size()} function:
\qml
Image { sourceSize: Qt.size(150, 50) }
@@ -309,7 +236,7 @@ To create a \c rect value, specify it as a "x, y, width x height" string:
CustomObject { myRectProperty: "50,50,100x100" }
\endqml
-Or use the \l{QML:Qt::rect()}{Qt.rect()} function:
+Or use the \l{QtQml2::Qt::rect()}{Qt.rect()} function:
\qml
CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }
@@ -322,5 +249,3 @@ is automatically converted into a QRectF value.
\sa{QML Basic Types}
*/
-
-
diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc
index 05a33f351a..26e4867bbc 100644
--- a/src/qml/doc/src/qtqml.qdoc
+++ b/src/qml/doc/src/qtqml.qdoc
@@ -30,159 +30,116 @@
\title Qt QML
\brief The Qt QML module defines and implements the QML language
-\section1 Overview of the Qt QML Module
-
-The Qt QML module provides a framework for developing applications and
-libraries with the QML language. It defines and implements the language
-and engine infrastructure, and provides an API to enable application
+The Qt QML module provides a framework for developing applications and libraries
+with the \l{QML Application Developer Resources}{QML language}. It defines and implements the
+language and engine infrastructure, and provides an API to enable application
developers to extend the QML language with custom types and integrate QML code
-with JavaScript and C++.
-
-The Qt QML module provides both the \c QtQml QML module, which supplies
-\l{Qt QML QML Types}{a set of core QML types} for creating QML
-applications, and the \c QtQml C++ module, which supplies \l{Qt QML C++ Classes}{a set of C++
-APIs} for extending QML applications with custom types and integrating C++
-implementations with QML applications.
+with JavaScript and C++. The Qt QML module provides both a \l{Qt QML QML Types}
+{QML API} and a \l{Qt QML C++ Classes}{C++ API}.
-Note that the Qt QML module provides only the language and infrastructure
-for the QML, and does not provide a visual canvas or rendering engine for
-creating user interfaces. These are provided instead by the
-\l{Qt Quick} module, which provides many visual components,
-model/view support, an animation framework and much more for building user
-interfaces with QML.
+Note that while the Qt QML module provides the language and infrastructure
+for QML applications, the \l{Qt Quick} module provides many visual components,
+model-view support, an animation framework, and much more for building user
+interfaces.
For those new to QML and Qt Quick, please see
\l{qtquick-applicationdevelopers.html}{QML Application Developer Resources}
for an introduction to writing QML applications.
+\section1 Getting Started
-\section1 Qt QML Module Documentation
+To include the definitions of the module's classes, use the
+following directive:
-\list
- \li \l{qtqml-cppclasses-topic.html}{Important C++ Classes}
- \list
- \li \l{QQmlEngine}
- \li \l{QQmlContext}
- \li \l{QQmlComponent}
- \li \l{QQmlExpression}
- \endlist
-
- \li \l{qtqml-typesystem-topic.html}{The QML Type System}
- \list
- \li \l{qtqml-typesystem-basictypes.html}{Basic Types}
- \li \l{qtqml-typesystem-topic.html#javascript-types}{JavaScript Types}
- \li \l{qtqml-typesystem-objecttypes.html}{QML Object Types}
- \list
- \li \l{qtqml-documents-definetypes.html}{Defining Object Types from QML}
- \li \l{qtqml-cppintegration-definetypes.html}{Defining Object Types from C++}
- \endlist
- \endlist
-
- \li \l{qtqml-modules-topic.html}{QML Modules}
- \list
- \li \l{qtqml-modules-qmldir.html}{Specifying A QML Module}
- \li \l{qtqml-modules-topic.html#supported-qml-module-types}{Supported QML Module Types}
- \list
- \li \l{qtqml-modules-identifiedmodules.html}{Identified Modules}
- \li \l{qtqml-modules-legacymodules.html}{Legacy Modules}
- \endlist
- \li \l{qtqml-modules-cppplugins.html}{Providing Types and Functionality in a C++ Plugin}
- \endlist
-
- \li \l{qtqml-documents-topic.html}{QML Documents}
- \list
- \li \l{qtqml-documents-structure.html}{Structure of a QML Document}
- \li \l{Syntax of the QML Language}
- \li \l{qtqml-documents-definetypes.html}{Defining Object Types through QML Documents}
- \list
- \li \l{qtqml-documents-definetypes.html#defining-an-object-type-with-a-qml-file}{Defining an Object Type with a QML File}
- \li \l{qtqml-documents-definetypes.html#accessible-attributes-of-custom-types}{Accessible Attributes of Custom Types}
- \endlist
- \li \l{qtqml-documents-networktransparency.html}{Resource Loading and Network Transparency}
- \li \l{qtqml-documents-scope.html}{Scope and Naming Resolution}
- \endlist
-
- \li \l{qtqml-typereference-topic.html}{QML Types Provided by the Qt QML Module}
- \list
- \li \l{qtqml-typereference-topic.html#importing-qtqml}{Importing \c QtQml}
- \li \l{qtqml-typereference-topic.html#basic-types}{Basic Types}
- \li \l{qtqml-typereference-topic.html#object-types}{Object Types}
- \list
- \li \l{qtqml-typereference-topic.html#qtobject}{QtObject}
- \li \l{qtqml-typereference-topic.html#component}{Component}
- \endlist
- \endlist
-
- \li \l{qtqml-javascript-topic.html}{Integrating QML and JavaScript}
- \list
- \li \l{qtqml-javascript-expressions.html}{Using JavaScript Expressions with QML}
- \li \l{qtqml-javascript-dynamicobjectcreation.html}{Dynamic QML Object Creation from JavaScript}
- \li \l{qtqml-javascript-resources.html}{Defining JavaScript Resources In QML}
- \li \l{qtqml-javascript-imports.html}{Importing JavaScript Resources In QML}
- \li \l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment}
- \list
- \li \l{qtqml-javascript-hostenvironment.html#common-base}{Common Base}
- \li \l{qtqml-javascript-hostenvironment.html#qml-global-object}{QML Global Object}
- \li \l{qtqml-javascript-hostenvironment.html#javascript-objects-and-functions}{JavaScript Objects and Functions}
- \li \l{qtqml-javascript-hostenvironment.html#javascript-environment-restrictions}{JavaScript Environment Restrictions}
- \endlist
- \endlist
-
- \li \l{qtqml-cppintegration-topic.html}{Integrating QML and C++}
- \list
- \li \l{qtqml-cppintegration-exposecppattributes.html}{Exposing Attributes of C++ Classes to QML}
- \li \l{qtqml-cppintegration-definetypes.html}{Defining QML Types from C++}
- \li \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context Properties}
- \li \l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++}
- \li \l{qtqml-cppintegration-data.html}{Data Type Conversion Between QML and C++}
- \endlist
+\code
+#include <QtQml>
+\endcode
+
+The QML types in Qt QML are available through the \c QtQML import. To use the
+types, add the following import statement to your .qml file:
+\code
+import QtQml 2.0
+\endcode
+
+
+To link against the module, add this line to your \l qmake \c
+.pro file:
+\code
+QT += qml
+\endcode
+
+\section1 QML and QML Types
+
+The Qt QML module contains the QML framework and important QML types used in
+applications. The constructs of QML are described in the \l{The QML Reference}.
+
+In addition to the \l{QML Basic Types}, the module comes with
+various QML object types:
+\list
+\li \l Component
+\li \l QtObject
+\li \l Binding
+\li \l Connections
+\li \l Timer
\endlist
+\section2 Lists and Models
-\section1 Syntax of the QML Language
+New in Qt 5.1, the model types are moved to a submodule, \c QtQml.Models. The
+\l{Qt QML Models QML Types}{Qt QML Models} page has more information.
\list
- \li \l{qtqml-syntax-basics.html}{QML Syntax Basics}
- \list
- \li \l{qtqml-syntax-imports.html}{Import Statements}
- \li \l{qtqml-syntax-basics.html#object-declarations}{Object Declarations}
- \list
- \li \l{qtqml-syntax-basics.html#child-objects}{Child Objects}
- \endlist
- \li \l{qtqml-syntax-basics.html#comments}{Comments}
- \endlist
-
- \li \l{qtqml-syntax-objectattributes.html}{QML Object Attributes}
- \list
- \li \l{qtqml-syntax-objectattributes.html#the-id-attribute}{The \e id Attribute}
- \li \l{qtqml-syntax-objectattributes.html#property-attributes}{Property Attributes}
- \li \l{qtqml-syntax-objectattributes.html#signal-attributes}{Signal Attributes}
- \li \l{qtqml-syntax-objectattributes.html#method-attributes}{Method Attributes}
- \li \l{qtqml-syntax-objectattributes.html#attached-properties-and-attached-signal-handlers}{Attached Properties and Attached Signal Handlers}
- \endlist
-
- \li \l{qtqml-syntax-propertybinding.html}{Property Binding}
- \li \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
+\li \l DelegateModel
+\li \l DelegateModelGroup
+\li \l ListElement
+\li \l ListModel
+\li \l ObjectModel
\endlist
-\section1 Reference Documentation
+\section1 JavaScript Environment for QML Applications
+
+JavaScript expressions allow QML code to contain application logic. Qt QML
+provides the framework for running JavaScript expressions in QML and from C++.
+
+These sections are from \l{The QML Reference}.
+\l{qtqml-javascript-topic.html}{Integrating QML and JavaScript}
+ \list
+ \li \l{qtqml-javascript-expressions.html}{Using JavaScript Expressions with QML}
+ \li \l{qtqml-javascript-dynamicobjectcreation.html}{Dynamic QML Object Creation from JavaScript}
+ \li \l{qtqml-javascript-resources.html}{Defining JavaScript Resources In QML}
+ \li \l{qtqml-javascript-imports.html}{Importing JavaScript Resources In QML}
+ \li \l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment}
+ \endlist
+
+\section1 Integrating QML with C++ Applications
+
+The module also provides the framework for running QML applications.
+The QML framework allows QML code to contain JavaScript expressions and for
+the QML code to interact with C++ code.
-Additional Qt QML information:
\list
-\li \l{Qt QML C++ Classes} - the C++ API provided by the
- Qt QML module
-\li \l{Qt QML Release Notes} - list of changes and
- additions in the Qt QML module
+\li \l{Important C++ Classes Provided By The Qt QML Module}
+\li \l{Integrating QML and C++}
\endlist
+\section1 Guides and Other Information
+
Further information for writing QML applications:
\list
+\li \l{The QML Reference}
\li \l{QML Application Developer Resources}
- essential information for application development with QML and Qt Quick
-\li \l{Qt Quick} - documentation for the Qt Quick module, which provides a
- visual canvas, an animation framework, model/view components and more for
- building fluid user interfaces and applications with QML
+\li \l{Qt Quick} - a module which provides a set of QML types and C++ classes
+ for building user interfaces and applications with QML
+\li \l{Qt QML Release Notes} - list of changes and
+ additions in the Qt QML module
+\endlist
+
+\section2 Reference
+\list
+\li \l{Qt QML C++ Classes}{C++ Classes}
+\li \l{Qt QML QML Types}{QML Types}
\endlist
-*/
+*/
diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc
index 361f6e61ee..eece3bcaab 100644
--- a/src/qml/doc/src/whatsnew.qdoc
+++ b/src/qml/doc/src/whatsnew.qdoc
@@ -28,16 +28,37 @@
/*!
\title Qt QML Release Notes
\page qtqml-releasenotes.html
-\inqmlmodule QtQuick 2.0
-\section1 Qt QML in Qt 5
+\section1 Qt QML in Qt 5.1
+
+Qt 5.1 introduces several bug fixes and new functionalities to Qt QML. This is
+a summary of the new changes:
+\list
+\li New QQmlApplicationEngine convenience class for QML applications.
+\li New Instantiatior type for generic, dynamic object creation.
+\li New properties for \l Qt.application: arguments, name, and version.
+\endlist
+
+\section2 New Submodule
+
+The \l{Qt QML Models QML Types}{Qt QML Models} is a new submodule in Qt 5.1 and
+provides several QML types for handling data with models and lists. These types
+replace types such as \l VisualItem, \l VisualDataModel, and \l VisualDataGroup.
+
+\list
+\li \l{Qt QML Models QML Types}{Models}
+\endlist
+
+The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release.
+
+\section1 Qt QML in Qt 5.0
The \l{Qt QML} module is new in Qt 5.0. It provides the QML engine and
implements the QML language supporting infrastructure.
-(Prior to Qt 5, this functionality was provided by the QtDeclarative module, which
-has now been replaced by the new QtQml and QtQuick C++ modules. See the
-\l {Porting QML Applications to Qt 5} for more information.)
+(Prior to Qt 5, this functionality was provided by the \l {Qt Quick 1}{QtDeclarative} module, which
+has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the
+\l {Porting QML Applications to Qt 5} page for more information.)
\section2 QML Engine
@@ -73,11 +94,11 @@ has now been replaced by the new QtQml and QtQuick C++ modules. See the
\list
\li QML now supports defining properties of value type basic types within QML documents. Supported types include
QSizeF, QPointF and QRectF as \c size, \c point and \c rect respectively.
- \li QColor is now a value type provided by the QtQuick module. The red, green, blue and alpha channels
+ \li QColor is now a value type provided by the \c QtQuick module. The red, green, blue and alpha channels
of a \l color property can be accessed via \c r, \c g, \c b and \c a properties.
\li Factory functions for various value types have been added to the \c Qt object exposed to QML.
- Some of those functions require the QtQuick module to be imported in order to return valid values.
- See the QtQuick 2.0 release notes for more information about these functions.
+ Some of those functions require the \c QtQuick module to be imported in order to return valid values.
+ See the \l {Qt Quick Release Notes} for more information about these functions.
\endlist
\li Support for sequence types QList<int>, QList<qreal>, QList<bool>, QList<QUrl>,
QList<QString> and QStringList has been improved. QObjects can define Q_PROPERTYs of
@@ -95,7 +116,7 @@ has now been replaced by the new QtQml and QtQuick C++ modules. See the
\list
\li QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString.
-\li The \l {QML:Qt} object now provides a \l{QML:Qt::inputMethod} property to access the active
+\li The \l {QtQml2::Qt}{Qt} global object now provides an \l{QtQml2::Qt::inputMethod}{inputMethod} property to access the active
text input method for an application.
\endlist
diff --git a/src/qml/qml/ftw/qhashedstring.cpp b/src/qml/qml/ftw/qhashedstring.cpp
index 577757f3c0..99f342f6f0 100644
--- a/src/qml/qml/ftw/qhashedstring.cpp
+++ b/src/qml/qml/ftw/qhashedstring.cpp
@@ -152,7 +152,7 @@ bool QHashedString::compare(const QChar *lhs, const QChar *rhs, int length)
if (a == b || !length)
return true;
- register union {
+ union {
const quint16 *w;
const quint32 *d;
quintptr value;
@@ -177,7 +177,7 @@ bool QHashedString::compare(const QChar *lhs, const QChar *rhs, int length)
// both addresses are 4-bytes aligned
// do a fast 32-bit comparison
- register const quint32 *e = sa.d + (length >> 1);
+ const quint32 *e = sa.d + (length >> 1);
for ( ; sa.d != e; ++sa.d, ++sb.d) {
if (*sa.d != *sb.d)
return false;
@@ -187,7 +187,7 @@ bool QHashedString::compare(const QChar *lhs, const QChar *rhs, int length)
return (length & 1) ? *sa.w == *sb.w : true;
} else {
// one of the addresses isn't 4-byte aligned but the other is
- register const quint16 *e = sa.w + length;
+ const quint16 *e = sa.w + length;
for ( ; sa.w != e; ++sa.w, ++sb.w) {
if (*sa.w != *sb.w)
return false;
diff --git a/src/qml/qml/parser/qqmljs.g b/src/qml/qml/parser/qqmljs.g
index ff4f54374b..5d279ef1a2 100644
--- a/src/qml/qml/parser/qqmljs.g
+++ b/src/qml/qml/parser/qqmljs.g
@@ -2615,6 +2615,10 @@ case $rule_number: {
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
+ if (lexer->qmlMode()) {
+ const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg));
+ }
} break;
./
diff --git a/src/qml/qml/parser/qqmljsparser.cpp b/src/qml/qml/parser/qqmljsparser.cpp
index a0fa7a4711..46b5c041d4 100644
--- a/src/qml/qml/parser/qqmljsparser.cpp
+++ b/src/qml/qml/parser/qqmljsparser.cpp
@@ -1515,6 +1515,10 @@ case 311: {
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
+ if (lexer->qmlMode()) {
+ const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg));
+ }
} break;
case 312: {
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index 680e317a4e..31904f81e2 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -51,6 +51,7 @@ SOURCES += \
$$PWD/qqmlmemoryprofiler.cpp \
$$PWD/qqmlplatform.cpp \
$$PWD/qqmlbinding.cpp \
+ $$PWD/qqmlabstracturlinterceptor.cpp \
$$PWD/qqmlapplicationengine.cpp \
$$PWD/qqmllistwrapper.cpp \
$$PWD/qqmlcontextwrapper.cpp \
@@ -127,6 +128,7 @@ HEADERS += \
$$PWD/qqmlplatform_p.h \
$$PWD/qqmlbinding_p.h \
$$PWD/qqmlextensionplugin_p.h \
+ $$PWD/qqmlabstracturlinterceptor_p.h \
$$PWD/qqmlapplicationengine_p.h \
$$PWD/qqmlapplicationengine.h \
$$PWD/qqmllistwrapper_p.h \
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h
index 7e6e0d1d36..fb0133f305 100644
--- a/src/qml/qml/qqml.h
+++ b/src/qml/qml/qqml.h
@@ -102,6 +102,8 @@ class QQmlPropertyValueInterceptor;
listName[listLen+nameLen] = '>'; \
listName[listLen+nameLen+1] = '\0';
+void Q_QML_EXPORT qmlClearTypeRegistrations();
+
template<typename T>
int qmlRegisterType()
{
@@ -417,11 +419,17 @@ class QQmlContext;
class QQmlEngine;
class QJSValue;
class QJSEngine;
-Q_QML_EXPORT void qmlExecuteDeferred(QObject *);
-Q_QML_EXPORT QQmlContext *qmlContext(const QObject *);
-Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *);
-Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
-Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool create);
+
+namespace QtQml {
+ // declared in namespace to avoid symbol conflicts with QtDeclarative
+ Q_QML_EXPORT void qmlExecuteDeferred(QObject *);
+ Q_QML_EXPORT QQmlContext *qmlContext(const QObject *);
+ Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *);
+ Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
+ Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *,
+ const QMetaObject *, bool create);
+}
+using namespace QtQml;
template<typename T>
QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
diff --git a/src/qml/qml/qqmlabstracturlinterceptor.cpp b/src/qml/qml/qqmlabstracturlinterceptor.cpp
new file mode 100644
index 0000000000..a68d5f7489
--- /dev/null
+++ b/src/qml/qml/qqmlabstracturlinterceptor.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QQmlAbstractUrlInterceptor
+ \inmodule QtQml
+ \brief allows you to control QML file loading.
+
+ \note This class is in an extended validation period and still subject to change. It should be treated as private API for 5.1
+
+ QQmlAbstractUrlInterceptor is an interface which can be used to alter URLs
+ before they are used by the QML engine. This is primarily useful for altering
+ file urls into other file urls, such as selecting different graphical assets
+ for the current platform.
+
+ Relative URLs are intercepted after being resolved against the file path of the
+ current QML context. URL interception also occurs after setting the base path for
+ a loaded QML file. This means that the content loaded for that QML file uses the
+ intercepted URL, but inside the file the pre-intercepted URL is used for resolving
+ relative paths. This allows for interception of .qml file loading without needing
+ all paths (or local types) inside intercepted content to insert a different relative path.
+
+ Compared to setNetworkAccessManagerFactory, QQmlAbstractUrlInterceptor affects all URLs
+ and paths, including local files and embedded resource files. QQmlAbstractUrlInterceptor
+ is synchronous, and for asynchronous files must return a url with an asynchronous scheme
+ (such as http or a custom scheme handled by your own custom QNetworkAccessManager). You
+ can use a QQmlAbstractUrlInterceptor to change file URLs into networked URLs which are
+ handled by your own custom QNetworkAccessManager.
+
+ To implement support for a custom networked scheme, see setNetworkAccessManagerFactory.
+*/
+
+/*
+ \enum QQmlAbstractUrlInterceptor::DataType
+
+ Specifies where URL interception is taking place place.
+
+ Because QML loads qmldir files for locating types, there are two URLs involved in loading a QML type. The URL of the (possibly implicit) qmldir used for locating the type and the URL of the file which defines the type. Intercepting
+ both leads to either complex URL replacement or double URL replacements for the same file.
+
+ \value QmldirFile The URL being intercepted is for a Qmldir file. Intercepting this, but not the QmlFile, allows for swapping out entire sub trees.
+ \value JavaScriptFile The URL being intercepted is an import for a Javascript file.
+ \value QmlFile The URL being intercepted is for a Qml file. Intercepting this, but not the Qmldir file, leaves the base dir of a QML file untouched and acts like replacing the file with another file.
+ \value UrlString The URL being intercepted is a url property in a QML file, and not being used to load a file through the engine.
+
+*/
+
+/*!
+ \fn QUrl QQmlAbstractUrlInterceptor::intercept(const QUrl& url, DataType type)
+
+ A pure virtual function where you can intercept the url. The returned value is taken as the
+ new value for the url. The type of url being intercepted is given by the type variable.
+*/
diff --git a/src/qml/qml/qqmlabstracturlinterceptor_p.h b/src/qml/qml/qqmlabstracturlinterceptor_p.h
new file mode 100644
index 0000000000..186d59e301
--- /dev/null
+++ b/src/qml/qml/qqmlabstracturlinterceptor_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//Private API for 5.1 (at least)
+#ifndef QQMLABSTRACTURLINTERCEPTOR_H
+#define QQMLABSTRACTURLINTERCEPTOR_H
+
+#include <QtCore/qurl.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QML_EXPORT QQmlAbstractUrlInterceptor
+{
+ Q_FLAGS(InterceptionPoint)
+public:
+ enum DataType { //Matches QQmlDataBlob::Type
+ QmlFile = 0,
+ JavaScriptFile = 1,
+ QmldirFile = 2,
+ UrlString = 0x1000
+ };
+
+ QQmlAbstractUrlInterceptor() {}
+ virtual ~QQmlAbstractUrlInterceptor() {}
+ virtual QUrl intercept(const QUrl &path, DataType type) = 0;
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index 7dc2c77922..9181dad519 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -72,6 +72,7 @@ void QQmlApplicationEnginePrivate::init()
QCoreApplication::installTranslator(qtTranslator);
translators << qtTranslator;
#endif
+ QCoreApplication::instance()->setProperty("__qml_using_qqmlapplicationengine", QVariant(true));
}
void QQmlApplicationEnginePrivate::loadTranslations(const QUrl &rootFile)
@@ -133,7 +134,8 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o)
case QQmlComponent::Null:
return; //These cases just wait for the next status update
}
- delete c;
+
+ c->deleteLater();
}
/*!
@@ -158,16 +160,21 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o)
}
\endcode
- You can also use QCoreApplication with QQmlApplicationEngine, if you are not using any QML modules which require a QGuiApplication (such as QtQuick).
+ You can also use QCoreApplication with QQmlApplicationEngine, if you are not using any QML modules which require a QGuiApplication (such as \c QtQuick).
List of configuration changes from a default QQmlEngine:
\list
\li Connecting Qt.quit() to QCoreApplication::quit()
\li Automatically loads translation files from an i18n directory adjacent to the main QML file.
+ \li Automatically sets an incubuation controller if the scene contains a QQuickWindow.
\endlist
The engine behavior can be further tweaked by using the inherited methods from QQmlEngine.
+
+ \note In the future QQmlApplicationEngine may automatically apply file selectors.
+ To ensure forwards compatibility, do not use folder names containing a '+' character in your QML file
+ structure.
*/
/*!
diff --git a/src/qml/qml/qqmlcompileddata.cpp b/src/qml/qml/qqmlcompileddata.cpp
index 4dba670be8..d44ae16fd2 100644
--- a/src/qml/qml/qqmlcompileddata.cpp
+++ b/src/qml/qml/qqmlcompileddata.cpp
@@ -221,7 +221,6 @@ QQmlInstruction::Type QQmlCompiledData::instructionType(const QQmlInstruction *i
return QQmlInstruction::I;
FOR_EACH_QML_INSTR(QML_CHECK_INSTR_CODE)
- Q_UNREACHABLE();
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid instruction address");
return static_cast<QQmlInstruction::Type>(0);
# undef QML_CHECK_INSTR_CODE
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 07a29e5a63..dcc33a20a3 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -60,6 +60,7 @@
#include "qqmlscriptstring.h"
#include "qqmlglobal_p.h"
#include "qqmlbinding_p.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <QDebug>
#include <QPointF>
@@ -516,6 +517,10 @@ void QQmlCompiler::genLiteralAssignment(QQmlScript::Property *prop,
// Encoded dir-separators defeat QUrl processing - decode them first
string.replace(QLatin1String("%2f"), QLatin1String("/"), Qt::CaseInsensitive);
QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string));
+ // Apply URL interceptor
+ if (engine->urlInterceptor())
+ u = engine->urlInterceptor()->intercept(u,
+ QQmlAbstractUrlInterceptor::UrlString);
instr.propertyIndex = prop->index;
instr.value = output->indexForUrl(u);
output->addInstruction(instr);
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 06f99abc8c..382b85685a 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -203,14 +203,14 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
}
\endcode
- Note that the QtQuick 1 version is named QDeclarativeComponent.
+ Note that the \l {Qt Quick 1} version is named QDeclarativeComponent.
*/
/*!
\qmltype Component
\instantiates QQmlComponent
\ingroup qml-utility-elements
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief Encapsulates a QML component definition
Components are reusable, encapsulated QML types with well-defined interfaces.
@@ -226,7 +226,7 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
\snippet qml/component.qml 0
- Notice that while a \l Rectangle by itself would be automatically
+ Notice that while a \l Rectangle by itself would be automatically
rendered and displayed, this is not the case for the above rectangle
because it is defined inside a \c Component. The component encapsulates the
QML types within, as if they were defined in a separate QML
@@ -246,7 +246,7 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
to specify how each list item is to be displayed.
\c Component objects can also be created dynamically using
- \l{QML:Qt::createComponent()}{Qt.createComponent()}.
+ \l{QtQml2::Qt::createComponent()}{Qt.createComponent()}.
\section2 Creation Context
@@ -312,12 +312,12 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
}
\endqml
- \sa QtQml
+ \sa {Qt QML}
*/
/*!
\enum QQmlComponent::Status
-
+
Specifies the loading status of the QQmlComponent.
\value Null This QQmlComponent has no data. Call loadUrl() or setData() to add QML content.
@@ -382,8 +382,8 @@ void QQmlComponentPrivate::clear()
typeData->release();
typeData = 0;
}
-
- if (cc) {
+
+ if (cc) {
cc->release();
cc = 0;
}
@@ -558,12 +558,12 @@ QQmlComponent::QQmlComponent(QQmlEngine *engine, const QUrl &url, CompilationMod
}
/*!
- Create a QQmlComponent from the given \a fileName and give it the specified
+ Create a QQmlComponent from the given \a fileName and give it the specified
\a parent and \a engine.
\sa loadUrl()
*/
-QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
+QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
QObject *parent)
: QObject(*(new QQmlComponentPrivate), parent)
{
@@ -617,7 +617,7 @@ void QQmlComponent::setData(const QByteArray &data, const QUrl &url)
d->url = url;
QQmlTypeData *typeData = QQmlEnginePrivate::get(d->engine)->typeLoader.getType(data, url);
-
+
if (typeData->isCompleteOrError()) {
d->fromTypeData(typeData);
} else {
@@ -780,10 +780,15 @@ QQmlComponent::QQmlComponent(QQmlComponentPrivate &dd, QObject *parent)
/*!
Create an object instance from this component. Returns 0 if creation
failed. \a context specifies the context within which to create the object
- instance.
+ instance.
If \a context is 0 (the default), it will create the instance in the
engine' s \l {QQmlEngine::rootContext()}{root context}.
+
+ The ownership of the returned object instance is determined by the QQmlEngine.
+ By default the caller has to take care that the object is eventually deleted.
+
+ \sa QQmlEngine::ObjectOwnership
*/
QObject *QQmlComponent::create(QQmlContext *context)
{
@@ -801,28 +806,31 @@ QObject *QQmlComponent::create(QQmlContext *context)
/*!
This method provides advanced control over component instance creation.
- In general, programmers should use QQmlComponent::create() to create a
+ In general, programmers should use QQmlComponent::create() to create a
component.
Create an object instance from this component. Returns 0 if creation
failed. \a publicContext specifies the context within which to create the object
- instance.
+ instance.
When QQmlComponent constructs an instance, it occurs in three steps:
\list 1
\li The object hierarchy is created, and constant values are assigned.
\li Property bindings are evaluated for the first time.
\li If applicable, QQmlParserStatus::componentComplete() is called on objects.
- \endlist
+ \endlist
QQmlComponent::beginCreate() differs from QQmlComponent::create() in that it
- only performs step 1. QQmlComponent::completeCreate() must be called to
+ only performs step 1. QQmlComponent::completeCreate() must be called to
complete steps 2 and 3.
This breaking point is sometimes useful when using attached properties to
communicate information to an instantiated component, as it allows their
initial values to be configured before property bindings take effect.
- \sa completeCreate()
+ The ownership of the returned object instance is determined by the QQmlEngine.
+ By default the caller has to take care that the object is eventually deleted.
+
+ \sa completeCreate(), QQmlEngine::ObjectOwnership
*/
QObject *QQmlComponent::beginCreate(QQmlContext *publicContext)
{
@@ -950,7 +958,7 @@ void QQmlComponentPrivate::complete(QQmlEnginePrivate *enginePriv, ConstructionS
/*!
This method provides advanced control over component instance creation.
- In general, programmers should use QQmlComponent::create() to create a
+ In general, programmers should use QQmlComponent::create() to create a
component.
This function completes the component creation begun with QQmlComponent::beginCreate()
@@ -1044,7 +1052,7 @@ void QQmlComponent::create(QQmlIncubator &incubator, QQmlContext *context,
{
Q_D(QQmlComponent);
- if (!context)
+ if (!context)
context = d->engine->rootContext();
QQmlContextData *contextData = QQmlContextData::get(context);
@@ -1122,7 +1130,7 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent)
needParent = true;
}
}
- if (needParent)
+ if (needParent)
qWarning("QQmlComponent: Created graphical object was not "
"placed in the graphics scene.");
}
@@ -1140,15 +1148,15 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent)
which were not created in QML.
If you wish to create an object without setting a parent, specify \c null for
- the \a parent value. Note that if the returned object is to be displayed, you
- must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent}
+ the \a parent value. Note that if the returned object is to be displayed, you
+ must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent}
property, or else the object will not be visible.
If a \a parent is not provided to createObject(), a reference to the returned object must be held so that
it is not destroyed by the garbage collector. This is true regardless of whether \l{Item::parent} is set afterwards,
since setting the Item parent does not change object ownership; only the graphical parent is changed.
- As of QtQuick 1.1, this method accepts an optional \a properties argument that specifies a
+ As of \c {QtQuick 1.1}, this method accepts an optional \a properties argument that specifies a
map of initial property values for the created object. These values are applied before object
creation is finalized. This is more efficient than setting property values after object creation,
particularly where large sets of property values are defined, and also allows property bindings
@@ -1236,17 +1244,16 @@ void QQmlComponent::createObject(QQmlV4Function *args)
/*!
\qmlmethod object Component::incubateObject(Item parent, object properties, enumeration mode)
- Creates an incubator for instance of this component. Incubators allow new component
+ Creates an incubator for instance of this component. Incubators allow new component
instances to be instantiated asynchronously and not cause freezes in the UI.
- The \a parent argument specifies the parent the created instance will have. Omitting the
+ The \a parent argument specifies the parent the created instance will have. Omitting the
parameter or passing null will create an object with no parent. In this case, a reference
- to the created object must be maintained by the application or the object will eventually
- be garbage collected.
+ to the created object must be held so that it is not destroyed by the garbage collector.
The \a properties argument is specified as a map of property-value items which will be
- set on the created object during its construction. \a mode may be Qt.Synchronous or
- Qt.Asynchronous and controls whether the instance is created synchronously or asynchronously.
+ set on the created object during its construction. \a mode may be Qt.Synchronous or
+ Qt.Asynchronous and controls whether the instance is created synchronously or asynchronously.
The default is asynchronously. In some circumstances, even if Qt.Synchronous is specified,
the incubator may create the object asynchronously. This happens if the component calling
incubateObject() is itself being created asynchronously.
@@ -1329,7 +1336,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
}
QQmlComponentExtension *e = componentExtension(args->engine());
-
+
QV4::ExecutionEngine *v4 = QV8Engine::getV4(args->engine());
QmlIncubatorObject *r = new (v4->memoryManager) QmlIncubatorObject(args->engine(), mode);
r->prototype = e->incubationProto.value().asObject();
@@ -1462,7 +1469,7 @@ void QmlIncubatorObject::setInitialState(QObject *o)
f.asFunctionObject()->call(QV4::Value::fromObject(v4->globalObject), args, 2);
}
}
-
+
void QmlIncubatorObject::destroy(Managed *that)
{
QmlIncubatorObject *o = that->as<QmlIncubatorObject>();
diff --git a/src/qml/qml/qqmlcomponentattached_p.h b/src/qml/qml/qqmlcomponentattached_p.h
index 3c27e795c6..ae416dcb1c 100644
--- a/src/qml/qml/qqmlcomponentattached_p.h
+++ b/src/qml/qml/qqmlcomponentattached_p.h
@@ -43,12 +43,13 @@
#define QQMLCOMPONENTATTACHED_P_H
#include <QtQml/qqml.h>
+#include <private/qtqmlglobal_p.h>
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QQmlComponentAttached : public QObject
+class Q_QML_PRIVATE_EXPORT QQmlComponentAttached : public QObject
{
Q_OBJECT
public:
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index efe586eec1..daa115b952 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -48,6 +48,7 @@
#include "qqmlengine_p.h"
#include "qqmlengine.h"
#include "qqmlinfo.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <qjsengine.h>
#include <QtCore/qvarlengtharray.h>
@@ -429,6 +430,7 @@ QUrl QQmlContextData::resolvedUrl(const QUrl &src)
{
QQmlContextData *ctxt = this;
+ QUrl resolved;
if (src.isRelative() && !src.isEmpty()) {
if (ctxt) {
while(ctxt) {
@@ -439,14 +441,20 @@ QUrl QQmlContextData::resolvedUrl(const QUrl &src)
}
if (ctxt)
- return ctxt->url.resolved(src);
+ resolved = ctxt->url.resolved(src);
else if (engine)
- return engine->baseUrl().resolved(src);
+ resolved = engine->baseUrl().resolved(src);
}
- return QUrl();
} else {
- return src;
+ resolved = src;
}
+
+ if (resolved.isEmpty()) //relative but no ctxt
+ return resolved;
+
+ if (engine && engine->urlInterceptor())
+ resolved = engine->urlInterceptor()->intercept(resolved, QQmlAbstractUrlInterceptor::UrlString);
+ return resolved;
}
diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h
index 038badae22..baf00adec4 100644
--- a/src/qml/qml/qqmlcustomparser_p.h
+++ b/src/qml/qml/qqmlcustomparser_p.h
@@ -149,7 +149,7 @@ private:
Flags m_flags;
friend class QQmlCompiler;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlCustomParser::Flags);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlCustomParser::Flags)
#if 0
#define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 7ab783c577..76d03f011e 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -83,7 +83,7 @@ public:
hasTaintedV8Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
hasVMEMetaObject(false), parentFrozen(false), notifyList(0), context(0), outerContext(0),
bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
- lineNumber(0), columnNumber(0), compiledData(0), deferredIdx(0), jsEngineId(0),
+ lineNumber(0), columnNumber(0), compiledData(0), deferredData(0), jsEngineId(0),
propertyCache(0), guards(0), extendedData(0) {
init();
}
@@ -174,8 +174,13 @@ public:
quint16 lineNumber;
quint16 columnNumber;
+ struct DeferredData {
+ unsigned int deferredIdx;
+ QQmlCompiledData *compiledData;//Not always the same as the other compiledData
+ QQmlContextData *context;//Could be either context or outerContext
+ };
QQmlCompiledData *compiledData;
- unsigned int deferredIdx;
+ DeferredData *deferredData;
quint32 jsEngineId; // id of the engine that cerated the jsWrapper
QV4::WeakValue jsWrapper;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 26f3ea9b56..be1c28c62b 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -66,6 +66,7 @@
#include <private/qv8debugservice_p.h>
#include <private/qdebugmessageservice_p.h>
#include "qqmlincubator.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <private/qv8profilerservice_p.h>
#include <private/qqmlboundsignal_p.h>
@@ -120,7 +121,7 @@ void qmlRegisterBaseTypes(const char *uri, int versionMajor, int versionMinor)
/*!
\qmltype QtObject
\instantiates QObject
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\ingroup qml-utility-elements
\brief A basic QML type
@@ -274,8 +275,9 @@ QQmlImageProviderBase::~QQmlImageProviderBase()
/*!
\qmltype Qt
- \instantiates QQmlEnginePrivate
- \ingroup qml-utility-elements
+\inqmlmodule QtQml 2
+\instantiates QQmlEnginePrivate
+\ingroup qml-utility-elements
\brief The QML global Qt object provides useful enums and functions from Qt.
\keyword QmlGlobalQtObject
@@ -314,7 +316,7 @@ when the property has one of the following types:
\li \c size - use \l{Qt::size()}{Qt.size()}
\endlist
-If the QtQuick module has been imported, the following helper functions for
+If the \c QtQuick module has been imported, the following helper functions for
creating objects of specific data types are also available for clients to use:
\list
\li \c color - use \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::hsla()}{Qt.hsla()}, \l{Qt::darker()}{Qt.darker()}, \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()}
@@ -509,7 +511,7 @@ QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e)
outputWarningsToStdErr(true),
cleanup(0), erroredBindings(0), inProgressCreations(0),
workerScriptEngine(0), activeVME(0),
- networkAccessManager(0), networkAccessManagerFactory(0),
+ networkAccessManager(0), networkAccessManagerFactory(0), urlInterceptor(0),
scarceResourcesRefCount(0), typeLoader(e), importDatabase(e), uniqueId(1),
incubatorCount(0), incubationController(0), mutex(QMutex::Recursive)
{
@@ -721,17 +723,17 @@ void QQmlData::flushPendingBindingImpl(int coreIndex)
}
}
+bool QQmlEnginePrivate::baseModulesUninitialized = true;
void QQmlEnginePrivate::init()
{
Q_Q(QQmlEngine);
- static bool firstTime = true;
- if (firstTime) {
+ if (baseModulesUninitialized) {
qmlRegisterType<QQmlComponent>("QML", 1, 0, "Component"); // required for the Compiler.
registerBaseTypes("QtQml", 2, 0); // import which provides language building blocks.
QQmlData::init();
- firstTime = false;
+ baseModulesUninitialized = false;
}
qRegisterMetaType<QVariant>();
@@ -800,7 +802,7 @@ QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine()
In this case, the Text item will be created in the engine's
\l {QQmlEngine::rootContext()}{root context}.
- Note that the QtQuick 1 version is called QDeclarativeEngine.
+ Note that the \l {Qt Quick 1} version is called QDeclarativeEngine.
\sa QQmlComponent, QQmlContext
*/
@@ -831,6 +833,8 @@ QQmlEngine::QQmlEngine(QQmlEnginePrivate &dd, QObject *parent)
Any QQmlContext's created on this engine will be
invalidated, but not destroyed (unless they are parented to the
QQmlEngine object).
+
+ See QJSEngine docs for details on cleaning up the JS engine.
*/
QQmlEngine::~QQmlEngine()
{
@@ -923,6 +927,35 @@ QQmlContext *QQmlEngine::rootContext() const
}
/*!
+ \internal
+ This API is private for 5.1
+
+ Sets the \a urlInterceptor to be used when resolving URLs in QML.
+ This also applies to URLs used for loading script files and QML types.
+ This should not be modifed while the engine is loading files, or URL
+ selection may be inconsistent.
+*/
+void QQmlEngine::setUrlInterceptor(QQmlAbstractUrlInterceptor *urlInterceptor)
+{
+ Q_D(QQmlEngine);
+ d->urlInterceptor = urlInterceptor;
+}
+
+/*!
+ \internal
+ This API is private for 5.1
+
+ Returns the current QQmlAbstractUrlInterceptor. It must not be modified outside
+ the GUI thread.
+*/
+QQmlAbstractUrlInterceptor *QQmlEngine::urlInterceptor() const
+{
+ Q_D(const QQmlEngine);
+ return d->urlInterceptor;
+}
+
+
+/*!
Sets the \a factory to use for creating QNetworkAccessManager(s).
QNetworkAccessManager is used for all network access by QML. By
@@ -1032,7 +1065,7 @@ QQmlImageProviderBase *QQmlEngine::imageProvider(const QString &providerId) cons
{
Q_D(const QQmlEngine);
QMutexLocker locker(&d->mutex);
- return d->imageProviders.value(providerId).data();
+ return d->imageProviders.value(providerId.toLower()).data();
}
/*!
@@ -1044,7 +1077,7 @@ void QQmlEngine::removeImageProvider(const QString &providerId)
{
Q_D(QQmlEngine);
QMutexLocker locker(&d->mutex);
- d->imageProviders.take(providerId);
+ d->imageProviders.take(providerId.toLower());
}
/*!
@@ -1246,11 +1279,13 @@ void QQmlEnginePrivate::doDeleteInEngineThread()
delete d;
}
-Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object)
+namespace QtQml {
+
+void qmlExecuteDeferred(QObject *object)
{
QQmlData *data = QQmlData::get(object);
- if (data && data->compiledData && data->deferredIdx) {
+ if (data && data->deferredData) {
QQmlObjectCreatingProfiler prof;
if (prof.enabled) {
QQmlType *type = QQmlMetaType::qmlType(object->metaObject());
@@ -1265,8 +1300,9 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object)
QQmlComponentPrivate::beginDeferred(ep, object, &state);
// Release the reference for the deferral action (we still have one from construction)
- data->compiledData->release();
- data->compiledData = 0;
+ data->deferredData->compiledData->release();
+ delete data->deferredData;
+ data->deferredData = 0;
QQmlComponentPrivate::complete(ep, &state);
}
@@ -1319,6 +1355,41 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create);
}
+} // namespace QtQml
+
+#if QT_DEPRECATED_SINCE(5, 1)
+
+// Also define symbols outside namespace to keep binary compatibility with Qt 5.0
+
+Q_QML_EXPORT void qmlExecuteDeferred(QObject *obj)
+{
+ QtQml::qmlExecuteDeferred(obj);
+}
+
+Q_QML_EXPORT QQmlContext *qmlContext(const QObject *obj)
+{
+ return QtQml::qmlContext(obj);
+}
+
+Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *obj)
+{
+ return QtQml::qmlEngine(obj);
+}
+
+Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int id, const QObject *obj, bool create)
+{
+ return QtQml::qmlAttachedPropertiesObjectById(id, obj, create);
+}
+
+Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
+ const QMetaObject *attachedMetaObject,
+ bool create)
+{
+ return QtQml::qmlAttachedPropertiesObject(idCache, object, attachedMetaObject, create);
+}
+
+#endif // QT_DEPRECATED_SINCE(5, 1)
+
QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning)
{
#ifndef QQML_NO_DEBUG_PROTOCOL
@@ -1472,6 +1543,12 @@ void QQmlData::destroyed(QObject *object)
compiledData = 0;
}
+ if (deferredData) {
+ deferredData->compiledData->release();
+ delete deferredData;
+ deferredData = 0;
+ }
+
QQmlAbstractBoundSignal *signalHandler = signalHandlers;
while (signalHandler) {
if (signalHandler->isEvaluating()) {
@@ -2150,7 +2227,7 @@ bool QQml_isFileCaseCorrect(const QString &fileName, int lengthIn /* = -1 */)
QFileInfo info(fileName);
const QString absolute = info.absoluteFilePath();
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
const QString canonical = info.canonicalFilePath();
#elif defined(Q_OS_WIN)
wchar_t buffer[1024];
diff --git a/src/qml/qml/qqmlengine.h b/src/qml/qml/qqmlengine.h
index 45826a4a67..ab25e06235 100644
--- a/src/qml/qml/qqmlengine.h
+++ b/src/qml/qml/qqmlengine.h
@@ -51,6 +51,7 @@
QT_BEGIN_NAMESPACE
+class QQmlAbstractUrlInterceptor;
class Q_QML_EXPORT QQmlImageProviderBase
{
@@ -119,6 +120,9 @@ public:
QNetworkAccessManager *networkAccessManager() const;
+ void setUrlInterceptor(QQmlAbstractUrlInterceptor* urlInterceptor);
+ QQmlAbstractUrlInterceptor* urlInterceptor() const;
+
void addImageProvider(const QString &id, QQmlImageProviderBase *);
QQmlImageProviderBase *imageProvider(const QString &id) const;
void removeImageProvider(const QString &id);
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index 62e4ee9e5d..b300dcc791 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -125,6 +125,9 @@ public:
~QQmlEnginePrivate();
void init();
+ // No mutex protecting baseModulesUninitialized, because use outside QQmlEngine
+ // is just qmlClearTypeRegistrations (which can't be called while an engine exists)
+ static bool baseModulesUninitialized;
class PropertyCapture {
public:
@@ -171,6 +174,8 @@ public:
QHash<QString,QSharedPointer<QQmlImageProviderBase> > imageProviders;
+ QQmlAbstractUrlInterceptor* urlInterceptor;
+
int scarceResourcesRefCount;
void referenceScarceResources();
void dereferenceScarceResources();
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index 88129b7240..0c8e46bd8d 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
^
\endcode
- Note that the QtQuick 1 version is named QDeclarativeError
+ Note that the \l {Qt Quick 1} version is named QDeclarativeError
\sa QQuickView::errors(), QQmlComponent::errors()
*/
@@ -84,10 +84,11 @@ public:
QString description;
quint16 line;
quint16 column;
+ QObject *object;
};
QQmlErrorPrivate::QQmlErrorPrivate()
-: line(0), column(0)
+: line(0), column(0), object()
{
}
@@ -122,6 +123,7 @@ QQmlError &QQmlError::operator=(const QQmlError &other)
d->description = other.d->description;
d->line = other.d->line;
d->column = other.d->column;
+ d->object = other.d->object;
}
return *this;
}
@@ -215,6 +217,27 @@ void QQmlError::setColumn(int column)
}
/*!
+ Returns the nearest object where this error occurred.
+ Exceptions in bound property expressions set this to the object
+ to which the property belongs. It will be 0 for all
+ other exceptions.
+ */
+QObject *QQmlError::object() const
+{
+ if (d) return d->object;
+ else return 0;
+}
+
+/*!
+ Sets the nearest \a object where this error occurred.
+ */
+void QQmlError::setObject(QObject *object)
+{
+ if (!d) d = new QQmlErrorPrivate;
+ d->object = object;
+}
+
+/*!
Returns the error as a human readable string.
*/
QString QQmlError::toString() const
diff --git a/src/qml/qml/qqmlerror.h b/src/qml/qml/qqmlerror.h
index feb13d68d7..e69b3c15ba 100644
--- a/src/qml/qml/qqmlerror.h
+++ b/src/qml/qml/qqmlerror.h
@@ -69,6 +69,8 @@ public:
void setLine(int);
int column() const;
void setColumn(int);
+ QObject *object() const;
+ void setObject(QObject *);
QString toString() const;
private:
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index da66477a03..ddebf02c6c 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -122,7 +122,7 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr,
int result = expr->evaluate().toInt(); // result = 400
\endcode
- Note that the QtQuick 1 version is called QDeclarativeExpression.
+ Note that the \l {Qt Quick 1} version is called QDeclarativeExpression.
*/
/*!
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp
index edef5a91cd..f77b176404 100644
--- a/src/qml/qml/qqmlextensionplugin.cpp
+++ b/src/qml/qml/qqmlextensionplugin.cpp
@@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE
QQmlExtensionPlugin is a plugin interface that makes it possible to
create QML extensions that can be loaded dynamically into QML applications.
- These extensions allow custom QML types to be made available to the QML engine.
-
+ These extensions allow custom QML types to be made available to the QML engine.
+
To write a QML extension plugin:
-
+
\list
\li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types
using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro
@@ -74,10 +74,10 @@ QT_BEGIN_NAMESPACE
\section1 An example
Suppose there is a new \c TimeModel C++ class that should be made available
- as a new QML element. It provides the current time through \c hour and \c minute
+ as a new QML element. It provides the current time through \c hour and \c minute
properties, like this:
- \snippet qml/plugins/plugin.cpp 0
+ \snippet plugins/plugin.cpp 0
\dots
To make this class available as a QML type, create a plugin that registers
@@ -85,13 +85,13 @@ QT_BEGIN_NAMESPACE
module will be named \c TimeExample (as defined in the project
file further below).
- \snippet qml/plugins/plugin.cpp plugin
+ \snippet plugins/plugin.cpp plugin
- This registers the \c TimeModel class with the 1.0 version of this
- plugin library, as a QML type called \c Time. The Q_ASSERT statement
+ This registers the \c TimeModel class with the 1.0 version of this
+ plugin library, as a QML type called \c Time. The Q_ASSERT statement
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
+ The project file defines the project as a plugin library and specifies
it should be built into the \c imports/TimeExample directory:
\code
@@ -102,26 +102,26 @@ QT_BEGIN_NAMESPACE
DESTDIR = imports/TimeExample
TARGET = qmlqtimeexampleplugin
...
- \endcode
+ \endcode
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 qml/plugins/imports/TimeExample/qmldir
+ \quotefile plugins/imports/TimeExample/qmldir
- Once the project is built and installed, the new \c Time element can be
+ Once the project is built and installed, the new \c Time element can be
used by any QML component that imports the \c TimeExample module:
- \snippet qml/plugins/plugins.qml 0
+ \snippet plugins/plugins.qml 0
The full source code is available in the \l {qml/plugins}{plugins example}.
The \l {Writing QML Extensions with C++} tutorial also contains a chapter
on creating QML plugins.
- Note that the QtQuick 1 version is called QDeclarativeExtensionPlugin.
+ Note that the \l {Qt Quick 1} version is called QDeclarativeExtensionPlugin.
\sa QQmlEngine::importPlugin(), {How to Create Qt Plugins}
*/
@@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE
plugin.
The \a uri is an identifier for the plugin generated by the QML engine
- based on the name and path of the extension's plugin library.
+ based on the name and path of the extension's plugin library.
*/
/*!
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h
index c9eec4c23b..0c9e685a07 100644
--- a/src/qml/qml/qqmlglobal_p.h
+++ b/src/qml/qml/qqmlglobal_p.h
@@ -317,7 +317,7 @@ class QQmlApplicationPrivate;
class Q_QML_PRIVATE_EXPORT QQmlApplication : public QObject
{
- //Application level logic, subclassed by QtQuick if available via QQmlGuiProvider
+ //Application level logic, subclassed by Qt Quick if available via QQmlGuiProvider
Q_OBJECT
Q_PROPERTY(QStringList arguments READ args CONSTANT)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
@@ -344,8 +344,8 @@ protected:
QQmlApplication(QQmlApplicationPrivate &dd, QObject* parent=0);
private:
- Q_DISABLE_COPY(QQmlApplication);
- Q_DECLARE_PRIVATE(QQmlApplication);
+ Q_DISABLE_COPY(QQmlApplication)
+ Q_DECLARE_PRIVATE(QQmlApplication)
};
class QQmlApplicationPrivate : public QObjectPrivate
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index f793ca9604..50b2c8af0d 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -163,6 +163,14 @@ QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeNa
typedef QMap<QString, QString> StringStringMap;
Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri
+void qmlClearEnginePlugins()
+{
+ foreach (const QString &s, qmlEnginePluginsWithRegisteredTypes()->values()) {
+ QPluginLoader loader(s);
+ loader.unload(); // ### Always returns false, worth doing?
+ }
+ qmlEnginePluginsWithRegisteredTypes()->clear();
+}
class QQmlImportNamespace
{
@@ -1455,7 +1463,7 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
const QString &qmldirPath, const QString &qmldirPluginPath,
const QString &baseName)
{
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName,
QStringList()
# ifdef QT_DEBUG
diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h
index 140ca6695e..06b50c09e9 100644
--- a/src/qml/qml/qqmlimport_p.h
+++ b/src/qml/qml/qqmlimport_p.h
@@ -182,6 +182,8 @@ private:
QQmlEngine *engine;
};
+void qmlClearEnginePlugins();// For internal use by qmlClearRegisteredProperties
+
QT_END_NAMESPACE
#endif // QQMLIMPORT_P_H
diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp
index 66670e2658..32f0eeef36 100644
--- a/src/qml/qml/qqmlinfo.cpp
+++ b/src/qml/qml/qqmlinfo.cpp
@@ -165,6 +165,8 @@ QQmlInfo::~QQmlInfo()
}
}
+namespace QtQml {
+
QQmlInfo qmlInfo(const QObject *me)
{
QQmlInfoPrivate *d = new QQmlInfoPrivate;
@@ -188,5 +190,27 @@ QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors)
return QQmlInfo(d);
}
+} // namespace QtQml
+
+#if QT_DEPRECATED_SINCE(5, 1)
+
+// Also define symbols outside namespace to keep binary compatibility with Qt 5.0
+
+QQmlInfo qmlInfo(const QObject *me)
+{
+ return QtQml::qmlInfo(me);
+}
+
+QQmlInfo qmlInfo(const QObject *me, const QQmlError &error)
+{
+ return QtQml::qmlInfo(me, error);
+}
+
+QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors)
+{
+ return QtQml::qmlInfo(me, errors);
+}
+
+#endif // QT_DEPRECATED_SINCE(5, 1)
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlinfo.h b/src/qml/qml/qqmlinfo.h
index 16fca9428e..56ac788624 100644
--- a/src/qml/qml/qqmlinfo.h
+++ b/src/qml/qml/qqmlinfo.h
@@ -48,6 +48,15 @@
QT_BEGIN_NAMESPACE
+class QQmlInfo;
+
+namespace QtQml {
+ // declared in namespace to avoid symbol conflicts with QtDeclarative
+ Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
+ Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
+ Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
+}
+using namespace QtQml;
class QQmlInfoPrivate;
class Q_QML_EXPORT QQmlInfo : public QDebug
@@ -82,18 +91,14 @@ public:
#endif
private:
- friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
- friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
- friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QQmlError &error);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QList<QQmlError> &errors);
QQmlInfo(QQmlInfoPrivate *);
QQmlInfoPrivate *d;
};
-Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
-Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
-Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
-
QT_END_NAMESPACE
#endif // QQMLINFO_H
diff --git a/src/qml/qml/qqmlinstruction.cpp b/src/qml/qml/qqmlinstruction.cpp
index c5a4e5d15c..626140d99d 100644
--- a/src/qml/qml/qqmlinstruction.cpp
+++ b/src/qml/qml/qqmlinstruction.cpp
@@ -58,7 +58,7 @@ void QQmlCompiledData::dump(QQmlInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
break;
case QQmlInstruction::DeferInit:
- qWarning().nospace() << idx << "\t\t" << "DEFER_INIT\t\t" << instr->deferInit.bindingsSize << "\t" << instr->deferInit.parserStatusSize;
+ qWarning().nospace() << idx << "\t\t" << "DEFER_INIT\t\t" << instr->deferInit.bindingsSize << "\t" << instr->deferInit.parserStatusSize << "\t" << instr->deferInit.objectStackSize << "\t" << instr->deferInit.listStackSize;
break;
case QQmlInstruction::Done:
qWarning().nospace() << idx << "\t\t" << "DONE";
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 2be4c57db4..3b3227cbbb 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -78,6 +78,11 @@ void QQmlDelayedError::setErrorDescription(const QString &description)
m_error.setDescription(description);
}
+void QQmlDelayedError::setErrorObject(QObject *object)
+{
+ m_error.setObject(object);
+}
+
void QQmlDelayedError::setError(const QV4::Exception &e)
{
m_error.setDescription(e.value().toQString());
@@ -340,6 +345,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope,
error.setLine(line);
if (error.url().isEmpty())
error.setUrl(QUrl::fromLocalFile(filename));
+ error.setObject(scope);
ep->warning(error);
return QV4::PersistentValue();
}
@@ -374,6 +380,7 @@ QV4::PersistentValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt,
error.setLine(line);
if (error.url().isEmpty())
error.setUrl(QUrl::fromLocalFile(filename));
+ error.setObject(scope);
ep->warning(error);
return QV4::PersistentValue();
}
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index 77f8304e95..2e674b214a 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -82,6 +82,7 @@ public:
void setErrorLocation(const QUrl &url, quint16 line, quint16 column);
void setErrorDescription(const QString &description);
+ void setErrorObject(QObject *object);
void setError(const QV4::Exception &e);
diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp
index e6913f01a8..91c9bc2416 100644
--- a/src/qml/qml/qqmllist.cpp
+++ b/src/qml/qml/qqmllist.cpp
@@ -112,7 +112,7 @@ Attempting to add objects of the incorrect type to a list property will fail.
Like with normal lists, when accessing a list element by index, it is the callers responsibility to ensure
that it does not request an out of range element using the count() method before calling at().
-The QtQuick 1 version of this class is named QDeclarativeListReference.
+The \l {Qt Quick 1} version of this class is named QDeclarativeListReference.
*/
/*!
@@ -369,7 +369,7 @@ Q_PROPERTY(QQmlListProperty<Fruit> fruit READ fruit);
QML list properties are typesafe - in this case \c {Fruit} is a QObject type that
\c {Apple}, \c {Orange} and \c {Banana} all derive from.
-The QtQuick 1 version of this class is named QDeclarativeListProperty.
+The \l {Qt Quick 1} version of this class is named QDeclarativeListProperty.
\note QQmlListProperty can only be used for lists of QObject-derived object pointers.
*/
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 32e717ed72..58ef5d0930 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -708,13 +708,13 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
/*!
\qmltype Locale
\instantiates QQmlLocale
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief Provides locale specific properties and formatted data
- The Locale object may only be created via the \l{QML:Qt::locale()}{Qt.locale()} function.
+ The Locale object may only be created via the \l{QtQml2::Qt::locale()}{Qt.locale()} function.
It cannot be created directly.
- The \l{QML:Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the
+ The \l{QtQml2::Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the
locale with the specified name, which has the format
"language[_territory][.codeset][@modifier]" or "C".
@@ -751,7 +751,7 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
}
\endcode
- QtQuick Locale's data is based on Common Locale Data Repository v1.8.1.
+ Qt Quick Locale's data is based on Common Locale Data Repository v1.8.1.
\target FormatType
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index dbb397462f..b7138e01b3 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -46,6 +46,7 @@
#include <private/qqmlcustomparser_p.h>
#include <private/qqmlguard_p.h>
#include <private/qhashedstring_p.h>
+#include <private/qqmlimport_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
@@ -585,16 +586,18 @@ void QQmlTypePrivate::init() const
while(mo) {
QQmlType *t = metaTypeData()->metaObjectToType.value(mo);
if (t) {
- if (t->d->extraData.cd->extFunc) {
- QMetaObjectBuilder builder;
- clone(builder, t->d->extraData.cd->extMetaObject, t->d->baseMetaObject, baseMetaObject);
- builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
- QMetaObject *mmo = builder.toMetaObject();
- mmo->d.superdata = baseMetaObject;
- if (!metaObjects.isEmpty())
- metaObjects.last().metaObject->d.superdata = mmo;
- QQmlProxyMetaObject::ProxyData data = { mmo, t->d->extraData.cd->extFunc, 0, 0 };
- metaObjects << data;
+ if (t->d->regType == QQmlType::CppType) {
+ if (t->d->extraData.cd->extFunc) {
+ QMetaObjectBuilder builder;
+ clone(builder, t->d->extraData.cd->extMetaObject, t->d->baseMetaObject, baseMetaObject);
+ builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
+ QMetaObject *mmo = builder.toMetaObject();
+ mmo->d.superdata = baseMetaObject;
+ if (!metaObjects.isEmpty())
+ metaObjects.last().metaObject->d.superdata = mmo;
+ QQmlProxyMetaObject::ProxyData data = { mmo, t->d->extraData.cd->extFunc, 0, 0 };
+ metaObjects << data;
+ }
}
}
mo = mo->d.superdata;
@@ -1069,6 +1072,29 @@ QQmlType *QQmlTypeModuleVersion::type(const QHashedV4String &name) const
else return 0;
}
+void qmlClearTypeRegistrations() // Declared in qqml.h
+{
+ //Only cleans global static, assumed no running engine
+ QWriteLocker lock(metaTypeDataLock());
+ QQmlMetaTypeData *data = metaTypeData();
+
+ for (int i = 0; i < data->types.count(); ++i)
+ delete data->types.at(i);
+
+ QQmlMetaTypeData::TypeModules::const_iterator i = data->uriToModule.constBegin();
+ for (; i != data->uriToModule.constEnd(); ++i)
+ delete *i;
+
+ data->types.clear();
+ data->idToType.clear();
+ data->nameToType.clear();
+ data->urlToType.clear();
+ data->metaObjectToType.clear();
+ data->uriToModule.clear();
+
+ QQmlEnginePrivate::baseModulesUninitialized = true; //So the engine re-registers its types
+ qmlClearEnginePlugins();
+}
int registerAutoParentFunction(QQmlPrivate::RegisterAutoParent &autoparent)
{
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index 5f3d115d5f..26fba2b2fc 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -231,6 +231,7 @@ private:
friend int registerSingletonType(const QQmlPrivate::RegisterSingletonType &);
friend int registerInterface(const QQmlPrivate::RegisterInterface &);
friend int registerCompositeType(const QQmlPrivate::RegisterCompositeType &);
+ friend Q_QML_EXPORT void qmlClearTypeRegistrations();
QQmlType(int, const QQmlPrivate::RegisterInterface &);
QQmlType(int, const QString &, const QQmlPrivate::RegisterSingletonType &);
QQmlType(int, const QString &, const QQmlPrivate::RegisterType &);
@@ -259,6 +260,7 @@ private:
//Used by register functions and creates the QQmlTypeModule for them
friend void addTypeToData(QQmlType* type, QQmlMetaTypeData *data);
friend struct QQmlMetaTypeData;
+ friend Q_QML_EXPORT void qmlClearTypeRegistrations();
QQmlTypeModule();
~QQmlTypeModule();
diff --git a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
index 156c341158..b0271b11f2 100644
--- a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
+++ b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
For more information about signals and threads, see
\l {Threads and QObjects} and \l {Signals and Slots Across Threads}.
- The QtQuick 1 version of this class is named QDeclarativeNetworkAccessManagerFactory.
+ The \l {Qt Quick 1} version of this class is named QDeclarativeNetworkAccessManagerFactory.
\sa {qml/networkaccessmanagerfactory}{NetworkAccessManagerFactory example}
*/
diff --git a/src/qml/qml/qqmlparserstatus.cpp b/src/qml/qml/qqmlparserstatus.cpp
index 452a8d7eb8..41b7d962ce 100644
--- a/src/qml/qml/qqmlparserstatus.cpp
+++ b/src/qml/qml/qqmlparserstatus.cpp
@@ -84,7 +84,7 @@ QT_BEGIN_NAMESPACE
}
\endcode
- The QtQuick 1.0 version of this class is named QDeclarativeParserStatus.
+ The \l {Qt Quick 1} version of this class is named QDeclarativeParserStatus.
*/
/*! \internal */
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index 570435ae81..b5b11d2c6a 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -253,7 +253,7 @@ namespace QQmlPrivate
};
struct RegisterCompositeType {
- const QUrl &url;
+ QUrl url;
const char *uri;
int versionMajor;
int versionMinor;
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index cb3866a0dc..d1ecfdc52d 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -113,7 +113,7 @@ property.write(24);
qWarning() << "Pixel size should now be 24:" << property.read().toInt();
\endcode
-The QtQuick 1 version of this class was named QDeclarativeProperty.
+The \l {Qt Quick 1} version of this class was named QDeclarativeProperty.
*/
/*!
@@ -1531,6 +1531,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
// we explicitly disallow this case to avoid confusion. Users can still store one
// in an array in a var property if they need to, but the common case is user error.
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
+ expression->delayedError()->setErrorObject(object);
return false;
}
@@ -1546,6 +1547,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
QV4::FunctionObject *f = result.asFunctionObject();
if (f && f->bindingKeyFlag) {
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
+ expression->delayedError()->setErrorObject(object);
return false;
}
writeValueProperty(object, core, QVariant::fromValue(
@@ -1558,12 +1560,14 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
else
errorStr += QLatin1String(QMetaType::typeName(type));
expression->delayedError()->setErrorDescription(errorStr);
+ expression->delayedError()->setErrorObject(object);
return false;
} else if (QV4::FunctionObject *f = result.asFunctionObject()) {
if (f->bindingKeyFlag)
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
else
expression->delayedError()->setErrorDescription(QLatin1String("Unable to assign a function to a property of any type other than var."));
+ expression->delayedError()->setErrorObject(object);
return false;
} else if (!writeValueProperty(object, core, value, context, flags)) {
@@ -1596,6 +1600,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
QLatin1String(valueType) +
QLatin1String(" to ") +
QLatin1String(propertyType));
+ expression->delayedError()->setErrorObject(object);
return false;
}
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 7846081a4a..08005f1df2 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1318,25 +1318,10 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
Q_ASSERT(metaObject);
QQmlPropertyData rv;
- {
- const QMetaObject *cmo = metaObject;
- const QByteArray propertyName = property.toUtf8();
- while (cmo) {
- int idx = cmo->indexOfProperty(propertyName);
- if (idx != -1) {
- QMetaProperty p = cmo->property(idx);
- if (p.isScriptable()) {
- rv.load(p);
- return rv;
- } else {
- while (cmo && cmo->propertyOffset() >= idx)
- cmo = cmo->superClass();
- }
- } else {
- cmo = 0;
- }
- }
- }
+
+ /* It's important to check the method list before checking for properties;
+ * otherwise, if the meta object is dynamic, a property will be created even
+ * if not found and it might obscure a method having the same name. */
//Used to block access to QObject::destroyed() and QObject::deleteLater() from QML
static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
@@ -1358,6 +1343,31 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
}
}
+ {
+ const QMetaObject *cmo = metaObject;
+ const QByteArray propertyName = property.toUtf8();
+ while (cmo) {
+ int idx = cmo->indexOfProperty(propertyName);
+ if (idx != -1) {
+ QMetaProperty p = cmo->property(idx);
+ if (p.isScriptable()) {
+ rv.load(p);
+ return rv;
+ } else {
+ bool changed = false;
+ while (cmo && cmo->propertyOffset() >= idx) {
+ cmo = cmo->superClass();
+ changed = true;
+ }
+ /* If the "cmo" variable didn't change, set it to 0 to
+ * avoid running into an infinite loop */
+ if (!changed) cmo = 0;
+ }
+ } else {
+ cmo = 0;
+ }
+ }
+ }
return rv;
}
@@ -1396,7 +1406,8 @@ qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, const T &name,
if (cache) {
rv = cache->property(name, obj, context);
- } else {
+ }
+ if (!rv) {
local = qQmlPropertyCacheCreate(obj->metaObject(), qQmlPropertyCacheToString(name));
if (local.isValid())
rv = &local;
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 80c7ebf66a..737b39c199 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -215,7 +215,7 @@ private:
friend class QQmlPropertyCache;
quint32 flags;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlPropertyRawData::Flags);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlPropertyRawData::Flags)
class QQmlPropertyData : public QQmlPropertyRawData
{
diff --git a/src/qml/qml/qqmlscript.cpp b/src/qml/qml/qqmlscript.cpp
index c24891f6d6..7e3a23b489 100644
--- a/src/qml/qml/qqmlscript.cpp
+++ b/src/qml/qml/qqmlscript.cpp
@@ -1317,13 +1317,15 @@ bool QQmlScript::Parser::parse(const QString &qmlcode, const QByteArray & /* pre
QQmlJS::Parser parser(&data->engine);
- if (! parser.parse() || !_errors.isEmpty()) {
+ if (! parser.parse() || !parser.diagnosticMessages().isEmpty()) {
// Extract errors from the parser
foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) {
- if (m.isWarning())
+ if (m.isWarning()) {
+ qWarning("%s:%d : %s", qPrintable(_scriptFile), m.loc.startLine, qPrintable(m.message));
continue;
+ }
QQmlError error;
error.setUrl(url);
diff --git a/src/qml/qml/qqmlscript_p.h b/src/qml/qml/qqmlscript_p.h
index 54e7a67b65..250c71d6ac 100644
--- a/src/qml/qml/qqmlscript_p.h
+++ b/src/qml/qml/qqmlscript_p.h
@@ -512,7 +512,7 @@ public:
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlScript::Object::ScriptBlock::Pragmas);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlScript::Object::ScriptBlock::Pragmas)
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index c91fc06c22..022083c596 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qqmltypeloader_p.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
@@ -250,6 +251,23 @@ QQmlDataBlob::~QQmlDataBlob()
}
/*!
+ Sets the manager, and does stuff like selection which needs access to the manager.
+ Must be called before loading can occur.
+*/
+void QQmlDataBlob::startLoading(QQmlDataLoader *manager)
+{
+ Q_ASSERT(status() == QQmlDataBlob::Null);
+ Q_ASSERT(m_manager == 0);
+ m_data.setStatus(QQmlDataBlob::Loading);
+ m_manager = manager;
+
+ //Set here because we need to get the engine from the manager
+ if (manager && manager->engine() && manager->engine()->urlInterceptor())
+ m_url = manager->engine()->urlInterceptor()->intercept(m_url,
+ (QQmlAbstractUrlInterceptor::DataType)m_type);
+}
+
+/*!
Returns the type provided to the constructor.
*/
QQmlDataBlob::Type QQmlDataBlob::type() const
@@ -892,12 +910,7 @@ void QQmlDataLoader::load(QQmlDataBlob *blob, Mode mode)
qWarning("QQmlDataLoader::load(%s): %s thread", qPrintable(blob->m_url.toString()),
m_thread->isThisThread()?"Compile":"Engine");
#endif
-
- Q_ASSERT(blob->status() == QQmlDataBlob::Null);
- Q_ASSERT(blob->m_manager == 0);
-
- blob->m_data.setStatus(QQmlDataBlob::Loading);
- blob->m_manager = this;
+ blob->startLoading(this);
if (m_thread->isThisThread()) {
unlock();
@@ -930,11 +943,7 @@ void QQmlDataLoader::loadWithStaticData(QQmlDataBlob *blob, const QByteArray &da
m_thread->isThisThread()?"Compile":"Engine");
#endif
- Q_ASSERT(blob->status() == QQmlDataBlob::Null);
- Q_ASSERT(blob->m_manager == 0);
-
- blob->m_data.setStatus(QQmlDataBlob::Loading);
- blob->m_manager = this;
+ blob->startLoading(this);
if (m_thread->isThisThread()) {
unlock();
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index ee6773b8e7..88bca702db 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -67,6 +67,7 @@
#include <private/qqmldirparser_p.h>
#include <private/qqmlbundle_p.h>
#include <private/qflagpointer_p.h>
+#include <private/qqmlabstracturlinterceptor_p.h>
#include <private/qv4value_p.h>
#include <private/qv4script_p.h>
@@ -94,15 +95,17 @@ public:
Error // Error
};
- enum Type {
- QmlFile,
- JavaScriptFile,
- QmldirFile
+ enum Type { //Matched in QQmlAbstractUrlInterceptor
+ QmlFile = QQmlAbstractUrlInterceptor::QmlFile,
+ JavaScriptFile = QQmlAbstractUrlInterceptor::JavaScriptFile,
+ QmldirFile = QQmlAbstractUrlInterceptor::QmldirFile
};
QQmlDataBlob(const QUrl &, Type);
virtual ~QQmlDataBlob();
+ void startLoading(QQmlDataLoader* manager);
+
Type type() const;
Status status() const;
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 309275777e..cde16e885d 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -47,6 +47,7 @@
#include <private/qmetaobjectbuilder_p.h>
#include "qqmldata_p.h"
#include "qqml.h"
+#include "qqmlinfo.h"
#include "qqmlcustomparser_p.h"
#include "qqmlengine.h"
#include "qqmlcontext.h"
@@ -91,6 +92,8 @@ using namespace QQmlVMETypes;
goto exceptionExit; \
}
+bool QQmlVME::s_enableComponentComplete = true;
+
void QQmlVME::init(QQmlContextData *ctxt, QQmlCompiledData *comp, int start,
QQmlContextData *creation)
{
@@ -132,12 +135,12 @@ bool QQmlVME::initDeferred(QObject *object)
{
QQmlData *data = QQmlData::get(object);
- if (!data || !data->context || !data->compiledData)
+ if (!data || !data->deferredData)
return false;
- QQmlContextData *ctxt = data->context;
- QQmlCompiledData *comp = data->compiledData;
- int start = data->deferredIdx;
+ QQmlContextData *ctxt = data->deferredData->context;
+ QQmlCompiledData *comp = data->deferredData->compiledData;
+ int start = data->deferredData->deferredIdx;
State initState;
initState.flags = State::Deferred;
@@ -949,10 +952,19 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
if (instr.deferCount) {
QObject *target = objects.top();
QQmlData *data = QQmlData::get(target, true);
- data->compiledData = COMP;
- data->compiledData->addref(); // Keep this data referenced until we're initialized
- data->deferredIdx = INSTRUCTIONSTREAM - COMP->bytecode.constData();
- Q_ASSERT(data->deferredIdx != 0);
+ if (data->deferredData) {
+ //This rare case still won't always work right
+ qmlInfo(target) << "Setting deferred property across multiple components may not work";
+ delete data->deferredData;
+ }
+ data->deferredData = new QQmlData::DeferredData;
+ //If we're in a CreateQML here, data->compiledData could be reset later
+ data->deferredData->compiledData = COMP;
+ data->deferredData->context = CTXT;
+ // Keep this data referenced until we're initialized
+ data->deferredData->compiledData->addref();
+ data->deferredData->deferredIdx = INSTRUCTIONSTREAM - COMP->bytecode.constData();
+ Q_ASSERT(data->deferredData->deferredIdx != 0);
INSTRUCTIONSTREAM += instr.deferCount;
}
QML_END_INSTR(Defer)
@@ -1243,7 +1255,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
bindValues.deallocate();
}
- if (!QQmlEnginePrivate::designerMode()) { // the qml designer does the component complete later
+ if (componentCompleteEnabled()) { // the qml designer does the component complete later
QQmlTrace trace("VME Component Complete");
while (!parserStatus.isEmpty()) {
QQmlParserStatus *status = parserStatus.pop();
@@ -1291,7 +1303,8 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
Q_ASSERT(d);
Q_ASSERT(d->context);
a->add(&d->context->componentAttached);
- emit a->completed();
+ if (componentCompleteEnabled())
+ emit a->completed();
if (watcher.hasRecursed() || interrupt.shouldInterrupt())
return 0;
@@ -1307,6 +1320,21 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
return rv;
}
+void QQmlVME::enableComponentComplete()
+{
+ s_enableComponentComplete = true;
+}
+
+void QQmlVME::disableComponentComplete()
+{
+ s_enableComponentComplete = false;
+}
+
+bool QQmlVME::componentCompleteEnabled()
+{
+ return s_enableComponentComplete;
+}
+
void QQmlVME::blank(QFiniteStack<QQmlAbstractBinding *> &bs)
{
for (int ii = 0; ii < bs.count(); ++ii) {
@@ -1368,7 +1396,7 @@ bool QQmlVMEGuard::isOK() const
return false;
for (int ii = 0; ii < m_contextCount; ++ii)
- if (m_contexts[ii].isNull())
+ if (m_contexts[ii].isNull() || !m_contexts[ii]->engine)
return false;
return true;
diff --git a/src/qml/qml/qqmlvme_p.h b/src/qml/qml/qqmlvme_p.h
index 863a7a3c6b..750076f277 100644
--- a/src/qml/qml/qqmlvme_p.h
+++ b/src/qml/qml/qqmlvme_p.h
@@ -139,6 +139,10 @@ public:
QObject *execute(QList<QQmlError> *errors, const Interrupt & = Interrupt());
QQmlContextData *complete(const Interrupt & = Interrupt());
+ static void enableComponentComplete();
+ static void disableComponentComplete();
+ static bool componentCompleteEnabled();
+
private:
friend class QQmlVMEGuard;
@@ -178,6 +182,8 @@ private:
static void blank(QFiniteStack<QQmlParserStatus *> &);
static void blank(QFiniteStack<QQmlAbstractBinding *> &);
+
+ static bool s_enableComponentComplete;
};
// Used to check that a QQmlVME that is interrupted mid-execution
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 46f9237727..162f3dbd22 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -1046,6 +1046,7 @@ private:
int m_status;
QString m_statusText;
QNetworkRequest m_request;
+ QStringList m_addedHeaders;
QQmlGuard<QNetworkReply> m_network;
void destroyNetwork();
@@ -1100,6 +1101,7 @@ Value QQmlXMLHttpRequest::open(const Value &me, const QString &method,
m_method = method;
m_url = url;
m_state = Opened;
+ m_addedHeaders.clear();
dispatchCallback(me);
return Value::undefinedValue();
}
@@ -1108,10 +1110,11 @@ void QQmlXMLHttpRequest::addHeader(const QString &name, const QString &value)
{
QByteArray utfname = name.toUtf8();
- if (m_request.hasRawHeader(utfname)) {
+ if (m_addedHeaders.contains(name, Qt::CaseInsensitive)) {
m_request.setRawHeader(utfname, m_request.rawHeader(utfname) + ',' + value.toUtf8());
} else {
m_request.setRawHeader(utfname, value.toUtf8());
+ m_addedHeaders.append(name);
}
}
diff --git a/src/qml/qml/v4/qv4jsonobject_p.h b/src/qml/qml/v4/qv4jsonobject_p.h
index 4225f4c4ae..465539e504 100644
--- a/src/qml/qml/v4/qv4jsonobject_p.h
+++ b/src/qml/qml/v4/qv4jsonobject_p.h
@@ -74,6 +74,7 @@ private:
static QJsonValue toJsonValue(const QV4::Value &value, V4ObjectSet &visitedObjects);
static QJsonObject toJsonObject(QV4::Object *o, V4ObjectSet &visitedObjects);
static QJsonArray toJsonArray(QV4::ArrayObject *a, V4ObjectSet &visitedObjects);
+
};
}
diff --git a/src/qml/qml/v4/qv4qobjectwrapper.cpp b/src/qml/qml/v4/qv4qobjectwrapper.cpp
index 42b057c48d..a267c4a894 100644
--- a/src/qml/qml/v4/qv4qobjectwrapper.cpp
+++ b/src/qml/qml/v4/qv4qobjectwrapper.cpp
@@ -266,10 +266,12 @@ QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QQmlCont
QQmlData *ddata = QQmlData::get(m_object, false);
if (!ddata)
return 0;
+ QQmlPropertyData *result = 0;
if (ddata && ddata->propertyCache)
- return ddata->propertyCache->property(propertystring, m_object, qmlContext);
- else
- return QQmlPropertyCache::property(engine->v8Engine->engine(), m_object, propertystring, qmlContext, *local);
+ result = ddata->propertyCache->property(propertystring, m_object, qmlContext);
+ if (!result)
+ result = QQmlPropertyCache::property(engine->v8Engine->engine(), m_object, propertystring, qmlContext, *local);
+ return result;
}
Value QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, String *name, QObjectWrapper::RevisionMode revisionMode, bool *hasProperty, bool includeImports)
@@ -1078,7 +1080,7 @@ static QV4::Value CallMethod(QObject *object, int index, int returnType, int arg
Returns the match score for converting \a actual to be of type \a conversionType. A
zero score means "perfect match" whereas a higher score is worse.
- The conversion table is copied out of the QtScript callQtMethod() function.
+ The conversion table is copied out of the \l QScript::callQtMethod() function.
*/
static int MatchScore(const QV4::Value &actual, int conversionType)
{
diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp
index 24d46277e9..13281875e6 100644
--- a/src/qml/qml/v8/qjsengine.cpp
+++ b/src/qml/qml/v8/qjsengine.cpp
@@ -198,6 +198,10 @@ QJSEngine::QJSEngine(QJSEnginePrivate &dd, QObject *parent)
/*!
Destroys this QJSEngine.
+
+ Garbage is not collected from the persistent JS heap during QJSEngine
+ destruction. If you need all memory freed, call collectGarbage manually
+ right before destroying the QJSEngine.
*/
QJSEngine::~QJSEngine()
{
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 7c7ac124f0..97736355d4 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -612,7 +612,7 @@ to \c format.
The \a date parameter may be a JavaScript \c Date object, a \l{date}{date}
property, a QDate, or QDateTime value. The \a format parameter may be any of
the possible format values as described for
-\l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+\l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
If \a format is not specified, \a date is formatted using
\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}.
@@ -655,7 +655,7 @@ Returns a string representation of \c time, optionally formatted according to
The \a time parameter may be a JavaScript \c Date object, a QTime, or QDateTime
value. The \a format parameter may be any of the possible format values as
-described for \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+described for \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
If \a format is not specified, \a time is formatted using
\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}.
@@ -773,7 +773,7 @@ For example, if the following date/time value was specified:
\endcode
This \a dateTime value could be passed to \c Qt.formatDateTime(),
-\l {QML:Qt::formatDate()}{Qt.formatDate()} or \l {QML:Qt::formatTime()}{Qt.formatTime()}
+\l {QtQml2::Qt::formatDate()}{Qt.formatDate()} or \l {QtQml2::Qt::formatTime()}{Qt.formatTime()}
with the \a format values below to produce the following results:
\table
@@ -934,7 +934,7 @@ Example (where \c parentItem is the id of an existing QML item):
\snippet qml/createQmlObject.qml 0
-In the case of an error, a QtScript Error object is thrown. This object has an additional property,
+In the case of an error, a \l {Qt Script} Error object is thrown. This object has an additional property,
\c qmlErrors, which is an array of the errors encountered.
Each object in this array has the members \c lineNumber, \c columnNumber, \c fileName and \c message.
For example, if the above snippet had misspelled color as 'colro' then the array would contain an object like the following:
@@ -942,7 +942,7 @@ For example, if the above snippet had misspelled color as 'colro' then the array
Note that this function returns immediately, and therefore may not work if
the \a qml string loads new components (that is, external QML files that have not yet been loaded).
-If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead.
+If this is the case, consider using \l{QtQml2::Qt::createComponent()}{Qt.createComponent()} instead.
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
*/
@@ -1070,7 +1070,7 @@ For example:
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
To create a QML object from an arbitrary string of QML (instead of a file),
-use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}.
+use \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}.
*/
Value QtObject::method_createComponent(SimpleCallContext *ctx)
{
@@ -1243,9 +1243,9 @@ DEFINE_MANAGED_VTABLE(BindingFunction);
\snippet qml/qtBinding.4.qml 0
- Note: in QtQuick 1.x, all function assignment was treated as
+ \note In \l {Qt Quick 1}, all function assignment was treated as
binding assignment, so the Qt.binding() function is new in
- QtQuick 2.0.
+ \l {Qt Quick}{Qt Quick 2}.
\since QtQuick 2.0
*/
@@ -1613,7 +1613,7 @@ void QV4::GlobalExtensions::init(QQmlEngine *qmlEngine, Object *globalObject)
Example:
\snippet qml/qsTranslate.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTranslate(SimpleCallContext *ctx)
{
@@ -1669,7 +1669,7 @@ Value GlobalExtensions::method_qsTranslate(SimpleCallContext *ctx)
Example:
\snippet qml/qtTranslateNoOp.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTranslateNoOp(SimpleCallContext *ctx)
{
@@ -1693,7 +1693,7 @@ Value GlobalExtensions::method_qsTranslateNoOp(SimpleCallContext *ctx)
Example:
\snippet qml/qsTr.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTr(SimpleCallContext *ctx)
{
@@ -1747,7 +1747,7 @@ Value GlobalExtensions::method_qsTr(SimpleCallContext *ctx)
Example:
\snippet qml/qtTrNoOp.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTrNoOp(SimpleCallContext *ctx)
{
@@ -1784,7 +1784,7 @@ Value GlobalExtensions::method_qsTrNoOp(SimpleCallContext *ctx)
Creating binary translation (QM) files suitable for use with this function requires passing
the \c -idbased option to the \c lrelease tool.
- \sa QT_TRID_NOOP, {Localization And Internationalization Support In Qt Quick}
+ \sa QT_TRID_NOOP, {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTrId(SimpleCallContext *ctx)
{
@@ -1816,7 +1816,7 @@ Value GlobalExtensions::method_qsTrId(SimpleCallContext *ctx)
Example:
\snippet qml/qtTrIdNoOp.qml 0
- \sa qsTrId(), {Localization And Internationalization Support In Qt Quick}
+ \sa qsTrId(), {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTrIdNoOp(SimpleCallContext *ctx)
{
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index fcb3079891..4c4e541e11 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -139,7 +139,7 @@ public:
If the binding target or binding property is changed, the bound value is
immediately pushed onto the new target.
- \sa QtQml
+ \sa {Qt QML}
*/
QQmlBind::QQmlBind(QObject *parent)
: QObject(*(new QQmlBindPrivate), parent)
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 286933e557..93df0842fe 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -126,7 +126,7 @@ public:
}
\endqml
- \sa QtQml
+ \sa {Qt QML}
*/
QQmlConnections::QQmlConnections(QObject *parent) :
QObject(*(new QQmlConnectionsPrivate), parent)
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index aa665e4283..afd2a49155 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -144,8 +144,9 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent)
The VisualDataModel type encapsulates a model and the delegate that will
be instantiated for items in a model.
- This type is provided by QtQuick 2 for compatibility reasons. The same implementation
- is now primarily available as DelegateModel in the QtQml.Models module.
+ This type is provided by the \l{Qt QML} module due to compatibility reasons.
+ The same implementation is now primarily available as DelegateModel in the
+ \l{Qt QML Models QML Types}{Qt QML Models} module.
\sa {QtQml.Models2::DelegateModel}
*/
@@ -158,9 +159,6 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent)
The DelegateModel type encapsulates a model and the delegate that will
be instantiated for items in the model.
- This element is also available as DelegateModel in the QtQuick module. For full details,
- see the \l DelegateModel documentation.
-
It is usually not necessary to create a DelegateModel.
However, it can be useful for manipulating and accessing the \l modelIndex
when a QAbstractItemModel subclass is used as the
@@ -170,7 +168,10 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent)
The example below illustrates using a DelegateModel with a ListView.
- \snippet qml/visualdatamodel.qml 0
+ \snippet delegatemodel/visualdatamodel.qml 0
+
+ \note This type is also available as \l VisualDataModel in the \l{Qt QML}
+ module due to compatibility reasons.
*/
QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt)
@@ -243,6 +244,8 @@ QQmlDelegateModel::~QQmlDelegateModel()
cacheItem->objectRef = 0;
if (!cacheItem->isReferenced())
delete cacheItem;
+ else if (cacheItem->incubationTask)
+ cacheItem->incubationTask->vdm = 0;
}
}
@@ -408,10 +411,10 @@ void QQmlDelegateModel::setDelegate(QQmlComponent *delegate)
the new directory's contents.
\c main.cpp:
- \snippet qml/visualdatamodel_rootindex/main.cpp 0
+ \snippet delegatemodel/visualdatamodel_rootindex/main.cpp 0
\c view.qml:
- \snippet qml/visualdatamodel_rootindex/view.qml 0
+ \snippet delegatemodel/visualdatamodel_rootindex/view.qml 0
If the \l model is a QAbstractItemModel subclass, the delegate can also
reference a \c hasModelChildren property (optionally qualified by a
@@ -615,7 +618,7 @@ QQmlDelegateModelGroup *QQmlDelegateModelPrivate::group_at(
The following example illustrates using groups to select items in a model.
- \snippet qml/visualdatagroup.qml 0
+ \snippet delegatemodel/visualdatagroup.qml 0
*/
QQmlListProperty<QQmlDelegateModelGroup> QQmlDelegateModel::groups()
@@ -791,9 +794,28 @@ void QQmlDelegateModelPrivate::emitDestroyingPackage(QQuickPackage *package)
QQmlDelegateModelGroupPrivate::get(m_groups[i])->destroyingPackage(package);
}
+static bool isDoneIncubating(QQmlIncubator::Status status)
+{
+ return status == QQmlIncubator::Ready || status == QQmlIncubator::Error;
+}
+
void QQDMIncubationTask::statusChanged(Status status)
{
- vdm->incubatorStatusChanged(this, status);
+ if (vdm) {
+ vdm->incubatorStatusChanged(this, status);
+ } else if (isDoneIncubating(status)) {
+ Q_ASSERT(incubating);
+ // The model was deleted from under our feet, cleanup ourselves
+ if (incubating->object) {
+ delete incubating->object;
+
+ incubating->object = 0;
+ incubating->contextData->destroy();
+ incubating->contextData = 0;
+ }
+ incubating->scriptRef = 0;
+ incubating->deleteLater();
+ }
}
void QQmlDelegateModelPrivate::releaseIncubator(QQDMIncubationTask *incubationTask)
@@ -821,7 +843,7 @@ void QQmlDelegateModelPrivate::removeCacheItem(QQmlDelegateModelItem *cacheItem)
void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incubationTask, QQmlIncubator::Status status)
{
Q_Q(QQmlDelegateModel);
- if (status != QQmlIncubator::Ready && status != QQmlIncubator::Error)
+ if (!isDoneIncubating(status))
return;
QQmlDelegateModelItem *cacheItem = incubationTask->incubating;
@@ -830,10 +852,12 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba
releaseIncubator(incubationTask);
if (status == QQmlIncubator::Ready) {
+ cacheItem->referenceObject();
if (QQuickPackage *package = qmlobject_cast<QQuickPackage *>(cacheItem->object))
emitCreatedPackage(incubationTask, package);
else
emitCreatedItem(incubationTask, cacheItem->object);
+ cacheItem->releaseObject();
} else if (status == QQmlIncubator::Error) {
qmlInfo(q, m_delegate->errors()) << "Error creating delegate";
}
@@ -846,8 +870,10 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba
delete cacheItem->object;
cacheItem->object = 0;
cacheItem->scriptRef -= 1;
- cacheItem->contextData->destroy();
+ if (cacheItem->contextData)
+ cacheItem->contextData->destroy();
cacheItem->contextData = 0;
+
if (!cacheItem->isReferenced()) {
removeCacheItem(cacheItem);
delete cacheItem;
@@ -945,7 +971,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, bo
// Remove the temporary reference count.
cacheItem->scriptRef -= 1;
- if (cacheItem->object)
+ if (cacheItem->object && (!cacheItem->incubationTask || isDoneIncubating(cacheItem->incubationTask->status())))
return cacheItem->object;
cacheItem->releaseObject();
@@ -960,7 +986,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, bo
/*
If asynchronous is true or the component is being loaded asynchronously due
to an ancestor being loaded asynchronously, item() may return 0. In this
- case itemCreated() will be emitted when the item is available. The item
+ case createdItem() will be emitted when the item is available. The item
at this stage does not have any references, so item() must be called again
to ensure a reference is held. Any call to item() which returns a valid item
must be matched by a call to release() in order to destroy the item.
@@ -1168,8 +1194,8 @@ void QQmlDelegateModelPrivate::itemsInserted(
cacheIndex = insert.cacheIndex + insert.count;
}
}
- for (; cacheIndex < m_cache.count(); ++cacheIndex)
- incrementIndexes(m_cache.at(cacheIndex), m_groupCount, inserted);
+ for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex)
+ incrementIndexes(cache.at(cacheIndex), m_groupCount, inserted);
}
void QQmlDelegateModelPrivate::itemsInserted(const QVector<Compositor::Insert> &inserts)
@@ -1193,8 +1219,9 @@ void QQmlDelegateModel::_q_itemsInserted(int index, int count)
d->m_count += count;
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= index)
item->setModelIndex(item->modelIndex() + count);
}
@@ -1285,8 +1312,8 @@ void QQmlDelegateModelPrivate::itemsRemoved(
}
}
- for (; cacheIndex < m_cache.count(); ++cacheIndex)
- incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed);
+ for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex)
+ incrementIndexes(cache.at(cacheIndex), m_groupCount, removed);
}
void QQmlDelegateModelPrivate::itemsRemoved(const QVector<Compositor::Remove> &removes)
@@ -1308,9 +1335,9 @@ void QQmlDelegateModel::_q_itemsRemoved(int index, int count)
return;
d->m_count -= count;
-
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= index + count)
item->setModelIndex(item->modelIndex() - count);
else if (item->modelIndex() >= index)
@@ -1356,8 +1383,9 @@ void QQmlDelegateModel::_q_itemsMoved(int from, int to, int count)
const int maximum = qMax(from, to) + count;
const int difference = from > to ? count : -count;
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= from && item->modelIndex() < from + count)
item->setModelIndex(item->modelIndex() - from + to);
else if (item->modelIndex() >= minimum && item->modelIndex() < maximum)
@@ -1413,8 +1441,9 @@ void QQmlDelegateModel::_q_modelReset()
if (d->m_complete) {
d->m_count = d->m_adaptorModel.count();
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() != -1)
item->setModelIndex(-1);
}
@@ -1773,8 +1802,12 @@ QQmlDelegateModelItem::~QQmlDelegateModelItem()
Q_ASSERT(objectRef == 0);
Q_ASSERT(!object);
- if (incubationTask && metaType->model)
- QQmlDelegateModelPrivate::get(metaType->model)->releaseIncubator(incubationTask);
+ if (incubationTask) {
+ if (metaType->model)
+ QQmlDelegateModelPrivate::get(metaType->model)->releaseIncubator(incubationTask);
+ else
+ delete incubationTask;
+ }
metaType->release();
@@ -2149,14 +2182,31 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package)
}
/*!
- \qmltype DelegateModelGroup
+ \qmltype VisualDataGroup
\instantiates QQmlDelegateModelGroup
\inqmlmodule QtQuick 2
\ingroup qtquick-models
\brief Encapsulates a filtered set of visual data items
- The DelegateModelGroup type provides a means to address the model data of a DelegateModel's
- delegate items, as well as sort and filter these delegate items.
+ The VisualDataGroup type provides a means to address the model data of a
+ model's delegate items, as well as sort and filter these delegate items.
+
+ This type is provided by the \l{Qt QML} module due to compatibility reasons.
+ The same implementation is now primarily available as \l DelegateModelGroup
+ in the \l{Qt QML Models QML Types}{Qt QML Models} module.
+
+ \sa {QtQml.Models2::DelegateModelGroup}
+*/
+/*!
+ \qmltype DelegateModelGroup
+ \instantiates QQmlDelegateModelGroup
+ \inqmlmodule QtQml.Models 2
+ \ingroup qtquick-models
+ \brief Encapsulates a filtered set of visual data items
+
+ The DelegateModelGroup type provides a means to address the model data of a
+ DelegateModel's delegate items, as well as sort and filter these delegate
+ items.
The initial set of instantiable delegate items in a DelegateModel is represented
by its \l {QtQml.Models2::DelegateModel::items}{items} group, which normally directly reflects
@@ -2180,24 +2230,11 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package)
type or to cherry-pick specific items that should be instantiated irregardless of whether
they're currently within a view's visible area.
- \sa {QML Dynamic View Ordering Tutorial}
-*/
-/*!
- \qmltype DelegateModelGroup
- \instantiates QQmlDelegateModelGroup
- \inqmlmodule QtQml.Models 2
- \brief Encapsulates a filtered set of visual data items
-
- The DelegateModelGroup type provides a means to address the model data of a DelegateModel's
- delegate items, as well as sort and filter these delegate items.
-
- This element is also available as DelegateModelGroup in the QtQuick module. For full details,
- see the \l DelegateModelGroup documentation.
+ \note This type is also available as \l VisualDataGroup in the \l{Qt QML}
+ module due to compatibility reasons.
- \sa {QtQuick::DelegateModelGroup}
+ \sa {QML Dynamic View Ordering Tutorial}
*/
-
-
QQmlDelegateModelGroup::QQmlDelegateModelGroup(QObject *parent)
: QObject(*new QQmlDelegateModelGroupPrivate, parent)
{
@@ -3222,4 +3259,3 @@ QV4::Value QQmlDelegateModelEngineData::array(
}
QT_END_NAMESPACE
-
diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp
index a2a1fa23ad..234494e088 100644
--- a/src/qml/types/qqmlinstantiator.cpp
+++ b/src/qml/types/qqmlinstantiator.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
QQmlInstantiatorPrivate::QQmlInstantiatorPrivate()
: componentComplete(true)
+ , effectiveReset(false)
, active(true)
, async(false)
, ownModel(false)
@@ -124,7 +125,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
{
Q_Q(QQmlInstantiator);
- if (componentComplete)
+ if (!componentComplete || effectiveReset)
return;
if (reset) {
@@ -162,7 +163,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
objects = objects.mid(0, index) + movedObjects + objects.mid(index);
} else for (int i = 0; i < insert.count; ++i) {
int modelIndex = index + i;
- QObject* obj = instanceModel->object(i, async);
+ QObject* obj = instanceModel->object(modelIndex, async);
if (obj)
_q_createdItem(modelIndex, obj);
}
@@ -378,8 +379,11 @@ void QQmlInstantiator::setModel(const QVariant &v)
if (!d->ownModel)
d->makeModel();
- if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel *>(d->instanceModel))
+ if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel *>(d->instanceModel)) {
+ d->effectiveReset = true;
dataModel->setModel(v);
+ d->effectiveReset = false;
+ }
}
if (d->instanceModel != prevModel) {
diff --git a/src/qml/types/qqmlinstantiator_p_p.h b/src/qml/types/qqmlinstantiator_p_p.h
index 79459299dc..a7d6905a7e 100644
--- a/src/qml/types/qqmlinstantiator_p_p.h
+++ b/src/qml/types/qqmlinstantiator_p_p.h
@@ -75,10 +75,11 @@ public:
void _q_createdItem(int, QObject *);
void _q_modelUpdated(const QQmlChangeSet &, bool);
- bool componentComplete;
- bool active;
- bool async;
- bool ownModel;
+ bool componentComplete:1;
+ bool effectiveReset:1;
+ bool active:1;
+ bool async:1;
+ bool ownModel:1;
QVariant model;
QQmlInstanceModel *instanceModel;
QQmlComponent *delegate;
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 8e1821092b..5091e46499 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -1412,22 +1412,12 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru
\qmltype ListModel
\instantiates QQmlListModel
\inqmlmodule QtQml.Models 2
- \brief Defines a free-form list data source
-
- The ListModel is a simple container of ListElement definitions, each containing data roles.
- The contents can be defined dynamically, or explicitly in QML.
-
- This type is also available in the QtQuick 2 import. For full documentation, see \l QtQuick2::ListModel
-*/
-/*!
- \qmltype ListModel
- \instantiates QQmlListModel
- \inqmlmodule QtQuick 2
- \brief Defines a free-form list data source
\ingroup qtquick-models
+ \brief Defines a free-form list data source
- The ListModel is a simple container of ListElement definitions, each containing data roles.
- The contents can be defined dynamically, or explicitly in QML.
+ The ListModel is a simple container of ListElement definitions, each
+ containing data roles. The contents can be defined dynamically, or
+ explicitly in QML.
The number of elements in the model can be obtained from its \l count property.
A number of familiar methods are also provided to manipulate the contents of the
@@ -1509,7 +1499,7 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru
handler. You must call sync() or else the changes made to the list from the external
thread will not be reflected in the list model in the main thread.
- \sa {qml-data-models}{Data Models}, {declarative/threading/threadedlistmodel}{Threaded ListModel example}, QtQml
+ \sa {qml-data-models}{Data Models}, {declarative/threading/threadedlistmodel}{Threaded ListModel example}, {Qt QML}
*/
QQmlListModel::QQmlListModel(QObject *parent)
@@ -1787,7 +1777,7 @@ QHash<int, QByteArray> QQmlListModel::roleNames() const
}
/*!
- \qmlproperty bool QtQml2::ListModel::dynamicRoles
+ \qmlproperty bool ListModel::dynamicRoles
By default, the type of a role is fixed the first time
the role is used. For example, if you create a role called
@@ -1833,7 +1823,7 @@ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles)
}
/*!
- \qmlproperty int QtQml2::ListModel::count
+ \qmlproperty int ListModel::count
The number of data entries in the model.
*/
int QQmlListModel::count() const
@@ -2516,16 +2506,6 @@ bool QQmlListModelParser::definesEmptyList(const QString &s)
\instantiates QQmlListElement
\inqmlmodule QtQml.Models 2
\brief Defines a data item in a ListModel
-
- List elements are defined inside ListModel definitions, and represent items in a list.
-
- This type is also available in the QtQuick 2 import. For full documentation, see \l QtQuick2::ListElement
-*/
-/*!
- \qmltype ListElement
- \instantiates QQmlListElement
- \inqmlmodule QtQuick 2
- \brief Defines a data item in a ListModel
\ingroup qtquick-models
List elements are defined inside ListModel definitions, and represent items in a
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index 5cee6a0251..48cd248c32 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -229,6 +229,9 @@ private:
QStringHash<Role *> roleHash;
};
+/*!
+\internal
+*/
class ListElement
{
public:
@@ -292,6 +295,9 @@ private:
friend class ListModel;
};
+/*!
+\internal
+*/
class ListModel
{
public:
@@ -375,4 +381,3 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(ListModel *);
#endif // QQUICKLISTMODEL_P_P_H
-
diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp
index 7f7bf92fa3..f2a7477c1b 100644
--- a/src/qml/types/qqmlobjectmodel.cpp
+++ b/src/qml/types/qqmlobjectmodel.cpp
@@ -176,7 +176,7 @@ public:
as a model.
This element is now primarily available as ObjectModel in the QtQml.Models module.
- VisualItemModel continues to be provided, with the same implementation, in QtQuick for
+ VisualItemModel continues to be provided, with the same implementation, in \c QtQuick for
compatibility reasons.
For full details about the type, see the \l ObjectModel documentation.
@@ -266,4 +266,3 @@ QQmlObjectModelAttached *QQmlObjectModel::qmlAttachedProperties(QObject *obj)
}
QT_END_NAMESPACE
-
diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp
index e885524b27..bdb8a4bc15 100644
--- a/src/qml/types/qquickpackage.cpp
+++ b/src/qml/types/qquickpackage.cpp
@@ -73,7 +73,8 @@ QT_BEGIN_NAMESPACE
\snippet quick/views/package/view.qml 0
- \sa {quick/views/package}{Package example}, {quick/demos/photoviewer}{Photo Viewer example}, QtQml
+ \sa {quick/views/package}{Package example}, {quick/demos/photoviewer}{Photo
+ Viewer example}, {Qt QML}
*/
/*!