aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp44
-rw-r--r--src/imports/localstorage/plugin.cpp46
-rw-r--r--src/imports/testlib/TestCase.qml16
-rw-r--r--src/imports/testlib/main.cpp7
-rw-r--r--src/imports/testlib/testcase.qdoc4
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp2
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp36
-rw-r--r--src/qml/animations/qabstractanimationjob_p.h13
-rw-r--r--src/qml/debugger/qdebugmessageservice.cpp2
-rw-r--r--src/qml/debugger/qqmldebugserver.cpp26
-rw-r--r--src/qml/debugger/qqmldebugservice.cpp4
-rw-r--r--src/qml/debugger/qqmldebugstatesdelegate_p.h5
-rw-r--r--src/qml/debugger/qqmlenginedebugservice.cpp64
-rw-r--r--src/qml/debugger/qqmlenginedebugservice_p.h6
-rw-r--r--src/qml/debugger/qqmlinspectorservice.cpp2
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp2
-rw-r--r--src/qml/debugger/qv8debugservice.cpp2
-rw-r--r--src/qml/debugger/qv8profilerservice.cpp2
-rw-r--r--src/qml/qml/qml.pri13
-rw-r--r--src/qml/qml/qqmlabstractbinding.cpp200
-rw-r--r--src/qml/qml/qqmlabstractbinding_p.h132
-rw-r--r--src/qml/qml/qqmlabstractexpression.cpp101
-rw-r--r--src/qml/qml/qqmlabstractexpression_p.h124
-rw-r--r--src/qml/qml/qqmlbinding.cpp478
-rw-r--r--src/qml/qml/qqmlbinding_p.h170
-rw-r--r--src/qml/qml/qqmlcomponent.cpp138
-rw-r--r--src/qml/qml/qqmlcomponent.h6
-rw-r--r--src/qml/qml/qqmlcomponent_p.h2
-rw-r--r--src/qml/qml/qqmlcontext.cpp2
-rw-r--r--src/qml/qml/qqmldata_p.h7
-rw-r--r--src/qml/qml/qqmlengine.cpp50
-rw-r--r--src/qml/qml/qqmlexpression.cpp425
-rw-r--r--src/qml/qml/qqmlexpression.h2
-rw-r--r--src/qml/qml/qqmlexpression_p.h289
-rw-r--r--src/qml/qml/qqmlextensionplugin.cpp6
-rw-r--r--src/qml/qml/qqmlimport.cpp18
-rw-r--r--src/qml/qml/qqmlincubator.cpp10
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp371
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h283
-rw-r--r--src/qml/qml/qqmllocale.cpp28
-rw-r--r--src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp4
-rw-r--r--src/qml/qml/qqmlproperty.cpp19
-rw-r--r--src/qml/qml/qqmlproperty_p.h8
-rw-r--r--src/qml/qml/qqmltypeloader.cpp39
-rw-r--r--src/qml/qml/qqmltypeloader_p.h2
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding.cpp138
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding_p.h (renamed from src/qml/qml/qqmlbinding_p_p.h)42
-rw-r--r--src/qml/qml/qqmlvme.cpp10
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp67
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h16
-rw-r--r--src/qml/qml/qquickworkerscript.cpp6
-rw-r--r--src/qml/qml/v4/qv4bindings.cpp68
-rw-r--r--src/qml/qml/v4/qv4compiler.cpp32
-rw-r--r--src/qml/qml/v4/qv4instruction.cpp18
-rw-r--r--src/qml/qml/v4/qv4instruction_p.h12
-rw-r--r--src/qml/qml/v4/qv4ir.cpp13
-rw-r--r--src/qml/qml/v4/qv4ir_p.h2
-rw-r--r--src/qml/qml/v4/qv4irbuilder.cpp91
-rw-r--r--src/qml/qml/v4/qv4program_p.h1
-rw-r--r--src/qml/qml/v8/qjsengine.cpp2
-rw-r--r--src/qml/qml/v8/qjsvalue.cpp44
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp107
-rw-r--r--src/qml/qml/v8/qv8bindings.cpp6
-rw-r--r--src/qml/qml/v8/qv8contextwrapper.cpp18
-rw-r--r--src/qml/qml/v8/qv8qobjectwrapper.cpp21
-rw-r--r--src/qml/qml/v8/qv8valuetypewrapper.cpp4
-rw-r--r--src/qml/util/qqmlpropertymap.cpp4
-rw-r--r--src/qmltest/quicktest.cpp7
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp20
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp168
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp25
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h2
-rw-r--r--src/quick/items/qquickanimatedimage.cpp2
-rw-r--r--src/quick/items/qquickborderimage.cpp22
-rw-r--r--src/quick/items/qquickcanvas.cpp8
-rw-r--r--src/quick/items/qquickdrag.cpp8
-rw-r--r--src/quick/items/qquickdroparea.cpp8
-rw-r--r--src/quick/items/qquickevents.cpp54
-rw-r--r--src/quick/items/qquickflickable.cpp22
-rw-r--r--src/quick/items/qquickgridview.cpp79
-rw-r--r--src/quick/items/qquickimage.cpp54
-rw-r--r--src/quick/items/qquickitem.cpp96
-rw-r--r--src/quick/items/qquickitemanimation.cpp10
-rw-r--r--src/quick/items/qquickitemview.cpp13
-rw-r--r--src/quick/items/qquickitemview_p_p.h7
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp62
-rw-r--r--src/quick/items/qquicklistview.cpp99
-rw-r--r--src/quick/items/qquickloader.cpp61
-rw-r--r--src/quick/items/qquickmousearea.cpp24
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp12
-rw-r--r--src/quick/items/qquickpathview.cpp6
-rw-r--r--src/quick/items/qquickpincharea.cpp40
-rw-r--r--src/quick/items/qquickpositioners.cpp52
-rw-r--r--src/quick/items/qquickrepeater.cpp16
-rw-r--r--src/quick/items/qquickshadereffect.cpp38
-rw-r--r--src/quick/items/qquickshadereffectmesh.cpp4
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp24
-rw-r--r--src/quick/items/qquickstateoperations.cpp12
-rw-r--r--src/quick/items/qquicktext.cpp94
-rw-r--r--src/quick/items/qquicktextedit.cpp94
-rw-r--r--src/quick/items/qquicktextinput.cpp108
-rw-r--r--src/quick/items/qquicktextinput_p_p.h1
-rw-r--r--src/quick/items/qquickvisualadaptormodel.cpp24
-rw-r--r--src/quick/items/qquickvisualdatamodel.cpp30
-rw-r--r--src/quick/items/qquickvisualdatamodel_p_p.h2
-rw-r--r--src/quick/items/qquickwindowmanager.cpp12
-rw-r--r--src/quick/particles/qquickimageparticle.cpp14
-rw-r--r--src/quick/particles/qquickpointattractor.cpp16
-rw-r--r--src/quick/particles/qquickwander.cpp6
-rw-r--r--src/quick/qtquick2.cpp22
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendernode.cpp34
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp86
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h59
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode.cpp67
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.h5
-rw-r--r--src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp19
-rw-r--r--src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h12
-rw-r--r--src/quick/util/qquickanimation.cpp282
-rw-r--r--src/quick/util/qquickanimationcontroller.cpp2
-rw-r--r--src/quick/util/qquickconnections.cpp6
-rw-r--r--src/quick/util/qquickfontloader.cpp14
-rw-r--r--src/quick/util/qquickimageprovider.cpp6
-rw-r--r--src/quick/util/qquickpath.cpp56
-rw-r--r--src/quick/util/qquickpixmapcache.cpp4
-rw-r--r--src/quick/util/qquickpropertychanges.cpp11
-rw-r--r--src/quick/util/qquicksmoothedanimation.cpp6
-rw-r--r--src/quick/util/qquicksystempalette.cpp6
-rw-r--r--src/quick/util/qquicktimeline.cpp14
130 files changed, 3496 insertions, 2613 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index d68d7af6d4..294fe184d2 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -208,21 +208,21 @@ void QQuickFolderListModelPrivate::_q_sortFinished(const QList<FileProperty> &li
\e{Elements in the Qt.labs module are not guaranteed to remain compatible
in future versions.}
- \bold{import Qt.labs.folderlistmodel 1.0}
+ \b{import Qt.labs.folderlistmodel 1.0}
The \l folder property specifies the folder to access. Information about the
files and directories in the folder is supplied via the model's interface.
Components access names and paths via the following roles:
\list
- \o \c fileName
- \o \c filePath
- \o \c fileBaseName
- \o \c fileSuffix
- \o \c fileSize
- \o \c fileModified
- \o \c fileAccessed
- \o \c fileIsDir
+ \li \c fileName
+ \li \c filePath
+ \li \c fileBaseName
+ \li \c fileSuffix
+ \li \c fileSize
+ \li \c fileModified
+ \li \c fileAccessed
+ \li \c fileIsDir
\endlist
Additionally a file entry can be differentiated from a folder entry via the
@@ -493,11 +493,11 @@ void QQuickFolderListModel::componentComplete()
The \a sortField property contains field to use for sorting. sortField
may be one of:
\list
- \o Unsorted - no sorting is applied.
- \o Name - sort by filename
- \o LastModified - sort by time modified
- \o Size - sort by file size
- \o Type - sort by file type (extension)
+ \li Unsorted - no sorting is applied.
+ \li Name - sort by filename
+ \li LastModified - sort by time modified
+ \li Size - sort by file size
+ \li Type - sort by file type (extension)
\endlist
\sa sortReversed
@@ -672,14 +672,14 @@ void QQuickFolderListModel::setShowOnlyReadable(bool on)
are available.
\list
- \o \c fileName
- \o \c filePath
- \o \c fileBaseName
- \o \c fileSuffix
- \o \c fileSize
- \o \c fileModified
- \o \c fileAccessed
- \o \c fileIsDir
+ \li \c fileName
+ \li \c filePath
+ \li \c fileBaseName
+ \li \c fileSuffix
+ \li \c fileSize
+ \li \c fileModified
+ \li \c fileAccessed
+ \li \c fileIsDir
\endlist
*/
QVariant QQuickFolderListModel::get(int idx, const QString &property) const
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 7c55225ed1..0187d06e6a 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -480,9 +480,9 @@ import QtQuick.LocalStorage 2.0 as LS
db = LS.openDatabaseSync(identifier, version, description, estimated_size, callback(db))
\endcode
-The above code returns the database identified by \i identifier. If the database does not already exist, it
-is created, and the function \i callback is called with the database as a parameter. \i description
-and \i estimated_size are written to the INI file (described below), but are otherwise currently
+The above code returns the database identified by \e identifier. If the database does not already exist, it
+is created, and the function \e callback is called with the database as a parameter. \e description
+and \e estimated_size are written to the INI file (described below), but are otherwise currently
unused.
May throw exception with code property SQLException.DATABASE_ERR, or SQLException.VERSION_ERR.
@@ -490,51 +490,51 @@ May throw exception with code property SQLException.DATABASE_ERR, or SQLExceptio
When a database is first created, an INI file is also created specifying its characteristics:
\table
-\header \o \bold {Key} \o \bold {Value}
-\row \o Name \o The name of the database passed to \c openDatabase()
-\row \o Version \o The version of the database passed to \c openDatabase()
-\row \o Description \o The description of the database passed to \c openDatabase()
-\row \o EstimatedSize \o The estimated size (in bytes) of the database passed to \c openDatabase()
-\row \o Driver \o Currently "QSQLITE"
+\header \li \b {Key} \li \b {Value}
+\row \li Name \li The name of the database passed to \c openDatabase()
+\row \li Version \li The version of the database passed to \c openDatabase()
+\row \li Description \li The description of the database passed to \c openDatabase()
+\row \li EstimatedSize \li The estimated size (in bytes) of the database passed to \c openDatabase()
+\row \li Driver \li Currently "QSQLITE"
\endtable
This data can be used by application tools.
\section3 db.changeVersion(from, to, callback(tx))
-This method allows you to perform a \i{Scheme Upgrade}.
+This method allows you to perform a \e{Scheme Upgrade}.
-If the current version of \i db is not \i from, then an exception is thrown.
+If the current version of \e db is not \e from, then an exception is thrown.
-Otherwise, a database transaction is created and passed to \i callback. In this function,
-you can call \i executeSql on \i tx to upgrade the database.
+Otherwise, a database transaction is created and passed to \e callback. In this function,
+you can call \e executeSql on \e tx to upgrade the database.
May throw exception with code property SQLException.DATABASE_ERR or SQLException.UNKNOWN_ERR.
\section3 db.transaction(callback(tx))
-This method creates a read/write transaction and passed to \i callback. In this function,
-you can call \i executeSql on \i tx to read and modify the database.
+This method creates a read/write transaction and passed to \e callback. In this function,
+you can call \e executeSql on \e tx to read and modify the database.
If the callback throws exceptions, the transaction is rolled back.
\section3 db.readTransaction(callback(tx))
-This method creates a read-only transaction and passed to \i callback. In this function,
-you can call \i executeSql on \i tx to read the database (with SELECT statements).
+This method creates a read-only transaction and passed to \e callback. In this function,
+you can call \e executeSql on \e tx to read the database (with SELECT statements).
\section3 results = tx.executeSql(statement, values)
-This method executes a SQL \i statement, binding the list of \i values to SQL positional parameters ("?").
+This method executes a SQL \e statement, binding the list of \e values to SQL positional parameters ("?").
It returns a results object, with the following properties:
\table
-\header \o \bold {Type} \o \bold {Property} \o \bold {Value} \o \bold {Applicability}
-\row \o int \o rows.length \o The number of rows in the result \o SELECT
-\row \o var \o rows.item(i) \o Function that returns row \i i of the result \o SELECT
-\row \o int \o rowsAffected \o The number of rows affected by a modification \o UPDATE, DELETE
-\row \o string \o insertId \o The id of the row inserted \o INSERT
+\header \li \b {Type} \li \b {Property} \li \b {Value} \li \b {Applicability}
+\row \li int \li rows.length \li The number of rows in the result \li SELECT
+\row \li var \li rows.item(i) \li Function that returns row \e i of the result \li SELECT
+\row \li int \li rowsAffected \li The number of rows affected by a modification \li UPDATE, DELETE
+\row \li string \li insertId \li The id of the row inserted \li INSERT
\endtable
May throw exception with code property SQLException.DATABASE_ERR, SQLException.SYNTAX_ERR, or SQLException.UNKNOWN_ERR.
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 0433483cfd..1f9de5e998 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -407,6 +407,22 @@ Item {
qtest_fail("window not shown", 2)
}
+ function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) {
+ if (item.x === undefined || item.y === undefined)
+ return
+ if (button === undefined)
+ button = Qt.LeftButton
+ if (modifiers === undefined)
+ modifiers = Qt.NoModifier
+ if (delay == undefined)
+ delay = -1
+
+ mousePress(item, x, y, button, modifiers, delay)
+ //trigger draging
+ mouseMove(item, x + util.dragThreshold + 1, y + util.dragThreshold + 1, delay, button)
+ mouseMove(item, x + dx, y + dy, delay, button)
+ }
+
function mouseClick(item, x, y, button, modifiers, delay) {
if (button === undefined)
button = Qt.LeftButton
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index 6473d216c7..18039e7a3f 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -48,6 +48,8 @@
#include "private/qtestoptions_p.h"
#include "QtQuick/qquickitem.h"
#include <QtQml/private/qqmlengine_p.h>
+#include <QtGui/QGuiApplication>
+#include <QtGui/qstylehints.h>
QML_DECLARE_TYPE(QuickTestResult)
QML_DECLARE_TYPE(QuickTestEvent)
@@ -61,6 +63,7 @@ class QuickTestUtil : public QObject
Q_OBJECT
Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged)
Q_PROPERTY(bool wrapper READ wrapper NOTIFY wrapperChanged)
+ Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged)
public:
QuickTestUtil(QObject *parent = 0)
:QObject(parent)
@@ -76,9 +79,13 @@ public:
{
return true;
}
+ int dragThreshold() const { return qApp->styleHints()->startDragDistance(); }
+
Q_SIGNALS:
void printAvailableFunctionsChanged();
void wrapperChanged();
+ void dragThresholdChanged();
+
public Q_SLOTS:
QQmlV8Handle typeName(const QVariant& v) const
diff --git a/src/imports/testlib/testcase.qdoc b/src/imports/testlib/testcase.qdoc
index d8a20e4fc7..f928cdaa44 100644
--- a/src/imports/testlib/testcase.qdoc
+++ b/src/imports/testlib/testcase.qdoc
@@ -180,7 +180,7 @@
and mouseMove() methods can be used to simulate mouse events in a
similar fashion.
- \bold{Note:} keyboard and mouse events can only be delivered once the
+ \b{Note:} keyboard and mouse events can only be delivered once the
main window has been shown. Attempts to deliver events before then
will fail. Use the \l when and windowShown properties to track
when the main window has been shown.
@@ -446,7 +446,7 @@
focused item. If \a delay is larger than 0, the test will wait for
\a delay milliseconds.
- \bold{Note:} At some point you should release the key using keyRelease().
+ \b{Note:} At some point you should release the key using keyRelease().
\sa keyRelease(), keyClick()
*/
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 1377859b5e..22072dc75a 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -909,10 +909,10 @@ QQmlV8Handle QQuickXmlListModel::get(int index) const
Specifies the model loading status, which can be one of the following:
\list
- \o XmlListModel.Null - No XML data has been set for this model.
- \o XmlListModel.Ready - The XML data has been loaded into the model.
- \o XmlListModel.Loading - The model is in the process of reading and loading XML data.
- \o XmlListModel.Error - An error occurred while the model was loading. See errorString() for details
+ \li XmlListModel.Null - No XML data has been set for this model.
+ \li XmlListModel.Ready - The XML data has been loaded into the model.
+ \li XmlListModel.Loading - The model is in the process of reading and loading XML data.
+ \li XmlListModel.Error - An error occurred while the model was loading. See errorString() for details
about the error.
\endlist
diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp
index fb18231b94..7d120cacb0 100644
--- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp
+++ b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp
@@ -132,7 +132,7 @@ void QmlOstPlugin::setPort(int port, bool block)
}
d->protocol = new QPacketProtocol(d->ost, this);
QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
- qWarning("QML Debugger: Waiting for connection via OST."); // This message is part of the signalling - do not change the format!
+ qDebug("QML Debugger: Waiting for connection via OST."); // This message is part of the signalling - do not change the format!
}
void QmlOstPlugin::readyRead()
diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
index 2b12f297e4..4eccd0dd55 100644
--- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
+++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
@@ -147,7 +147,7 @@ void QTcpServerConnection::listen()
d->tcpServer = new QTcpServer(this);
QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection()));
if (d->tcpServer->listen(QHostAddress::Any, d->port))
- qWarning("QML Debugger: Waiting for connection on port %d...", d->port);
+ qDebug("QML Debugger: Waiting for connection on port %d...", d->port);
else
qWarning("QML Debugger: Unable to listen to port %d.", d->port);
}
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp
index a540382847..fecd8fbc5d 100644
--- a/src/qml/animations/qabstractanimationjob.cpp
+++ b/src/qml/animations/qabstractanimationjob.cpp
@@ -161,6 +161,9 @@ void QQmlAnimationTimer::stopTimer()
void QQmlAnimationTimer::registerAnimation(QAbstractAnimationJob *animation, bool isTopLevel)
{
+ if (animation->userControlDisabled())
+ return;
+
QQmlAnimationTimer *inst = instance(true); //we create the instance if needed
inst->registerRunningAnimation(animation);
if (isTopLevel) {
@@ -206,6 +209,8 @@ void QQmlAnimationTimer::unregisterAnimation(QAbstractAnimationJob *animation)
void QQmlAnimationTimer::registerRunningAnimation(QAbstractAnimationJob *animation)
{
+ Q_ASSERT(!animation->userControlDisabled());
+
if (animation->m_isGroup)
return;
@@ -217,6 +222,9 @@ void QQmlAnimationTimer::registerRunningAnimation(QAbstractAnimationJob *animati
void QQmlAnimationTimer::unregisterRunningAnimation(QAbstractAnimationJob *animation)
{
+ if (animation->userControlDisabled())
+ return;
+
if (animation->m_isGroup)
return;
@@ -248,20 +256,21 @@ int QQmlAnimationTimer::closestPauseAnimationTimeToFinish()
/////////////////////////////////////////////////////////////////////////////////////////////////////////
QAbstractAnimationJob::QAbstractAnimationJob()
- : m_isPause(false)
- , m_isGroup(false)
- , m_loopCount(1)
+ : m_loopCount(1)
, m_group(0)
, m_direction(QAbstractAnimationJob::Forward)
, m_state(QAbstractAnimationJob::Stopped)
, m_totalCurrentTime(0)
, m_currentTime(0)
, m_currentLoop(0)
- , m_hasRegisteredTimer(false)
, m_uncontrolledFinishTime(-1)
- , m_wasDeleted(0)
, m_nextSibling(0)
, m_previousSibling(0)
+ , m_wasDeleted(0)
+ , m_hasRegisteredTimer(false)
+ , m_isPause(false)
+ , m_isGroup(false)
+ , m_disableUserControl(false)
{
}
@@ -482,6 +491,23 @@ void QAbstractAnimationJob::resume()
setState(Running);
}
+void QAbstractAnimationJob::setEnableUserControl()
+{
+ m_disableUserControl = false;
+}
+
+bool QAbstractAnimationJob::userControlDisabled() const
+{
+ return m_disableUserControl;
+}
+
+void QAbstractAnimationJob::setDisableUserControl()
+{
+ m_disableUserControl = true;
+ start();
+ pause();
+}
+
void QAbstractAnimationJob::updateState(QAbstractAnimationJob::State newState,
QAbstractAnimationJob::State oldState)
{
diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h
index f00090cb30..e7d96ddfce 100644
--- a/src/qml/animations/qabstractanimationjob_p.h
+++ b/src/qml/animations/qabstractanimationjob_p.h
@@ -93,6 +93,9 @@ public:
inline bool isRunning() { return m_state == Running; }
inline bool isStopped() { return m_state == Stopped; }
inline bool isPaused() { return m_state == Paused; }
+ void setDisableUserControl();
+ void setEnableUserControl();
+ bool userControlDisabled() const;
void setCurrentTime(int msecs);
@@ -128,8 +131,6 @@ protected:
void directionChanged(QAbstractAnimationJob::Direction);
//definition
- bool m_isPause;
- bool m_isGroup;
int m_loopCount;
QAnimationGroupJob *m_group;
QAbstractAnimationJob::Direction m_direction;
@@ -139,10 +140,8 @@ protected:
int m_totalCurrentTime;
int m_currentTime;
int m_currentLoop;
- bool m_hasRegisteredTimer;
//records the finish time for an uncontrolled animation (used by animation groups)
int m_uncontrolledFinishTime;
- bool *m_wasDeleted;
struct ChangeListener {
ChangeListener(QAnimationJobChangeListener *l, QAbstractAnimationJob::ChangeTypes t) : listener(l), types(t) {}
@@ -155,6 +154,12 @@ protected:
QAbstractAnimationJob *m_nextSibling;
QAbstractAnimationJob *m_previousSibling;
+ bool *m_wasDeleted;
+ bool m_hasRegisteredTimer:1;
+ bool m_isPause:1;
+ bool m_isGroup:1;
+ bool m_disableUserControl:1;
+
friend class QQmlAnimationTimer;
friend class QAnimationGroupJob;
};
diff --git a/src/qml/debugger/qdebugmessageservice.cpp b/src/qml/debugger/qdebugmessageservice.cpp
index dcaa514cd7..a41f95c2c7 100644
--- a/src/qml/debugger/qdebugmessageservice.cpp
+++ b/src/qml/debugger/qdebugmessageservice.cpp
@@ -69,7 +69,7 @@ public:
QDebugMessageService::QDebugMessageService(QObject *parent) :
QQmlDebugService(*(new QDebugMessageServicePrivate()),
- QLatin1String("DebugMessages"), 2, parent)
+ QStringLiteral("DebugMessages"), 2, parent)
{
Q_D(QDebugMessageService);
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp
index e70632d925..ec3f9dafc2 100644
--- a/src/qml/debugger/qqmldebugserver.cpp
+++ b/src/qml/debugger/qqmldebugserver.cpp
@@ -155,7 +155,7 @@ void QQmlDebugServerPrivate::advertisePlugins()
pluginNames << service->name();
pluginVersions << service->version();
}
- out << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << pluginNames << pluginVersions;
+ out << QString(QStringLiteral("QDeclarativeDebugClient")) << 1 << pluginNames << pluginVersions;
}
QMetaObject::invokeMethod(q, "_q_sendMessages", Qt::QueuedConnection, Q_ARG(QList<QByteArray>, QList<QByteArray>() << message));
@@ -217,8 +217,8 @@ void QQmlDebugServerThread::run()
connection->setPort(m_port, m_block);
} else {
QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp));
- qWarning() << QString::fromAscii("QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
- "Remote debugger plugin has not been found.").arg(appD->qmljsDebugArgumentsString());
+ qWarning() << QString(QLatin1String("QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
+ "Remote debugger plugin has not been found.")).arg(appD->qmljsDebugArgumentsString());
}
exec();
@@ -262,9 +262,9 @@ QQmlDebugServer *QQmlDebugServer::instance()
// format: qmljsdebugger=port:3768[,block] OR qmljsdebugger=ost[,block]
if (!appD->qmljsDebugArgumentsString().isEmpty()) {
if (!QQmlEnginePrivate::qml_debugging_enabled) {
- qWarning() << QString::fromLatin1(
+ qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
- "Debugging has not been enabled.").arg(
+ "Debugging has not been enabled.")).arg(
appD->qmljsDebugArgumentsString());
return 0;
}
@@ -273,9 +273,9 @@ QQmlDebugServer *QQmlDebugServer::instance()
if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) {
int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(','));
port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok);
- pluginName = QLatin1String("qmldbg_tcp");
+ pluginName = QStringLiteral("qmldbg_tcp");
} else if (appD->qmljsDebugArgumentsString().contains(QLatin1String("ost"))) {
- pluginName = QLatin1String("qmldbg_ost");
+ pluginName = QStringLiteral("qmldbg_ost");
ok = true;
}
@@ -298,17 +298,17 @@ QQmlDebugServer *QQmlDebugServer::instance()
}
} else {
- qWarning() << QString::fromLatin1(
+ qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
- "Format is -qmljsdebugger=port:<port>[,block]").arg(
+ "Format is -qmljsdebugger=port:<port>[,block]")).arg(
appD->qmljsDebugArgumentsString());
}
}
#else
if (!appD->qmljsDebugArgumentsString().isEmpty()) {
- qWarning() << QString::fromLatin1(
+ qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
- "QtQml is not configured for debugging.").arg(
+ "QtQml is not configured for debugging.")).arg(
appD->qmljsDebugArgumentsString());
}
#endif
@@ -373,7 +373,7 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
pluginVersions << service->version();
}
- out << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << pluginNames << pluginVersions;
+ out << QString(QStringLiteral("QDeclarativeDebugClient")) << 0 << protocolVersion << pluginNames << pluginVersions;
}
d->connection->send(QList<QByteArray>() << helloAnswer);
@@ -389,7 +389,7 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
iter.value()->stateChanged(newState);
}
- qWarning("QML Debugger: Connection established.");
+ qDebug("QML Debugger: Connection established.");
d->messageArrivedCondition.wakeAll();
} else if (op == 1) {
diff --git a/src/qml/debugger/qqmldebugservice.cpp b/src/qml/debugger/qqmldebugservice.cpp
index a1cc4fe0a3..45948490cf 100644
--- a/src/qml/debugger/qqmldebugservice.cpp
+++ b/src/qml/debugger/qqmldebugservice.cpp
@@ -216,11 +216,11 @@ bool QQmlDebugService::hasDebuggingClient()
QString QQmlDebugService::objectToString(QObject *obj)
{
if(!obj)
- return QLatin1String("NULL");
+ return QStringLiteral("NULL");
QString objectName = obj->objectName();
if(objectName.isEmpty())
- objectName = QLatin1String("<unnamed>");
+ objectName = QStringLiteral("<unnamed>");
QString rv = QString::fromUtf8(obj->metaObject()->className()) +
QLatin1String(": ") + objectName;
diff --git a/src/qml/debugger/qqmldebugstatesdelegate_p.h b/src/qml/debugger/qqmldebugstatesdelegate_p.h
index 6e3cc978f2..6d4ac10dbf 100644
--- a/src/qml/debugger/qqmldebugstatesdelegate_p.h
+++ b/src/qml/debugger/qqmldebugstatesdelegate_p.h
@@ -54,6 +54,8 @@
//
#include <QtQml/qtqmlglobal.h>
+#include <QtCore/QList>
+#include <QtCore/QPointer>
QT_BEGIN_HEADER
@@ -74,7 +76,8 @@ protected:
public:
virtual ~QQmlDebugStatesDelegate() {}
- virtual void buildStatesList(QQmlContext *ctxt, bool cleanList) = 0;
+ virtual void buildStatesList(bool cleanList,
+ const QList<QPointer<QObject> > &instances) = 0;
virtual void updateBinding(QQmlContext *context,
const QQmlProperty &property,
const QVariant &expression, bool isLiteralValue,
diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp
index 76a88029ea..67bec3577b 100644
--- a/src/qml/debugger/qqmlenginedebugservice.cpp
+++ b/src/qml/debugger/qqmlenginedebugservice.cpp
@@ -67,7 +67,7 @@ QQmlEngineDebugService *QQmlEngineDebugService::instance()
}
QQmlEngineDebugService::QQmlEngineDebugService(QObject *parent)
- : QQmlDebugService(QLatin1String("QDeclarativeEngine"), 1, parent),
+ : QQmlDebugService(QStringLiteral("QDeclarativeEngine"), 1, parent),
m_watch(new QQmlWatcher(this)),
m_statesDelegate(0)
{
@@ -206,12 +206,12 @@ QVariant QQmlEngineDebugService::valueContents(const QVariant &value) const
if (o) {
QString name = o->objectName();
if (name.isEmpty())
- name = QLatin1String("<unnamed object>");
+ name = QStringLiteral("<unnamed object>");
return name;
}
}
- return QLatin1String("<unknown value>");
+ return QString(QStringLiteral("<unknown value>"));
}
void QQmlEngineDebugService::buildObjectDump(QDataStream &message,
@@ -247,7 +247,7 @@ void QQmlEngineDebugService::buildObjectDump(QDataStream &message,
prop.value = expr->expression();
QObject *scope = expr->scopeObject();
if (scope) {
- QString methodName = QLatin1String(scope->metaObject()->method(signal->index()).name().constData());
+ QString methodName = QString::fromLatin1(scope->metaObject()->method(signal->index()).name());
if (!methodName.isEmpty()) {
prop.name = QLatin1String("on") + methodName[0].toUpper()
+ methodName.mid(1);
@@ -295,7 +295,9 @@ void QQmlEngineDebugService::prepareDeferredObjects(QObject *obj)
}
-void QQmlEngineDebugService::buildObjectList(QDataStream &message, QQmlContext *ctxt)
+void QQmlEngineDebugService::buildObjectList(QDataStream &message,
+ QQmlContext *ctxt,
+ const QList<QPointer<QObject> > &instances)
{
QQmlContextData *p = QQmlContextData::get(ctxt);
@@ -316,29 +318,30 @@ void QQmlEngineDebugService::buildObjectList(QDataStream &message, QQmlContext *
child = p->childContexts;
while (child) {
- buildObjectList(message, child->asQQmlContext());
+ buildObjectList(message, child->asQQmlContext(), instances);
child = child->nextChild;
}
- // Clean deleted objects
- QQmlContextPrivate *ctxtPriv = QQmlContextPrivate::get(ctxt);
- for (int ii = 0; ii < ctxtPriv->instances.count(); ++ii) {
- if (!ctxtPriv->instances.at(ii)) {
- ctxtPriv->instances.removeAt(ii);
- --ii;
- }
+ count = 0;
+ for (int ii = 0; ii < instances.count(); ++ii) {
+ QQmlData *data = QQmlData::get(instances.at(ii));
+ if (data->context == p)
+ count ++;
}
+ message << count;
- message << ctxtPriv->instances.count();
- for (int ii = 0; ii < ctxtPriv->instances.count(); ++ii) {
- message << objectData(ctxtPriv->instances.at(ii));
+ for (int ii = 0; ii < instances.count(); ++ii) {
+ QQmlData *data = QQmlData::get(instances.at(ii));
+ if (data->context == p)
+ message << objectData(instances.at(ii));
}
}
-void QQmlEngineDebugService::buildStatesList(QQmlContext *ctxt, bool cleanList)
+void QQmlEngineDebugService::buildStatesList(bool cleanList,
+ const QList<QPointer<QObject> > &instances)
{
if (m_statesDelegate)
- m_statesDelegate->buildStatesList(ctxt, cleanList);
+ m_statesDelegate->buildStatesList(cleanList, instances);
}
QQmlEngineDebugService::QQmlObjectData
@@ -425,8 +428,17 @@ void QQmlEngineDebugService::processMessage(const QByteArray &message)
rs << QByteArray("LIST_OBJECTS_R") << queryId;
if (engine) {
- buildObjectList(rs, engine->rootContext());
- buildStatesList(engine->rootContext(), true);
+ QQmlContext *rootContext = engine->rootContext();
+ // Clean deleted objects
+ QQmlContextPrivate *ctxtPriv = QQmlContextPrivate::get(rootContext);
+ for (int ii = 0; ii < ctxtPriv->instances.count(); ++ii) {
+ if (!ctxtPriv->instances.at(ii)) {
+ ctxtPriv->instances.removeAt(ii);
+ --ii;
+ }
+ }
+ buildObjectList(rs, rootContext, ctxtPriv->instances);
+ buildStatesList(true, ctxtPriv->instances);
}
sendMessage(reply);
@@ -508,11 +520,11 @@ void QQmlEngineDebugService::processMessage(const QByteArray &message)
bool undefined = false;
QVariant value = exprObj.evaluate(&undefined);
if (undefined)
- result = QLatin1String("<undefined>");
+ result = QString(QStringLiteral("<undefined>"));
else
result = valueContents(value);
} else {
- result = QLatin1String("<unknown context>");
+ result = QString(QStringLiteral("<unknown context>"));
}
QByteArray reply;
@@ -575,10 +587,8 @@ void QQmlEngineDebugService::setBinding(int objectId,
QQmlPropertyPrivate::setSignalExpression(property, qmlExpression);
qmlExpression->setSourceLocation(filename, line, column);
} else if (property.isProperty()) {
- QQmlBinding *binding = new QQmlBinding(expression.toString(), object, context);
+ QQmlBinding *binding = new QQmlBinding(expression.toString(), false, object, QQmlContextData::get(context), filename, line, column);;
binding->setTarget(property);
- binding->setSourceLocation(filename, line, column);
- binding->setNotifyOnValueChanged(true);
QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::setBinding(property, binding);
if (oldBinding)
oldBinding->destroy();
@@ -665,11 +675,11 @@ void QQmlEngineDebugService::setMethodBody(int objectId, const QString &method,
QString paramStr;
for (int ii = 0; ii < paramNames.count(); ++ii) {
- if (ii != 0) paramStr.append(QLatin1String(","));
+ if (ii != 0) paramStr.append(QLatin1Char(','));
paramStr.append(QString::fromUtf8(paramNames.at(ii)));
}
- QString jsfunction = QLatin1String("(function ") + method + QLatin1String("(") + paramStr +
+ QString jsfunction = QLatin1String("(function ") + method + QLatin1Char('(') + paramStr +
QLatin1String(") {");
jsfunction += body;
jsfunction += QLatin1String("\n})");
diff --git a/src/qml/debugger/qqmlenginedebugservice_p.h b/src/qml/debugger/qqmlenginedebugservice_p.h
index 1a92801fcc..f41063d7a3 100644
--- a/src/qml/debugger/qqmlenginedebugservice_p.h
+++ b/src/qml/debugger/qqmlenginedebugservice_p.h
@@ -57,6 +57,7 @@
#include <QtCore/qurl.h>
#include <QtCore/qvariant.h>
+#include <QtCore/QPointer>
QT_BEGIN_NAMESPACE
@@ -111,9 +112,10 @@ private Q_SLOTS:
private:
void prepareDeferredObjects(QObject *);
- void buildObjectList(QDataStream &, QQmlContext *);
+ void buildObjectList(QDataStream &, QQmlContext *,
+ const QList<QPointer<QObject> > &instances);
void buildObjectDump(QDataStream &, QObject *, bool, bool);
- void buildStatesList(QQmlContext *, bool);
+ void buildStatesList(bool cleanList, const QList<QPointer<QObject> > &instances);
QQmlObjectData objectData(QObject *);
QQmlObjectProperty propertyData(QObject *, int);
QVariant valueContents(const QVariant &defaultValue) const;
diff --git a/src/qml/debugger/qqmlinspectorservice.cpp b/src/qml/debugger/qqmlinspectorservice.cpp
index c494045bff..5426745bc6 100644
--- a/src/qml/debugger/qqmlinspectorservice.cpp
+++ b/src/qml/debugger/qqmlinspectorservice.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QQmlInspectorService, serviceInstance)
QQmlInspectorService::QQmlInspectorService()
- : QQmlDebugService(QLatin1String("QDeclarativeObserverMode"), 1)
+ : QQmlDebugService(QStringLiteral("QDeclarativeObserverMode"), 1)
, m_currentInspectorPlugin(0)
{
registerService();
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index 2731d2046b..c643073308 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -77,7 +77,7 @@ QByteArray QQmlProfilerData::toByteArray() const
}
QQmlProfilerService::QQmlProfilerService()
- : QQmlDebugService(QLatin1String("CanvasFrameRate"), 1),
+ : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1),
m_enabled(false), m_messageReceived(false)
{
m_timer.start();
diff --git a/src/qml/debugger/qv8debugservice.cpp b/src/qml/debugger/qv8debugservice.cpp
index ee60bff742..a6aeda31d5 100644
--- a/src/qml/debugger/qv8debugservice.cpp
+++ b/src/qml/debugger/qv8debugservice.cpp
@@ -120,7 +120,7 @@ public:
QV8DebugService::QV8DebugService(QObject *parent)
: QQmlDebugService(*(new QV8DebugServicePrivate()),
- QLatin1String("V8Debugger"), 2, parent)
+ QStringLiteral("V8Debugger"), 2, parent)
{
Q_D(QV8DebugService);
v8ServiceInstancePtr = this;
diff --git a/src/qml/debugger/qv8profilerservice.cpp b/src/qml/debugger/qv8profilerservice.cpp
index 6473a2f4fb..6208676522 100644
--- a/src/qml/debugger/qv8profilerservice.cpp
+++ b/src/qml/debugger/qv8profilerservice.cpp
@@ -101,7 +101,7 @@ public:
};
QV8ProfilerService::QV8ProfilerService(QObject *parent)
- : QQmlDebugService(*(new QV8ProfilerServicePrivate()), QLatin1String("V8Profiler"), 1, parent)
+ : QQmlDebugService(*(new QV8ProfilerServicePrivate()), QStringLiteral("V8Profiler"), 1, parent)
{
Q_D(QV8ProfilerService);
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index b3897637e8..5d26197b1c 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -46,7 +46,11 @@ SOURCES += \
$$PWD/qqmlimport.cpp \
$$PWD/qqmllist.cpp \
$$PWD/qqmllocale.cpp \
- $$PWD/qlistmodelinterface.cpp
+ $$PWD/qlistmodelinterface.cpp \
+ $$PWD/qqmlabstractexpression.cpp \
+ $$PWD/qqmljavascriptexpression.cpp \
+ $$PWD/qqmlabstractbinding.cpp \
+ $$PWD/qqmlvaluetypeproxybinding.cpp \
HEADERS += \
$$PWD/qqmlglobal_p.h \
@@ -59,7 +63,6 @@ HEADERS += \
$$PWD/qqml.h \
$$PWD/qquickapplication_p.h \
$$PWD/qqmlbinding_p.h \
- $$PWD/qqmlbinding_p_p.h \
$$PWD/qqmlproperty.h \
$$PWD/qqmlcomponent.h \
$$PWD/qqmlcomponent_p.h \
@@ -114,7 +117,11 @@ HEADERS += \
$$PWD/qqmlscriptstring_p.h \
$$PWD/qqmllocale_p.h \
$$PWD/qlistmodelinterface_p.h \
- $$PWD/qqmlcomponentattached_p.h
+ $$PWD/qqmlcomponentattached_p.h \
+ $$PWD/qqmlabstractexpression_p.h \
+ $$PWD/qqmljavascriptexpression_p.h \
+ $$PWD/qqmlabstractbinding_p.h \
+ $$PWD/qqmlvaluetypeproxybinding_p.h \
include(parser/parser.pri)
include(rewriter/rewriter.pri)
diff --git a/src/qml/qml/qqmlabstractbinding.cpp b/src/qml/qml/qqmlabstractbinding.cpp
new file mode 100644
index 0000000000..acc207e970
--- /dev/null
+++ b/src/qml/qml/qqmlabstractbinding.cpp
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlabstractbinding_p.h"
+
+#include <QtQml/qqmlinfo.h>
+#include <private/qqmlbinding_p.h>
+#include <private/qqmlvaluetypeproxybinding_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQmlAbstractBinding::QQmlAbstractBinding()
+: m_prevBinding(0), m_nextBinding(0)
+{
+}
+
+QQmlAbstractBinding::~QQmlAbstractBinding()
+{
+ Q_ASSERT(m_prevBinding == 0);
+ Q_ASSERT(*m_mePtr == 0);
+}
+
+/*!
+Destroy the binding. Use this instead of calling delete.
+
+Bindings are free to implement their own memory management, so the delete operator is not
+necessarily safe. The default implementation clears the binding, removes it from the object
+and calls delete.
+*/
+void QQmlAbstractBinding::destroy()
+{
+ removeFromObject();
+ clear();
+
+ delete this;
+}
+
+/*!
+Add this binding to \a object.
+
+This transfers ownership of the binding to the object, marks the object's property as
+being bound.
+
+However, it does not enable the binding itself or call update() on it.
+*/
+void QQmlAbstractBinding::addToObject()
+{
+ Q_ASSERT(!m_prevBinding);
+
+ QObject *obj = object();
+ Q_ASSERT(obj);
+
+ int index = propertyIndex();
+
+ QQmlData *data = QQmlData::get(obj, true);
+
+ if (index & 0xFF000000) {
+ // Value type
+
+ int coreIndex = index & 0xFFFFFF;
+
+ // Find the value type proxy (if there is one)
+ QQmlValueTypeProxyBinding *proxy = 0;
+ if (data->hasBindingBit(coreIndex)) {
+ QQmlAbstractBinding *b = data->bindings;
+ while (b && b->propertyIndex() != coreIndex)
+ b = b->m_nextBinding;
+ Q_ASSERT(b && b->bindingType() == QQmlAbstractBinding::ValueTypeProxy);
+ proxy = static_cast<QQmlValueTypeProxyBinding *>(b);
+ }
+
+ if (!proxy) {
+ proxy = new QQmlValueTypeProxyBinding(obj, coreIndex);
+
+ Q_ASSERT(proxy->propertyIndex() == coreIndex);
+ Q_ASSERT(proxy->object() == obj);
+
+ proxy->addToObject();
+ }
+
+ m_nextBinding = proxy->m_bindings;
+ if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
+ m_prevBinding = &proxy->m_bindings;
+ proxy->m_bindings = this;
+
+ } else {
+ m_nextBinding = data->bindings;
+ if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
+ m_prevBinding = &data->bindings;
+ data->bindings = this;
+
+ data->setBindingBit(obj, index);
+ }
+}
+
+/*!
+Remove the binding from the object.
+*/
+void QQmlAbstractBinding::removeFromObject()
+{
+ if (m_prevBinding) {
+ int index = propertyIndex();
+
+ *m_prevBinding = m_nextBinding;
+ if (m_nextBinding) m_nextBinding->m_prevBinding = m_prevBinding;
+ m_prevBinding = 0;
+ m_nextBinding = 0;
+
+ if (index & 0xFF000000) {
+ // Value type - we don't remove the proxy from the object. It will sit their happily
+ // doing nothing until it is removed by a write, a binding change or it is reused
+ // to hold more sub-bindings.
+ } else if (QObject *obj = object()) {
+ QQmlData *data = QQmlData::get(obj, false);
+ if (data) data->clearBindingBit(index);
+ }
+ }
+}
+
+void QQmlAbstractBinding::printBindingLoopError(QQmlProperty &prop)
+{
+ qmlInfo(prop.object()) << QString(QLatin1String("Binding loop detected for property \"%1\"")).arg(prop.name());
+}
+
+
+static void bindingDummyDeleter(QQmlAbstractBinding *)
+{
+}
+
+QQmlAbstractBinding::Pointer QQmlAbstractBinding::weakPointer()
+{
+ if (m_mePtr.value().isNull())
+ m_mePtr.value() = QSharedPointer<QQmlAbstractBinding>(this, bindingDummyDeleter);
+
+ return m_mePtr.value().toWeakRef();
+}
+
+void QQmlAbstractBinding::clear()
+{
+ if (!m_mePtr.isNull()) {
+ **m_mePtr = 0;
+ m_mePtr = 0;
+ }
+}
+
+void QQmlAbstractBinding::retargetBinding(QObject *, int)
+{
+ qFatal("QQmlAbstractBinding::retargetBinding() called on illegal binding.");
+}
+
+QString QQmlAbstractBinding::expression() const
+{
+ return QLatin1String("<Unknown>");
+}
+
+void QQmlAbstractBinding::setEnabled(bool enabled, QQmlPropertyPrivate::WriteFlags flags)
+{
+ if (enabled) update(flags);
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h
new file mode 100644
index 0000000000..8c4aa4affc
--- /dev/null
+++ b/src/qml/qml/qqmlabstractbinding_p.h
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLABSTRACTBINDING_P_H
+#define QQMLABSTRACTBINDING_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qsharedpointer.h>
+#include <private/qtqmlglobal_p.h>
+#include <private/qqmlproperty_p.h>
+#include <private/qpointervaluepair_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QML_PRIVATE_EXPORT QQmlAbstractBinding
+{
+public:
+ typedef QWeakPointer<QQmlAbstractBinding> Pointer;
+
+ QQmlAbstractBinding();
+
+ virtual void destroy();
+
+ virtual QString expression() const;
+
+ enum Type { PropertyBinding, ValueTypeProxy };
+ virtual Type bindingType() const { return PropertyBinding; }
+
+ // Should return the encoded property index for the binding. Should return this value
+ // even if the binding is not enabled or added to an object.
+ // Encoding is: coreIndex | (valueTypeIndex << 24)
+ virtual int propertyIndex() const = 0;
+ // Should return the object for the binding. Should return this object even if the
+ // binding is not enabled or added to the object.
+ virtual QObject *object() const = 0;
+
+ void setEnabled(bool e) { setEnabled(e, QQmlPropertyPrivate::DontRemoveBinding); }
+ virtual void setEnabled(bool, QQmlPropertyPrivate::WriteFlags) = 0;
+
+ void update() { update(QQmlPropertyPrivate::DontRemoveBinding); }
+ virtual void update(QQmlPropertyPrivate::WriteFlags) = 0;
+
+ void addToObject();
+ void removeFromObject();
+
+ static inline Pointer getPointer(QQmlAbstractBinding *p);
+ static void printBindingLoopError(QQmlProperty &prop);
+
+protected:
+ virtual ~QQmlAbstractBinding();
+ void clear();
+
+ // Called by QQmlPropertyPrivate to "move" a binding to a different property.
+ // This is only used for alias properties, and only used by QQmlBinding not
+ // V8 or V4 bindings. The default implementation qFatal()'s to ensure that the
+ // method is never called for V4 or V8 bindings.
+ virtual void retargetBinding(QObject *, int);
+private:
+ Pointer weakPointer();
+
+ friend class QQmlData;
+ friend class QQmlComponentPrivate;
+ friend class QQmlValueTypeProxyBinding;
+ friend class QQmlPropertyPrivate;
+ friend class QQmlVME;
+ friend class QtSharedPointer::ExternalRefCount<QQmlAbstractBinding>;
+
+ typedef QSharedPointer<QQmlAbstractBinding> SharedPointer;
+ // To save memory, we also store the rarely used weakPointer() instance in here
+ QPointerValuePair<QQmlAbstractBinding*, SharedPointer> m_mePtr;
+
+ QQmlAbstractBinding **m_prevBinding;
+ QQmlAbstractBinding *m_nextBinding;
+};
+
+QQmlAbstractBinding::Pointer
+QQmlAbstractBinding::getPointer(QQmlAbstractBinding *p)
+{
+ return p ? p->weakPointer() : Pointer();
+}
+
+QT_END_NAMESPACE
+
+#endif // QQMLABSTRACTBINDING_P_H
diff --git a/src/qml/qml/qqmlabstractexpression.cpp b/src/qml/qml/qqmlabstractexpression.cpp
new file mode 100644
index 0000000000..8319f7a619
--- /dev/null
+++ b/src/qml/qml/qqmlabstractexpression.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlabstractexpression_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QQmlAbstractExpression::QQmlAbstractExpression()
+: m_prevExpression(0), m_nextExpression(0)
+{
+}
+
+QQmlAbstractExpression::~QQmlAbstractExpression()
+{
+ if (m_prevExpression) {
+ *m_prevExpression = m_nextExpression;
+ if (m_nextExpression)
+ m_nextExpression->m_prevExpression = m_prevExpression;
+ }
+
+ if (m_context.isT2())
+ m_context.asT2()->_s = 0;
+}
+
+QQmlContextData *QQmlAbstractExpression::context() const
+{
+ if (m_context.isT1()) return m_context.asT1();
+ else return m_context.asT2()->_c;
+}
+
+void QQmlAbstractExpression::setContext(QQmlContextData *context)
+{
+ if (m_prevExpression) {
+ *m_prevExpression = m_nextExpression;
+ if (m_nextExpression)
+ m_nextExpression->m_prevExpression = m_prevExpression;
+ m_prevExpression = 0;
+ m_nextExpression = 0;
+ }
+
+ if (m_context.isT1()) m_context = context;
+ else m_context.asT2()->_c = context;
+
+ if (context) {
+ m_nextExpression = context->expressions;
+ if (m_nextExpression)
+ m_nextExpression->m_prevExpression = &m_nextExpression;
+ m_prevExpression = &context->expressions;
+ context->expressions = this;
+ }
+}
+
+void QQmlAbstractExpression::refresh()
+{
+}
+
+bool QQmlAbstractExpression::isValid() const
+{
+ return context() != 0;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/qml/qml/qqmlabstractexpression_p.h b/src/qml/qml/qqmlabstractexpression_p.h
new file mode 100644
index 0000000000..fe2ee1762b
--- /dev/null
+++ b/src/qml/qml/qqmlabstractexpression_p.h
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLABSTRACTEXPRESSION_P_H
+#define QQMLABSTRACTEXPRESSION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qqmlcontext_p.h>
+#include <private/qfieldlist_p.h>
+#include <private/qflagpointer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlAbstractExpression
+{
+public:
+ QQmlAbstractExpression();
+ virtual ~QQmlAbstractExpression();
+
+ bool isValid() const;
+
+ QQmlContextData *context() const;
+ void setContext(QQmlContextData *);
+
+ virtual void refresh();
+
+ class DeleteWatcher {
+ public:
+ inline DeleteWatcher(QQmlAbstractExpression *);
+ inline ~DeleteWatcher();
+ inline bool wasDeleted() const;
+ private:
+ friend class QQmlAbstractExpression;
+ QQmlContextData *_c;
+ QQmlAbstractExpression **_w;
+ QQmlAbstractExpression *_s;
+ };
+
+private:
+ friend class QQmlContext;
+ friend class QQmlContextData;
+ friend class QQmlContextPrivate;
+
+ QBiPointer<QQmlContextData, DeleteWatcher> m_context;
+ QQmlAbstractExpression **m_prevExpression;
+ QQmlAbstractExpression *m_nextExpression;
+};
+
+QQmlAbstractExpression::DeleteWatcher::DeleteWatcher(QQmlAbstractExpression *e)
+: _c(0), _w(0), _s(e)
+{
+ if (e->m_context.isT1()) {
+ _w = &_s;
+ _c = e->m_context.asT1();
+ e->m_context = this;
+ } else {
+ // Another watcher is already registered
+ _w = &e->m_context.asT2()->_s;
+ }
+}
+
+QQmlAbstractExpression::DeleteWatcher::~DeleteWatcher()
+{
+ Q_ASSERT(*_w == 0 || (*_w == _s && _s->m_context.isT2()));
+ if (*_w && _s->m_context.asT2() == this)
+ _s->m_context = _c;
+}
+
+bool QQmlAbstractExpression::DeleteWatcher::wasDeleted() const
+{
+ return *_w == 0;
+}
+
+QT_END_NAMESPACE
+
+#endif // QQMLABSTRACTEXPRESSION_P_H
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index bb6eb3b723..f43822ed0e 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qqmlbinding_p.h"
-#include "qqmlbinding_p_p.h"
#include "qqml.h"
#include "qqmlcontext.h"
@@ -49,175 +48,19 @@
#include "qqmldata_p.h"
#include <private/qqmlprofilerservice_p.h>
#include <private/qqmltrace_p.h>
+#include <private/qqmlexpression_p.h>
+#include <private/qqmlrewrite_p.h>
#include <QVariant>
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-QQmlAbstractBinding::QQmlAbstractBinding()
-: m_prevBinding(0), m_nextBinding(0)
-{
-}
-
-QQmlAbstractBinding::~QQmlAbstractBinding()
-{
- Q_ASSERT(m_prevBinding == 0);
- Q_ASSERT(*m_mePtr == 0);
-}
-
-/*!
-Destroy the binding. Use this instead of calling delete.
-
-Bindings are free to implement their own memory management, so the delete operator is not
-necessarily safe. The default implementation clears the binding, removes it from the object
-and calls delete.
-*/
-void QQmlAbstractBinding::destroy()
-{
- removeFromObject();
- clear();
-
- delete this;
-}
-
-/*!
-Add this binding to \a object.
-
-This transfers ownership of the binding to the object, marks the object's property as
-being bound.
-
-However, it does not enable the binding itself or call update() on it.
-*/
-void QQmlAbstractBinding::addToObject()
-{
- Q_ASSERT(!m_prevBinding);
-
- QObject *obj = object();
- Q_ASSERT(obj);
-
- int index = propertyIndex();
-
- QQmlData *data = QQmlData::get(obj, true);
-
- if (index & 0xFF000000) {
- // Value type
-
- int coreIndex = index & 0xFFFFFF;
-
- // Find the value type proxy (if there is one)
- QQmlValueTypeProxyBinding *proxy = 0;
- if (data->hasBindingBit(coreIndex)) {
- QQmlAbstractBinding *b = data->bindings;
- while (b && b->propertyIndex() != coreIndex)
- b = b->m_nextBinding;
- Q_ASSERT(b && b->bindingType() == QQmlAbstractBinding::ValueTypeProxy);
- proxy = static_cast<QQmlValueTypeProxyBinding *>(b);
- }
-
- if (!proxy) {
- proxy = new QQmlValueTypeProxyBinding(obj, coreIndex);
-
- Q_ASSERT(proxy->propertyIndex() == coreIndex);
- Q_ASSERT(proxy->object() == obj);
-
- proxy->addToObject();
- }
-
- m_nextBinding = proxy->m_bindings;
- if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
- m_prevBinding = &proxy->m_bindings;
- proxy->m_bindings = this;
-
- } else {
- m_nextBinding = data->bindings;
- if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
- m_prevBinding = &data->bindings;
- data->bindings = this;
-
- data->setBindingBit(obj, index);
- }
-}
-
-/*!
-Remove the binding from the object.
-*/
-void QQmlAbstractBinding::removeFromObject()
-{
- if (m_prevBinding) {
- int index = propertyIndex();
-
- *m_prevBinding = m_nextBinding;
- if (m_nextBinding) m_nextBinding->m_prevBinding = m_prevBinding;
- m_prevBinding = 0;
- m_nextBinding = 0;
-
- if (index & 0xFF000000) {
- // Value type - we don't remove the proxy from the object. It will sit their happily
- // doing nothing until it is removed by a write, a binding change or it is reused
- // to hold more sub-bindings.
- } else if (QObject *obj = object()) {
- QQmlData *data = QQmlData::get(obj, false);
- if (data) data->clearBindingBit(index);
- }
- }
-}
-
-static void bindingDummyDeleter(QQmlAbstractBinding *)
-{
-}
-
-QQmlAbstractBinding::Pointer QQmlAbstractBinding::weakPointer()
-{
- if (m_mePtr.value().isNull())
- m_mePtr.value() = QSharedPointer<QQmlAbstractBinding>(this, bindingDummyDeleter);
-
- return m_mePtr.value().toWeakRef();
-}
-
-void QQmlAbstractBinding::clear()
-{
- if (!m_mePtr.isNull()) {
- **m_mePtr = 0;
- m_mePtr = 0;
- }
-}
-
-void QQmlAbstractBinding::retargetBinding(QObject *, int)
-{
- qFatal("QQmlAbstractBinding::retargetBinding() called on illegal binding.");
-}
-
-QString QQmlAbstractBinding::expression() const
-{
- return QLatin1String("<Unknown>");
-}
-
-void QQmlAbstractBinding::setEnabled(bool enabled, QQmlPropertyPrivate::WriteFlags flags)
-{
- if (enabled) update(flags);
-}
-
QQmlBinding::Identifier QQmlBinding::Invalid = -1;
-void QQmlBindingPrivate::refresh()
-{
- Q_Q(QQmlBinding);
- q->update();
-}
-
-QQmlBindingPrivate::QQmlBindingPrivate()
-: updating(false), enabled(false), target(), targetProperty(0)
-{
-}
-
-QQmlBindingPrivate::~QQmlBindingPrivate()
-{
-}
-
QQmlBinding *
QQmlBinding::createBinding(Identifier id, QObject *obj, QQmlContext *ctxt,
- const QString &url, int lineNumber, QObject *parent)
+ const QString &url, int lineNumber)
{
if (id < 0)
return 0;
@@ -231,7 +74,8 @@ QQmlBinding::createBinding(Identifier id, QObject *obj, QQmlContext *ctxt,
typeData = engine->typeLoader.get(ctxtdata->url);
cdata = typeData->compiledData();
}
- QQmlBinding *rv = cdata ? new QQmlBinding(cdata->primitives.at(id), true, obj, ctxtdata, url, lineNumber, 0, parent) : 0;
+ QQmlBinding *rv = cdata ? new QQmlBinding(cdata->primitives.at(id), true, obj, ctxtdata,
+ url, lineNumber, 0) : 0;
if (cdata)
cdata->release();
if (typeData)
@@ -239,30 +83,62 @@ QQmlBinding::createBinding(Identifier id, QObject *obj, QQmlContext *ctxt,
return rv;
}
-QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContext *ctxt,
- QObject *parent)
-: QQmlExpression(QQmlContextData::get(ctxt), obj, str, *new QQmlBindingPrivate)
+static QQmlJavaScriptExpression::VTable QQmlBinding_jsvtable = {
+ QQmlBinding::expressionIdentifier,
+ QQmlBinding::expressionChanged
+};
+
+QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContext *ctxt)
+: QQmlJavaScriptExpression(&QQmlBinding_jsvtable), m_lineNumber(-1), m_columnNumber(-1)
{
- setParent(parent);
setNotifyOnValueChanged(true);
+ QQmlAbstractExpression::setContext(QQmlContextData::get(ctxt));
+ setScopeObject(obj);
+
+ QQmlRewrite::RewriteBinding rewriteBinding;
+ QString code = rewriteBinding(str);
+
+ m_expression = str.toUtf8();
+ v8function = evalFunction(context(), obj, code, QString(), 0);
}
-QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContextData *ctxt,
- QObject *parent)
-: QQmlExpression(ctxt, obj, str, *new QQmlBindingPrivate)
+QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContextData *ctxt)
+: QQmlJavaScriptExpression(&QQmlBinding_jsvtable), m_lineNumber(-1), m_columnNumber(-1)
{
- setParent(parent);
setNotifyOnValueChanged(true);
+ QQmlAbstractExpression::setContext(ctxt);
+ setScopeObject(obj);
+
+ QQmlRewrite::RewriteBinding rewriteBinding;
+ QString code = rewriteBinding(str);
+
+ m_expression = str.toUtf8();
+ v8function = evalFunction(ctxt, obj, code, QString(), 0);
}
QQmlBinding::QQmlBinding(const QString &str, bool isRewritten, QObject *obj,
- QQmlContextData *ctxt,
- const QString &url, int lineNumber, int columnNumber,
- QObject *parent)
-: QQmlExpression(ctxt, obj, str, isRewritten, url, lineNumber, columnNumber, *new QQmlBindingPrivate)
+ QQmlContextData *ctxt,
+ const QString &url, int lineNumber, int columnNumber)
+: QQmlJavaScriptExpression(&QQmlBinding_jsvtable), m_lineNumber(-1), m_columnNumber(-1)
{
- setParent(parent);
setNotifyOnValueChanged(true);
+ QQmlAbstractExpression::setContext(ctxt);
+ setScopeObject(obj);
+
+ QString code;
+ if (isRewritten) {
+ code = str;
+ } else {
+ QQmlRewrite::RewriteBinding rewriteBinding;
+ code = rewriteBinding(str);
+ }
+
+ m_url = url;
+ m_lineNumber = lineNumber;
+ m_columnNumber = columnNumber;
+ m_expression = str.toUtf8();
+
+ v8function = evalFunction(ctxt, obj, code, url, lineNumber);
}
/*!
@@ -273,124 +149,100 @@ QQmlBinding::QQmlBinding(const QString &str, bool isRewritten, QObject *obj,
v8::Handle<v8::Function> function;
new QQmlBinding(&function, scope, ctxt);
*/
-QQmlBinding::QQmlBinding(void *functionPtr, QObject *obj, QQmlContextData *ctxt,
- QObject *parent)
-: QQmlExpression(ctxt, obj, functionPtr, *new QQmlBindingPrivate)
+QQmlBinding::QQmlBinding(void *functionPtr, QObject *obj, QQmlContextData *ctxt,
+ const QString &url, int lineNumber, int columnNumber)
+: QQmlJavaScriptExpression(&QQmlBinding_jsvtable),
+ m_url(url), m_lineNumber(lineNumber), m_columnNumber(columnNumber)
{
- setParent(parent);
setNotifyOnValueChanged(true);
-}
-
-QQmlBinding::~QQmlBinding()
-{
-}
-
-void QQmlBinding::setTarget(const QQmlProperty &prop)
-{
- Q_D(QQmlBinding);
- d->property = prop;
- d->target = d->property.object();
- d->targetProperty = QQmlPropertyPrivate::get(d->property)->core.encodedIndex();
+ QQmlAbstractExpression::setContext(ctxt);
+ setScopeObject(obj);
- update();
+ v8function = qPersistentNew<v8::Function>(*(v8::Handle<v8::Function> *)functionPtr);
}
-void QQmlBinding::setTarget(QObject *object,
- const QQmlPropertyData &core,
- QQmlContextData *ctxt)
+QQmlBinding::~QQmlBinding()
{
- Q_D(QQmlBinding);
- d->property = QQmlPropertyPrivate::restore(object, core, ctxt);
- d->target = d->property.object();
- d->targetProperty = QQmlPropertyPrivate::get(d->property)->core.encodedIndex();
-
- update();
+ qPersistentDispose(v8function);
}
-QQmlProperty QQmlBinding::property() const
+void QQmlBinding::setEvaluateFlags(EvaluateFlags flags)
{
- Q_D(const QQmlBinding);
- return d->property;
+ setRequiresThisObject(flags & RequiresThisObject);
}
-void QQmlBinding::setEvaluateFlags(EvaluateFlags flags)
+QQmlBinding::EvaluateFlags QQmlBinding::evaluateFlags() const
{
- Q_D(QQmlBinding);
- d->setRequiresThisObject(flags & RequiresThisObject);
+ return requiresThisObject()?RequiresThisObject:None;
}
-QQmlBinding::EvaluateFlags QQmlBinding::evaluateFlags() const
+void QQmlBinding::setNotifyOnValueChanged(bool v)
{
- Q_D(const QQmlBinding);
- return d->requiresThisObject()?RequiresThisObject:None;
+ QQmlJavaScriptExpression::setNotifyOnValueChanged(v);
}
void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
{
- Q_D(QQmlBinding);
-
- if (!d->enabled || !d->context() || !d->context()->isValid())
+ if (!enabledFlag() || !context() || !context()->isValid())
return;
QQmlTrace trace("General Binding Update");
- trace.addDetail("URL", d->url);
- trace.addDetail("Line", d->line);
- trace.addDetail("Column", d->columnNumber);
+ trace.addDetail("URL", m_url);
+ trace.addDetail("Line", m_lineNumber);
+ trace.addDetail("Column", m_columnNumber);
- if (!d->updating) {
- QQmlBindingProfiler prof(d->url, d->line, d->column);
+ if (!updatingFlag()) {
+ QQmlBindingProfiler prof(m_url, m_lineNumber, m_columnNumber);
if (prof.enabled)
prof.addDetail(expression());
- d->updating = true;
+ setUpdatingFlag(true);
- QQmlAbstractExpression::DeleteWatcher watcher(d);
+ QQmlAbstractExpression::DeleteWatcher watcher(this);
- if (d->property.propertyType() == qMetaTypeId<QQmlBinding *>()) {
+ if (m_core.propType == qMetaTypeId<QQmlBinding *>()) {
- int idx = d->property.index();
+ int idx = m_core.coreIndex;
Q_ASSERT(idx != -1);
QQmlBinding *t = this;
int status = -1;
void *a[] = { &t, 0, &status, &flags };
- QMetaObject::metacall(d->property.object(),
- QMetaObject::WriteProperty,
- idx, a);
+ QMetaObject::metacall(*m_coreObject, QMetaObject::WriteProperty, idx, a);
} else {
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(d->context()->engine);
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context()->engine);
ep->referenceScarceResources();
bool isUndefined = false;
v8::HandleScope handle_scope;
v8::Context::Scope scope(ep->v8engine()->context());
- v8::Local<v8::Value> result = d->v8value(0, &isUndefined);
+ v8::Local<v8::Value> result =
+ QQmlJavaScriptExpression::evaluate(context(), v8function, &isUndefined);
trace.event("writing binding result");
bool needsErrorData = false;
- if (!watcher.wasDeleted() && !d->hasError())
- needsErrorData = !QQmlPropertyPrivate::writeBinding(d->property, d->context(),
- d, result,
- isUndefined, flags);
+ if (!watcher.wasDeleted() && !hasError())
+ needsErrorData = !QQmlPropertyPrivate::writeBinding(*m_coreObject, m_core, context(),
+ this, result, isUndefined, flags);
if (!watcher.wasDeleted()) {
if (needsErrorData) {
- QUrl url = QUrl(d->url);
- int line = d->line;
+ QUrl url = QUrl(m_url);
+
if (url.isEmpty()) url = QUrl(QLatin1String("<Unknown File>"));
- d->delayedError()->error.setUrl(url);
- d->delayedError()->error.setLine(line);
- d->delayedError()->error.setColumn(-1);
+ delayedError()->error.setUrl(url);
+ delayedError()->error.setLine(m_lineNumber);
+ delayedError()->error.setColumn(m_columnNumber);
}
- if (d->hasError()) {
- if (!d->delayedError()->addError(ep)) ep->warning(this->error());
+ if (hasError()) {
+ if (!delayedError()->addError(ep)) ep->warning(this->error());
} else {
- d->clearError();
+ clearError();
}
}
@@ -399,154 +251,96 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
}
if (!watcher.wasDeleted())
- d->updating = false;
+ setUpdatingFlag(false);
} else {
- QQmlBindingPrivate::printBindingLoopError(d->property);
+ QQmlProperty p = property();
+ QQmlAbstractBinding::printBindingLoopError(p);
}
}
-void QQmlBindingPrivate::printBindingLoopError(QQmlProperty &prop)
+QVariant QQmlBinding::evaluate()
{
- qmlInfo(prop.object()) << QQmlBinding::tr("Binding loop detected for property \"%1\"").arg(prop.name());
-}
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context()->engine);
+ ep->referenceScarceResources();
-void QQmlBindingPrivate::expressionChanged()
-{
- Q_Q(QQmlBinding);
- q->update();
-}
+ bool isUndefined = false;
-void QQmlBinding::setEnabled(bool e, QQmlPropertyPrivate::WriteFlags flags)
-{
- Q_D(QQmlBinding);
- d->enabled = e;
- setNotifyOnValueChanged(e);
-
- if (e)
- update(flags);
-}
+ v8::HandleScope handle_scope;
+ v8::Context::Scope scope(ep->v8engine()->context());
+ v8::Local<v8::Value> result =
+ QQmlJavaScriptExpression::evaluate(context(), v8function, &isUndefined);
-bool QQmlBinding::enabled() const
-{
- Q_D(const QQmlBinding);
+ ep->dereferenceScarceResources();
- return d->enabled;
+ return ep->v8engine()->toVariant(result, qMetaTypeId<QList<QObject*> >());
}
-QString QQmlBinding::expression() const
+QString QQmlBinding::expressionIdentifier(QQmlJavaScriptExpression *e)
{
- return QQmlExpression::expression();
-}
+ QQmlBinding *This = static_cast<QQmlBinding *>(e);
-int QQmlBinding::propertyIndex() const
-{
- Q_D(const QQmlBinding);
- return d->targetProperty;
+ return QLatin1String("\"") + QString::fromUtf8(This->m_expression) + QLatin1String("\"");
}
-QObject *QQmlBinding::object() const
-{
- Q_D(const QQmlBinding);
- return d->target;
-}
-
-void QQmlBinding::retargetBinding(QObject *t, int i)
+void QQmlBinding::expressionChanged(QQmlJavaScriptExpression *e)
{
- Q_D(QQmlBinding);
- d->target = t;
- d->targetProperty = i;
+ QQmlBinding *This = static_cast<QQmlBinding *>(e);
+ This->update();
}
-QQmlValueTypeProxyBinding::QQmlValueTypeProxyBinding(QObject *o, int index)
-: m_object(o), m_index(index), m_bindings(0)
+void QQmlBinding::refresh()
{
+ update();
}
-QQmlValueTypeProxyBinding::~QQmlValueTypeProxyBinding()
+void QQmlBinding::setEnabled(bool e, QQmlPropertyPrivate::WriteFlags flags)
{
- while (m_bindings) {
- QQmlAbstractBinding *binding = m_bindings;
- binding->setEnabled(false, 0);
- binding->destroy();
- }
-}
+ setEnabledFlag(e);
+ setNotifyOnValueChanged(e);
-void QQmlValueTypeProxyBinding::setEnabled(bool e, QQmlPropertyPrivate::WriteFlags flags)
-{
- if (e) {
- QQmlAbstractBinding *bindings = m_bindings;
- recursiveEnable(bindings, flags);
- } else {
- QQmlAbstractBinding *bindings = m_bindings;
- recursiveDisable(bindings);
- }
+ if (e)
+ update(flags);
}
-void QQmlValueTypeProxyBinding::recursiveEnable(QQmlAbstractBinding *b, QQmlPropertyPrivate::WriteFlags flags)
+QString QQmlBinding::expression() const
{
- if (!b)
- return;
-
- recursiveEnable(b->m_nextBinding, flags);
-
- if (b)
- b->setEnabled(true, flags);
+ return QString::fromUtf8(m_expression);
}
-void QQmlValueTypeProxyBinding::recursiveDisable(QQmlAbstractBinding *b)
+QObject *QQmlBinding::object() const
{
- if (!b)
- return;
-
- recursiveDisable(b->m_nextBinding);
-
- if (b)
- b->setEnabled(false, 0);
+ if (m_coreObject.hasValue()) return m_coreObject.constValue()->target;
+ else return *m_coreObject;
}
-void QQmlValueTypeProxyBinding::update(QQmlPropertyPrivate::WriteFlags)
+int QQmlBinding::propertyIndex() const
{
+ if (m_coreObject.hasValue()) return m_coreObject.constValue()->targetProperty;
+ else return m_core.encodedIndex();
}
-QQmlAbstractBinding *QQmlValueTypeProxyBinding::binding(int propertyIndex)
+void QQmlBinding::retargetBinding(QObject *t, int i)
{
- QQmlAbstractBinding *binding = m_bindings;
-
- while (binding && binding->propertyIndex() != propertyIndex)
- binding = binding->m_nextBinding;
-
- return binding;
+ m_coreObject.value().target = t;
+ m_coreObject.value().targetProperty = i;
}
-/*!
-Removes a collection of bindings, corresponding to the set bits in \a mask.
-*/
-void QQmlValueTypeProxyBinding::removeBindings(quint32 mask)
+void QQmlBinding::setTarget(const QQmlProperty &prop)
{
- QQmlAbstractBinding *binding = m_bindings;
- while (binding) {
- if (mask & (1 << (binding->propertyIndex() >> 24))) {
- QQmlAbstractBinding *remove = binding;
- binding = remove->m_nextBinding;
- *remove->m_prevBinding = remove->m_nextBinding;
- if (remove->m_nextBinding) remove->m_nextBinding->m_prevBinding = remove->m_prevBinding;
- remove->m_prevBinding = 0;
- remove->m_nextBinding = 0;
- remove->destroy();
- } else {
- binding = binding->m_nextBinding;
- }
- }
+ setTarget(prop.object(), QQmlPropertyPrivate::get(prop)->core,
+ QQmlPropertyPrivate::get(prop)->context);
}
-int QQmlValueTypeProxyBinding::propertyIndex() const
+void QQmlBinding::setTarget(QObject *object, const QQmlPropertyData &core, QQmlContextData *ctxt)
{
- return m_index;
+ m_coreObject = object;
+ m_core = core;
+ m_ctxt = ctxt;
}
-QObject *QQmlValueTypeProxyBinding::object() const
+QQmlProperty QQmlBinding::property() const
{
- return m_object;
+ return QQmlPropertyPrivate::restore(object(), m_core, *m_ctxt);
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h
index 33823d7e7e..2cf7b80290 100644
--- a/src/qml/qml/qqmlbinding_p.h
+++ b/src/qml/qml/qqmlbinding_p.h
@@ -63,113 +63,27 @@
#include <QtCore/QMetaProperty>
#include <private/qpointervaluepair_p.h>
+#include <private/qqmlabstractbinding_p.h>
+#include <private/qqmlabstractexpression_p.h>
+#include <private/qqmljavascriptexpression_p.h>
QT_BEGIN_NAMESPACE
-class Q_QML_PRIVATE_EXPORT QQmlAbstractBinding
-{
-public:
- typedef QWeakPointer<QQmlAbstractBinding> Pointer;
-
- QQmlAbstractBinding();
-
- virtual void destroy();
-
- virtual QString expression() const;
-
- enum Type { PropertyBinding, ValueTypeProxy };
- virtual Type bindingType() const { return PropertyBinding; }
-
- // Should return the encoded property index for the binding. Should return this value
- // even if the binding is not enabled or added to an object.
- // Encoding is: coreIndex | (valueTypeIndex << 24)
- virtual int propertyIndex() const = 0;
- // Should return the object for the binding. Should return this object even if the
- // binding is not enabled or added to the object.
- virtual QObject *object() const = 0;
-
- void setEnabled(bool e) { setEnabled(e, QQmlPropertyPrivate::DontRemoveBinding); }
- virtual void setEnabled(bool, QQmlPropertyPrivate::WriteFlags) = 0;
-
- void update() { update(QQmlPropertyPrivate::DontRemoveBinding); }
- virtual void update(QQmlPropertyPrivate::WriteFlags) = 0;
-
- void addToObject();
- void removeFromObject();
-
- static inline Pointer getPointer(QQmlAbstractBinding *p);
-
-protected:
- virtual ~QQmlAbstractBinding();
- void clear();
-
- // Called by QQmlPropertyPrivate to "move" a binding to a different property.
- // This is only used for alias properties, and only used by QQmlBinding not
- // V8 or V4 bindings. The default implementation qFatal()'s to ensure that the
- // method is never called for V4 or V8 bindings.
- virtual void retargetBinding(QObject *, int);
-private:
- Pointer weakPointer();
-
- friend class QQmlData;
- friend class QQmlComponentPrivate;
- friend class QQmlValueTypeProxyBinding;
- friend class QQmlPropertyPrivate;
- friend class QQmlVME;
- friend class QtSharedPointer::ExternalRefCount<QQmlAbstractBinding>;
-
- typedef QSharedPointer<QQmlAbstractBinding> SharedPointer;
- // To save memory, we also store the rarely used weakPointer() instance in here
- QPointerValuePair<QQmlAbstractBinding*, SharedPointer> m_mePtr;
-
- QQmlAbstractBinding **m_prevBinding;
- QQmlAbstractBinding *m_nextBinding;
-};
-
-class QQmlValueTypeProxyBinding : public QQmlAbstractBinding
-{
-public:
- QQmlValueTypeProxyBinding(QObject *o, int coreIndex);
-
- virtual Type bindingType() const { return ValueTypeProxy; }
-
- virtual void setEnabled(bool, QQmlPropertyPrivate::WriteFlags);
- virtual void update(QQmlPropertyPrivate::WriteFlags);
- virtual int propertyIndex() const;
- virtual QObject *object() const;
-
- QQmlAbstractBinding *binding(int propertyIndex);
-
- void removeBindings(quint32 mask);
-
-protected:
- ~QQmlValueTypeProxyBinding();
-
-private:
- void recursiveEnable(QQmlAbstractBinding *, QQmlPropertyPrivate::WriteFlags);
- void recursiveDisable(QQmlAbstractBinding *);
-
- friend class QQmlAbstractBinding;
- QObject *m_object;
- int m_index;
- QQmlAbstractBinding *m_bindings;
-};
-
class QQmlContext;
-class QQmlBindingPrivate;
-class Q_QML_PRIVATE_EXPORT QQmlBinding : public QQmlExpression,
- public QQmlAbstractBinding
+class Q_QML_PRIVATE_EXPORT QQmlBinding : public QQmlJavaScriptExpression,
+ public QQmlAbstractExpression,
+ public QQmlAbstractBinding
{
-Q_OBJECT
public:
enum EvaluateFlag { None = 0x00, RequiresThisObject = 0x01 };
Q_DECLARE_FLAGS(EvaluateFlags, EvaluateFlag)
- QQmlBinding(const QString &, QObject *, QQmlContext *, QObject *parent=0);
- QQmlBinding(const QString &, QObject *, QQmlContextData *, QObject *parent=0);
+ QQmlBinding(const QString &, QObject *, QQmlContext *);
+ QQmlBinding(const QString &, QObject *, QQmlContextData *);
QQmlBinding(const QString &, bool isRewritten, QObject *, QQmlContextData *,
- const QString &url, int lineNumber, int columnNumber = 0, QObject *parent=0);
- QQmlBinding(void *, QObject *, QQmlContextData *, QObject *parent=0);
+ const QString &url, int lineNumber, int columnNumber);
+ QQmlBinding(void *, QObject *, QQmlContextData *,
+ const QString &url, int lineNumber, int columnNumber);
void setTarget(const QQmlProperty &);
void setTarget(QObject *, const QQmlPropertyData &, QQmlContextData *);
@@ -178,40 +92,82 @@ public:
void setEvaluateFlags(EvaluateFlags flags);
EvaluateFlags evaluateFlags() const;
- bool enabled() const;
+ void setNotifyOnValueChanged(bool);
+
+ // Inherited from QQmlAbstractExpression
+ virtual void refresh();
// Inherited from QQmlAbstractBinding
virtual void setEnabled(bool, QQmlPropertyPrivate::WriteFlags flags);
virtual void update(QQmlPropertyPrivate::WriteFlags flags);
virtual QString expression() const;
- virtual int propertyIndex() const;
virtual QObject *object() const;
+ virtual int propertyIndex() const;
virtual void retargetBinding(QObject *, int);
typedef int Identifier;
static Identifier Invalid;
- static QQmlBinding *createBinding(Identifier, QObject *, QQmlContext *,
- const QString &, int, QObject *parent=0);
+ static QQmlBinding *createBinding(Identifier, QObject *, QQmlContext *, const QString &, int);
-public Q_SLOTS:
+ QVariant evaluate();
void update() { update(QQmlPropertyPrivate::DontRemoveBinding); }
+ static QString expressionIdentifier(QQmlJavaScriptExpression *);
+ static void expressionChanged(QQmlJavaScriptExpression *);
+
protected:
~QQmlBinding();
private:
- Q_DECLARE_PRIVATE(QQmlBinding)
+ v8::Persistent<v8::Function> v8function;
+
+ inline bool updatingFlag() const;
+ inline void setUpdatingFlag(bool);
+ inline bool enabledFlag() const;
+ inline void setEnabledFlag(bool);
+
+ struct Retarget {
+ QObject *target;
+ int targetProperty;
+ };
+
+ QPointerValuePair<QObject, Retarget> m_coreObject;
+ QQmlPropertyData m_core;
+ // We store some flag bits in the following flag pointers.
+ // m_ctxt:flag1 - updatingFlag
+ // m_ctxt:flag2 - enabledFlag
+ QFlagPointer<QQmlContextData> m_ctxt;
+
+ // XXX It would be good if we could get rid of these in most circumstances
+ QString m_url;
+ int m_lineNumber;
+ int m_columnNumber;
+ QByteArray m_expression;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlBinding::EvaluateFlags)
+bool QQmlBinding::updatingFlag() const
+{
+ return m_ctxt.flag();
+}
-QQmlAbstractBinding::Pointer
-QQmlAbstractBinding::getPointer(QQmlAbstractBinding *p)
+void QQmlBinding::setUpdatingFlag(bool v)
{
- return p ? p->weakPointer() : Pointer();
+ m_ctxt.setFlagValue(v);
}
+bool QQmlBinding::enabledFlag() const
+{
+ return m_ctxt.flag2();
+}
+
+void QQmlBinding::setEnabledFlag(bool v)
+{
+ m_ctxt.setFlag2Value(v);
+}
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlBinding::EvaluateFlags)
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QQmlBinding*)
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 5dd8fc8ae9..6cd5cf6cec 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -50,13 +50,13 @@
#include "qqml.h"
#include "qqmlengine.h"
#include "qqmlbinding_p.h"
-#include "qqmlbinding_p_p.h"
#include "qqmlglobal_p.h"
#include "qqmlscript_p.h"
#include <private/qqmlprofilerservice_p.h>
#include <private/qqmlenginedebugservice_p.h>
#include "qqmlincubator.h"
#include "qqmlincubator_p.h"
+#include <private/qqmljavascriptexpression_p.h>
#include <private/qv8engine_p.h>
#include <private/qv8include_p.h>
@@ -280,6 +280,16 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
\value Error An error has occurred. Call errors() to retrieve a list of \{QQmlError}{errors}.
*/
+/*!
+ \enum QQmlComponent::CompilationMode
+
+ Specifies whether the QQmlComponent should load the component immediately, or asynchonously.
+
+ \value PreferSynchronous Prefer loading/compiling the component immediately, blocking the thread.
+ This is not always possible, e.g. remote URLs will always load asynchronously.
+ \value Asynchronous Load/compile the component in a background thread.
+*/
+
void QQmlComponentPrivate::typeDataReady(QQmlTypeData *)
{
Q_Q(QQmlComponent);
@@ -288,8 +298,10 @@ void QQmlComponentPrivate::typeDataReady(QQmlTypeData *)
fromTypeData(typeData);
typeData = 0;
+ progress = 1.0;
emit q->statusChanged(q->status());
+ emit q->progressChanged(progress);
}
void QQmlComponentPrivate::typeDataProgress(QQmlTypeData *, qreal p)
@@ -362,10 +374,10 @@ QQmlComponent::~QQmlComponent()
\qmlproperty enumeration Component::status
This property holds the status of component loading. It can be one of:
\list
- \o Component.Null - no data is available for the component
- \o Component.Ready - the component has been loaded, and can be used to create instances.
- \o Component.Loading - the component is currently being loaded
- \o Component.Error - an error occurred while loading the component.
+ \li Component.Null - no data is available for the component
+ \li Component.Ready - the component has been loaded, and can be used to create instances.
+ \li Component.Loading - the component is currently being loaded
+ \li Component.Error - an error occurred while loading the component.
Calling errorString() will provide a human-readable description of any errors.
\endlist
*/
@@ -476,7 +488,24 @@ QQmlComponent::QQmlComponent(QQmlEngine *engine, const QUrl &url, QObject *paren
{
Q_D(QQmlComponent);
d->engine = engine;
- loadUrl(url);
+ d->loadUrl(url);
+}
+
+/*!
+ Create a QQmlComponent from the given \a url and give it the
+ specified \a parent and \a engine. If \a mode is \l Asynchronous,
+ the component will be loaded and compiled asynchronously.
+
+ Ensure that the URL provided is full and correct, in particular, use
+ \l QUrl::fromLocalFile() when loading a file from the local filesystem.
+
+ \sa loadUrl()
+*/QQmlComponent::QQmlComponent(QQmlEngine *engine, const QUrl &url, CompilationMode mode, QObject *parent)
+: QObject(*(new QQmlComponentPrivate), parent)
+{
+ Q_D(QQmlComponent);
+ d->engine = engine;
+ d->loadUrl(url, mode);
}
/*!
@@ -491,7 +520,23 @@ QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
{
Q_D(QQmlComponent);
d->engine = engine;
- loadUrl(d->engine->baseUrl().resolved(QUrl::fromLocalFile(fileName)));
+ d->loadUrl(d->engine->baseUrl().resolved(QUrl::fromLocalFile(fileName)));
+}
+
+/*!
+ Create a QQmlComponent from the given \a fileName and give it the specified
+ \a parent and \a engine. If \a mode is \l Asynchronous,
+ the component will be loaded and compiled asynchronously.
+
+ \sa loadUrl()
+*/
+QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
+ CompilationMode mode, QObject *parent)
+: QObject(*(new QQmlComponentPrivate), parent)
+{
+ Q_D(QQmlComponent);
+ d->engine = engine;
+ d->loadUrl(d->engine->baseUrl().resolved(QUrl::fromLocalFile(fileName)), mode);
}
/*!
@@ -558,35 +603,63 @@ QQmlContext *QQmlComponent::creationContext() const
void QQmlComponent::loadUrl(const QUrl &url)
{
Q_D(QQmlComponent);
+ d->loadUrl(url);
+}
- d->clear();
+/*!
+ Load the QQmlComponent from the provided \a url.
+ If \a mode is \l Asynchronous, the component will be loaded and compiled asynchronously.
+
+ Ensure that the URL provided is full and correct, in particular, use
+ \l QUrl::fromLocalFile() when loading a file from the local filesystem.
+*/
+void QQmlComponent::loadUrl(const QUrl &url, QQmlComponent::CompilationMode mode)
+{
+ Q_D(QQmlComponent);
+ d->loadUrl(url, mode);
+}
+
+void QQmlComponentPrivate::loadUrl(const QUrl &newUrl, QQmlComponent::CompilationMode mode)
+{
+ Q_Q(QQmlComponent);
+ clear();
- if ((url.isRelative() && !url.isEmpty())
- || url.scheme() == QLatin1String("file")) // Workaround QTBUG-11929
- d->url = d->engine->baseUrl().resolved(url);
+ if ((newUrl.isRelative() && !newUrl.isEmpty())
+ || newUrl.scheme() == QLatin1String("file")) // Workaround QTBUG-11929
+ url = engine->baseUrl().resolved(newUrl);
else
- d->url = url;
+ url = newUrl;
- if (url.isEmpty()) {
+ if (newUrl.isEmpty()) {
QQmlError error;
- error.setDescription(tr("Invalid empty URL"));
- d->state.errors << error;
+ error.setDescription(q->tr("Invalid empty URL"));
+ state.errors << error;
return;
}
- QQmlTypeData *data = QQmlEnginePrivate::get(d->engine)->typeLoader.get(d->url);
+ if (progress != 0.0) {
+ progress = 0.0;
+ emit q->progressChanged(progress);
+ }
+
+ QQmlDataLoader::Mode loaderMode = (mode == QQmlComponent::Asynchronous)
+ ? QQmlDataLoader::Asynchronous
+ : QQmlDataLoader::PreferSynchronous;
+
+ QQmlTypeData *data = QQmlEnginePrivate::get(engine)->typeLoader.get(url, loaderMode);
if (data->isCompleteOrError()) {
- d->fromTypeData(data);
- d->progress = 1.0;
+ fromTypeData(data);
+ progress = 1.0;
} else {
- d->typeData = data;
- d->typeData->registerCallback(d);
- d->progress = data->progress();
+ typeData = data;
+ typeData->registerCallback(this);
+ progress = data->progress();
}
- emit statusChanged(status());
- emit progressChanged(d->progress);
+ emit q->statusChanged(q->status());
+ if (progress != 0.0)
+ emit q->progressChanged(progress);
}
/*!
@@ -686,9 +759,9 @@ QObject *QQmlComponent::create(QQmlContext *context)
When QQmlComponent constructs an instance, it occurs in three steps:
\list 1
- \i The object hierarchy is created, and constant values are assigned.
- \i Property bindings are evaluated for the the first time.
- \i If applicable, QQmlParserStatus::componentComplete() is called on objects.
+ \li The object hierarchy is created, and constant values are assigned.
+ \li Property bindings are evaluated for the the first time.
+ \li If applicable, QQmlParserStatus::componentComplete() is called on objects.
\endlist
QQmlComponent::beginCreate() differs from QQmlComponent::create() in that it
only performs step 1. QQmlComponent::completeCreate() must be called to
@@ -1079,13 +1152,13 @@ void QQmlComponent::createObject(QQmlV8Function *args)
properties:
\list
- \i status The status of the incubator. Valid values are Component.Ready, Component.Loading and
+ \li status The status of the incubator. Valid values are Component.Ready, Component.Loading and
Component.Error.
- \i object The created object instance. Will only be available once the incubator is in the
+ \li object The created object instance. Will only be available once the incubator is in the
Ready status.
- \i onStatusChanged Specifies a callback function to be invoked when the status changes. The
+ \li onStatusChanged Specifies a callback function to be invoked when the status changes. The
status is passed as a parameter to the callback.
- \i forceCompletion() Call to complete incubation synchronously.
+ \li forceCompletion() Call to complete incubation synchronously.
\endlist
The following example demonstrates how to use an incubator:
@@ -1337,9 +1410,8 @@ void QV8IncubatorResource::statusChanged(Status s)
f->Call(me, 1, args);
if (tc.HasCaught()) {
QQmlError error;
- QQmlExpressionPrivate::exceptionToError(tc.Message(), error);
- QQmlEnginePrivate::warning(QQmlEnginePrivate::get(engine->engine()),
- error);
+ QQmlJavaScriptExpression::exceptionToError(tc.Message(), error);
+ QQmlEnginePrivate::warning(QQmlEnginePrivate::get(engine->engine()), error);
}
}
}
diff --git a/src/qml/qml/qqmlcomponent.h b/src/qml/qml/qqmlcomponent.h
index 1265fb1c7d..9fc9388e41 100644
--- a/src/qml/qml/qqmlcomponent.h
+++ b/src/qml/qml/qqmlcomponent.h
@@ -73,10 +73,15 @@ class Q_QML_EXPORT QQmlComponent : public QObject
Q_PROPERTY(QUrl url READ url CONSTANT)
public:
+ Q_ENUMS(CompilationMode)
+ enum CompilationMode { PreferSynchronous, Asynchronous };
+
QQmlComponent(QObject *parent = 0);
QQmlComponent(QQmlEngine *, QObject *parent=0);
QQmlComponent(QQmlEngine *, const QString &fileName, QObject *parent = 0);
+ QQmlComponent(QQmlEngine *, const QString &fileName, CompilationMode mode, QObject *parent = 0);
QQmlComponent(QQmlEngine *, const QUrl &url, QObject *parent = 0);
+ QQmlComponent(QQmlEngine *, const QUrl &url, CompilationMode mode, QObject *parent = 0);
virtual ~QQmlComponent();
Q_ENUMS(Status)
@@ -108,6 +113,7 @@ public:
public Q_SLOTS:
void loadUrl(const QUrl &url);
+ void loadUrl(const QUrl &url, CompilationMode mode);
void setData(const QByteArray &, const QUrl &baseUrl);
Q_SIGNALS:
diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h
index dda5bd0b71..9e220b5e95 100644
--- a/src/qml/qml/qqmlcomponent_p.h
+++ b/src/qml/qml/qqmlcomponent_p.h
@@ -86,6 +86,8 @@ class Q_QML_PRIVATE_EXPORT QQmlComponentPrivate : public QObjectPrivate, public
public:
QQmlComponentPrivate() : typeData(0), progress(0.), start(-1), cc(0), engine(0), creationContext(0), profiler(0) {}
+ void loadUrl(const QUrl &newUrl, QQmlComponent::CompilationMode mode = QQmlComponent::PreferSynchronous);
+
QObject *beginCreate(QQmlContextData *);
void completeCreate();
void initializeObjectWithInitialProperties(v8::Handle<v8::Object> qmlGlobal, v8::Handle<v8::Object> valuemap, QObject *toCreate);
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index 38acc0b0c3..cbb8430f40 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -329,7 +329,7 @@ void QQmlContext::setContextProperty(const QString &name, const QVariant &value)
/*!
Set the \a value of the \a name property on this context.
- QQmlContext does \bold not take ownership of \a value.
+ QQmlContext does \b not take ownership of \a value.
*/
void QQmlContext::setContextProperty(const QString &name, QObject *value)
{
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index e4ba44583d..09d1a23510 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -78,8 +78,8 @@ class Q_QML_EXPORT QQmlData : public QAbstractDeclarativeData
public:
QQmlData()
: ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
- hasTaintedV8Object(false), notifyList(0), context(0), outerContext(0), bindings(0),
- nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
+ hasTaintedV8Object(false), isQueuedForDeletion(false), notifyList(0), context(0), outerContext(0),
+ bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), v8objectid(0),
propertyCache(0), guards(0), extendedData(0) {
init();
@@ -110,7 +110,8 @@ public:
quint32 indestructible:1;
quint32 explicitIndestructibleSet:1;
quint32 hasTaintedV8Object:1;
- quint32 dummy:27;
+ quint32 isQueuedForDeletion:1;
+ quint32 dummy:26;
struct NotifyList {
quint64 connectionMask;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 90b8bcd8bb..16cd1ecde6 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -49,7 +49,6 @@
#include "qqmlcontext.h"
#include "qqmlexpression.h"
#include "qqmlcomponent.h"
-#include "qqmlbinding_p_p.h"
#include "qqmlvme_p.h"
#include <private/qqmlenginedebugservice_p.h>
#include "qqmlstringconverters_p.h"
@@ -175,7 +174,6 @@ void QQmlEnginePrivate::registerBaseTypes(const char *uri, int versionMajor, int
void QQmlEnginePrivate::defineModule()
{
registerBaseTypes("QtQuick", 2, 0);
- qmlRegisterType<QQmlBinding>();
qmlRegisterUncreatableType<QQuickApplication>("QtQuick",2,0,"Application", QQuickApplication::tr("Application is an abstract class"));
qmlRegisterUncreatableType<QQmlLocale>("QtQuick",2,0,"Locale",QQmlEngine::tr("Locale cannot be instantiated. Use Qt.locale()"));
}
@@ -222,11 +220,11 @@ data types. This is primarily useful when setting the properties of an item
when the property has one of the following types:
\list
-\o \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()}
-\o \c rect - use \l{Qt::rect()}{Qt.rect()}
-\o \c point - use \l{Qt::point()}{Qt.point()}
-\o \c size - use \l{Qt::size()}{Qt.size()}
-\o \c vector3d - use \l{Qt::vector3d()}{Qt.vector3d()}
+\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()}
+\li \c rect - use \l{Qt::rect()}{Qt.rect()}
+\li \c point - use \l{Qt::point()}{Qt.point()}
+\li \c size - use \l{Qt::size()}{Qt.size()}
+\li \c vector3d - use \l{Qt::vector3d()}{Qt.vector3d()}
\endlist
There are also string based constructors for these types. See \l{qdeclarativebasictypes.html}{QML Basic Types} for more information.
@@ -236,9 +234,9 @@ There are also string based constructors for these types. See \l{qdeclarativebas
The Qt object contains several functions for formatting QDateTime, QDate and QTime values.
\list
- \o \l{Qt::formatDateTime}{string Qt.formatDateTime(datetime date, variant format)}
- \o \l{Qt::formatDate}{string Qt.formatDate(datetime date, variant format)}
- \o \l{Qt::formatTime}{string Qt.formatTime(datetime date, variant format)}
+ \li \l{Qt::formatDateTime}{string Qt.formatDateTime(datetime date, variant format)}
+ \li \l{Qt::formatDate}{string Qt.formatDate(datetime date, variant format)}
+ \li \l{Qt::formatTime}{string Qt.formatTime(datetime date, variant format)}
\endlist
The format specification is described at \l{Qt::formatDateTime}{Qt.formatDateTime}.
@@ -250,8 +248,8 @@ items from files or strings. See \l{Dynamic Object Management in QML} for an ove
of their use.
\list
- \o \l{Qt::createComponent()}{object Qt.createComponent(url)}
- \o \l{Qt::createQmlObject()}{object Qt.createQmlObject(string qml, object parent, string filepath)}
+ \li \l{Qt::createComponent()}{object Qt.createComponent(url)}
+ \li \l{Qt::createQmlObject()}{object Qt.createQmlObject(string qml, object parent, string filepath)}
\endlist
*/
@@ -267,8 +265,8 @@ of their use.
\table
\row
- \o \c application.active
- \o
+ \li \c application.active
+ \li
This read-only property indicates whether the application is the top-most and focused
application, and the user is able to interact with the application. The property
is false when the application is in the background, the device keylock or screen
@@ -279,8 +277,8 @@ of their use.
active.
\row
- \o \c application.layoutDirection
- \o
+ \li \c application.layoutDirection
+ \li
This read-only property can be used to query the default layout direction of the
application. On system start-up, the default layout direction depends on the
application's language. The property has a value of \c Qt.RightToLeft in locales
@@ -291,15 +289,15 @@ of their use.
Possible values are:
\list
- \o Qt.LeftToRight - Text and graphics elements should be positioned
+ \li Qt.LeftToRight - Text and graphics elements should be positioned
from left to right.
- \o Qt.RightToLeft - Text and graphics elements should be positioned
+ \li Qt.RightToLeft - Text and graphics elements should be positioned
from right to left.
\endlist
\row
- \o \c application.inputPanel
- \o
+ \li \c application.inputPanel
+ \li
This read-only property allows access to application's QInputPanel object
and all its properties and slots. See the QInputPanel documentation for
further details. Deprecated in favor of Qt.InputMethod
@@ -331,11 +329,11 @@ Qt.include() returns an object that describes the status of the operation. The
a single property, \c {status}, that is set to one of the following values:
\table
-\header \o Symbol \o Value \o Description
-\row \o result.OK \o 0 \o The include completed successfully.
-\row \o result.LOADING \o 1 \o Data is being loaded from the network.
-\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url.
-\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code.
+\header \li Symbol \li Value \li Description
+\row \li result.OK \li 0 \li The include completed successfully.
+\row \li result.LOADING \li 1 \li Data is being loaded from the network.
+\row \li result.NETWORK_ERROR \li 2 \li A network error occurred while fetching the url.
+\row \li result.EXCEPTION \li 3 \li A JavaScript exception occurred while executing the included code.
An additional \c exception property will be set in this case.
\endtable
@@ -996,7 +994,7 @@ QQmlDebuggingEnabler::QQmlDebuggingEnabler()
{
#ifndef QQML_NO_DEBUG_PROTOCOL
if (!QQmlEnginePrivate::qml_debugging_enabled) {
- qWarning("QML debugging is enabled. Only use this in a safe environment.");
+ qDebug("QML debugging is enabled. Only use this in a safe environment.");
}
QQmlEnginePrivate::qml_debugging_enabled = true;
#endif
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index ecdbf21d4b..60a0fe1c89 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -52,32 +52,6 @@
QT_BEGIN_NAMESPACE
-bool QQmlDelayedError::addError(QQmlEnginePrivate *e)
-{
- if (!e) return false;
-
- if (e->inProgressCreations == 0) return false; // Not in construction
-
- if (prevError) return true; // Already in error chain
-
- prevError = &e->erroredBindings;
- nextError = e->erroredBindings;
- e->erroredBindings = this;
- if (nextError) nextError->prevError = &nextError;
-
- return true;
-}
-
-QQmlJavaScriptExpression::QQmlJavaScriptExpression(VTable *v)
-: m_vtable(v)
-{
-}
-
-QQmlJavaScriptExpression::~QQmlJavaScriptExpression()
-{
- clearGuards();
-}
-
static QQmlJavaScriptExpression::VTable QQmlExpressionPrivate_jsvtable = {
QQmlExpressionPrivate::expressionIdentifier,
QQmlExpressionPrivate::expressionChanged
@@ -98,8 +72,7 @@ QQmlExpressionPrivate::~QQmlExpressionPrivate()
dataRef = 0;
}
-void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr,
- QObject *me)
+void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr, QObject *me)
{
expression = expr;
@@ -109,22 +82,9 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr,
expressionFunctionRewritten = false;
}
-void QQmlExpressionPrivate::init(QQmlContextData *ctxt, v8::Handle<v8::Function> func,
- QObject *me)
-{
- QQmlAbstractExpression::setContext(ctxt);
- setScopeObject(me);
-
- v8function = qPersistentNew<v8::Function>(func);
- setUseSharedContext(false);
- expressionFunctionValid = true;
- expressionFunctionRewritten = false;
- extractExpressionFromFunction = true;
-}
-
void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr,
- bool isRewritten, QObject *me, const QString &srcUrl,
- int lineNumber, int columnNumber)
+ bool isRewritten, QObject *me, const QString &srcUrl,
+ int lineNumber, int columnNumber)
{
url = srcUrl;
line = lineNumber;
@@ -140,8 +100,8 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr,
}
void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QByteArray &expr,
- bool isRewritten, QObject *me, const QString &srcUrl,
- int lineNumber, int columnNumber)
+ bool isRewritten, QObject *me, const QString &srcUrl,
+ int lineNumber, int columnNumber)
{
url = srcUrl;
line = lineNumber;
@@ -166,97 +126,13 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QByteArray &expr,
setScopeObject(me);
}
-// Callee owns the persistent handle
-v8::Persistent<v8::Function>
-QQmlExpressionPrivate::evalFunction(QQmlContextData *ctxt, QObject *scope,
- const char *code, int codeLength,
- const QString &filename, int line,
- v8::Persistent<v8::Object> *qmlscope)
-{
- QQmlEngine *engine = ctxt->engine;
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
-
- v8::HandleScope handle_scope;
- v8::Context::Scope ctxtscope(ep->v8engine()->context());
-
- v8::TryCatch tc;
- v8::Local<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope);
- v8::Local<v8::Script> script = ep->v8engine()->qmlModeCompile(code, codeLength, filename, line);
- if (tc.HasCaught()) {
- QQmlError error;
- error.setDescription(QLatin1String("Exception occurred during function compilation"));
- error.setLine(line);
- error.setUrl(QUrl::fromLocalFile(filename));
- v8::Local<v8::Message> message = tc.Message();
- if (!message.IsEmpty())
- QQmlExpressionPrivate::exceptionToError(message, error);
- ep->warning(error);
- return v8::Persistent<v8::Function>();
- }
- v8::Local<v8::Value> result = script->Run(scopeobject);
- if (tc.HasCaught()) {
- QQmlError error;
- error.setDescription(QLatin1String("Exception occurred during function evaluation"));
- error.setLine(line);
- error.setUrl(QUrl::fromLocalFile(filename));
- v8::Local<v8::Message> message = tc.Message();
- if (!message.IsEmpty())
- QQmlExpressionPrivate::exceptionToError(message, error);
- ep->warning(error);
- return v8::Persistent<v8::Function>();
- }
- if (qmlscope) *qmlscope = qPersistentNew<v8::Object>(scopeobject);
- return qPersistentNew<v8::Function>(v8::Local<v8::Function>::Cast(result));
-}
-
-// Callee owns the persistent handle
-v8::Persistent<v8::Function>
-QQmlExpressionPrivate::evalFunction(QQmlContextData *ctxt, QObject *scope,
- const QString &code, const QString &filename, int line,
- v8::Persistent<v8::Object> *qmlscope)
-{
- QQmlEngine *engine = ctxt->engine;
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
-
- v8::HandleScope handle_scope;
- v8::Context::Scope ctxtscope(ep->v8engine()->context());
-
- v8::TryCatch tc;
- v8::Local<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope);
- v8::Local<v8::Script> script = ep->v8engine()->qmlModeCompile(code, filename, line);
- if (tc.HasCaught()) {
- QQmlError error;
- error.setDescription(QLatin1String("Exception occurred during function compilation"));
- error.setLine(line);
- error.setUrl(QUrl::fromLocalFile(filename));
- v8::Local<v8::Message> message = tc.Message();
- if (!message.IsEmpty())
- QQmlExpressionPrivate::exceptionToError(message, error);
- ep->warning(error);
- return v8::Persistent<v8::Function>();
- }
- v8::Local<v8::Value> result = script->Run(scopeobject);
- if (tc.HasCaught()) {
- QQmlError error;
- error.setDescription(QLatin1String("Exception occurred during function evaluation"));
- error.setLine(line);
- error.setUrl(QUrl::fromLocalFile(filename));
- v8::Local<v8::Message> message = tc.Message();
- if (!message.IsEmpty())
- QQmlExpressionPrivate::exceptionToError(message, error);
- ep->warning(error);
- return v8::Persistent<v8::Function>();
- }
- if (qmlscope) *qmlscope = qPersistentNew<v8::Object>(scopeobject);
- return qPersistentNew<v8::Function>(v8::Local<v8::Function>::Cast(result));
-}
-
QQmlExpression *
QQmlExpressionPrivate::create(QQmlContextData *ctxt, QObject *object,
- const QString &expr, bool isRewritten,
- const QString &url, int lineNumber, int columnNumber)
+ const QString &expr, bool isRewritten,
+ const QString &url, int lineNumber, int columnNumber)
{
- return new QQmlExpression(ctxt, object, expr, isRewritten, url, lineNumber, columnNumber, *new QQmlExpressionPrivate);
+ return new QQmlExpression(ctxt, object, expr, isRewritten, url, lineNumber, columnNumber,
+ *new QQmlExpressionPrivate);
}
/*!
@@ -408,24 +284,6 @@ QQmlExpression::QQmlExpression(QQmlContextData *ctxt, QObject *scope,
d->init(ctxt, expression, scope);
}
-/*!
- \internal
-
- To avoid exposing v8 in the public API, functionPtr must be a pointer to a v8::Handle<v8::Function>.
- For example:
- v8::Handle<v8::Function> function;
- new QQmlExpression(ctxt, scope, &function, ...);
- */
-QQmlExpression::QQmlExpression(QQmlContextData *ctxt, QObject *scope, void *functionPtr,
- QQmlExpressionPrivate &dd)
-: QObject(dd, 0)
-{
- v8::Handle<v8::Function> function = *(v8::Handle<v8::Function> *)functionPtr;
-
- Q_D(QQmlExpression);
- d->init(ctxt, function, scope);
-}
-
/*!
Destroy the QQmlExpression instance.
*/
@@ -489,217 +347,6 @@ void QQmlExpression::setExpression(const QString &expression)
qPersistentDispose(d->v8qmlscope);
}
-void QQmlExpressionPrivate::exceptionToError(v8::Handle<v8::Message> message,
- QQmlError &error)
-{
- Q_ASSERT(!message.IsEmpty());
-
- v8::Handle<v8::Value> name = message->GetScriptResourceName();
- v8::Handle<v8::String> description = message->Get();
- int lineNumber = message->GetLineNumber();
-
- v8::Local<v8::String> file = name->IsString()?name->ToString():v8::Local<v8::String>();
- if (file.IsEmpty() || file->Length() == 0)
- error.setUrl(QUrl(QLatin1String("<Unknown File>")));
- else
- error.setUrl(QUrl(QV8Engine::toStringStatic(file)));
-
- error.setLine(lineNumber);
- error.setColumn(-1);
-
- QString qDescription = QV8Engine::toStringStatic(description);
- if (qDescription.startsWith(QLatin1String("Uncaught ")))
- qDescription = qDescription.mid(9 /* strlen("Uncaught ") */);
-
- error.setDescription(qDescription);
-}
-
-void QQmlJavaScriptExpression::setNotifyOnValueChanged(bool v)
-{
- activeGuards.setFlagValue(v);
- if (!v) clearGuards();
-}
-
-void QQmlJavaScriptExpression::resetNotifyOnValueChanged()
-{
- clearGuards();
-}
-
-v8::Local<v8::Value>
-QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
- v8::Handle<v8::Function> function, bool *isUndefined)
-{
- Q_ASSERT(context && context->engine);
-
- if (function.IsEmpty() || function->IsUndefined()) {
- if (isUndefined) *isUndefined = true;
- return v8::Local<v8::Value>();
- }
-
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context->engine);
-
- Q_ASSERT(notifyOnValueChanged() || activeGuards.isEmpty());
- GuardCapture capture(context->engine, this);
-
- QQmlEnginePrivate::PropertyCapture *lastPropertyCapture = ep->propertyCapture;
- ep->propertyCapture = notifyOnValueChanged()?&capture:0;
-
-
- if (notifyOnValueChanged())
- capture.guards.copyAndClearPrepend(activeGuards);
-
- QQmlContextData *lastSharedContext = 0;
- QObject *lastSharedScope = 0;
-
- bool sharedContext = useSharedContext();
-
- // All code that follows must check with watcher before it accesses data members
- // incase we have been deleted.
- DeleteWatcher watcher(this);
-
- if (sharedContext) {
- lastSharedContext = ep->sharedContext;
- lastSharedScope = ep->sharedScope;
- ep->sharedContext = context;
- ep->sharedScope = scopeObject();
- }
-
- v8::Local<v8::Value> result;
- {
- v8::TryCatch try_catch;
- v8::Handle<v8::Object> This = ep->v8engine()->global();
- if (scopeObject() && requiresThisObject()) {
- v8::Handle<v8::Value> value = ep->v8engine()->newQObject(scopeObject());
- if (value->IsObject()) This = v8::Handle<v8::Object>::Cast(value);
- }
-
- result = function->Call(This, 0, 0);
-
- if (isUndefined)
- *isUndefined = try_catch.HasCaught() || result->IsUndefined();
-
- if (watcher.wasDeleted()) {
- } else if (try_catch.HasCaught()) {
- v8::Context::Scope scope(ep->v8engine()->context());
- v8::Local<v8::Message> message = try_catch.Message();
- if (!message.IsEmpty()) {
- QQmlExpressionPrivate::exceptionToError(message, delayedError()->error);
- } else {
- if (hasDelayedError()) delayedError()->error = QQmlError();
- }
- } else {
- if (hasDelayedError()) delayedError()->error = QQmlError();
- }
- }
-
- if (sharedContext) {
- ep->sharedContext = lastSharedContext;
- ep->sharedScope = lastSharedScope;
- }
-
- if (capture.errorString) {
- for (int ii = 0; ii < capture.errorString->count(); ++ii)
- qWarning("%s", qPrintable(capture.errorString->at(ii)));
- delete capture.errorString;
- capture.errorString = 0;
- }
-
- while (Guard *g = capture.guards.takeFirst())
- g->Delete();
-
- ep->propertyCapture = lastPropertyCapture;
-
- return result;
-}
-
-void QQmlJavaScriptExpression::GuardCapture::captureProperty(QQmlNotifier *n)
-{
- if (expression) {
-
- // Try and find a matching guard
- while (!guards.isEmpty() && !guards.first()->isConnected(n))
- guards.takeFirst()->Delete();
-
- Guard *g = 0;
- if (!guards.isEmpty()) {
- g = guards.takeFirst();
- g->cancelNotify();
- Q_ASSERT(g->isConnected(n));
- } else {
- g = Guard::New(expression, engine);
- g->connect(n);
- }
-
- expression->activeGuards.prepend(g);
- }
-}
-
-void QQmlJavaScriptExpression::GuardCapture::captureProperty(QObject *o, int c, int n)
-{
- if (expression) {
- if (n == -1) {
- if (!errorString) {
- errorString = new QStringList;
- QString preamble = QLatin1String("QQmlExpression: Expression ") +
- expression->m_vtable->expressionIdentifier(expression) +
- QLatin1String(" depends on non-NOTIFYable properties:");
- errorString->append(preamble);
- }
-
- const QMetaObject *metaObj = o->metaObject();
- QMetaProperty metaProp = metaObj->property(c);
-
- QString error = QLatin1String(" ") +
- QString::fromUtf8(metaObj->className()) +
- QLatin1String("::") +
- QString::fromUtf8(metaProp.name());
- errorString->append(error);
- } else {
-
- // Try and find a matching guard
- while (!guards.isEmpty() && !guards.first()->isConnected(o, n))
- guards.takeFirst()->Delete();
-
- Guard *g = 0;
- if (!guards.isEmpty()) {
- g = guards.takeFirst();
- g->cancelNotify();
- Q_ASSERT(g->isConnected(o, n));
- } else {
- g = Guard::New(expression, engine);
- g->connect(o, n);
- }
-
- expression->activeGuards.prepend(g);
- }
- }
-}
-
-void QQmlJavaScriptExpression::clearError()
-{
- if (m_vtable.hasValue()) {
- m_vtable.value().error = QQmlError();
- m_vtable.value().removeError();
- }
-}
-
-QQmlError QQmlJavaScriptExpression::error() const
-{
- if (m_vtable.hasValue()) return m_vtable.constValue()->error;
- else return QQmlError();
-}
-
-QQmlDelayedError *QQmlJavaScriptExpression::delayedError()
-{
- return &m_vtable.value();
-}
-
-void QQmlJavaScriptExpression::clearGuards()
-{
- while (Guard *g = activeGuards.takeFirst())
- g->Delete();
-}
-
// Must be called with a valid handle scope
v8::Local<v8::Value> QQmlExpressionPrivate::v8value(QObject *secondaryScope, bool *isUndefined)
{
@@ -923,60 +570,6 @@ QString QQmlExpressionPrivate::expressionIdentifier(QQmlJavaScriptExpression *e)
return QLatin1String("\"") + This->expression + QLatin1String("\"");
}
-QQmlAbstractExpression::QQmlAbstractExpression()
-: m_prevExpression(0), m_nextExpression(0)
-{
-}
-
-QQmlAbstractExpression::~QQmlAbstractExpression()
-{
- if (m_prevExpression) {
- *m_prevExpression = m_nextExpression;
- if (m_nextExpression)
- m_nextExpression->m_prevExpression = m_prevExpression;
- }
-
- if (m_context.isT2())
- m_context.asT2()->_s = 0;
-}
-
-QQmlContextData *QQmlAbstractExpression::context() const
-{
- if (m_context.isT1()) return m_context.asT1();
- else return m_context.asT2()->_c;
-}
-
-void QQmlAbstractExpression::setContext(QQmlContextData *context)
-{
- if (m_prevExpression) {
- *m_prevExpression = m_nextExpression;
- if (m_nextExpression)
- m_nextExpression->m_prevExpression = m_prevExpression;
- m_prevExpression = 0;
- m_nextExpression = 0;
- }
-
- if (m_context.isT1()) m_context = context;
- else m_context.asT2()->_c = context;
-
- if (context) {
- m_nextExpression = context->expressions;
- if (m_nextExpression)
- m_nextExpression->m_prevExpression = &m_nextExpression;
- m_prevExpression = &context->expressions;
- context->expressions = this;
- }
-}
-
-void QQmlAbstractExpression::refresh()
-{
-}
-
-bool QQmlAbstractExpression::isValid() const
-{
- return context() != 0;
-}
-
QT_END_NAMESPACE
#include <moc_qqmlexpression.cpp>
diff --git a/src/qml/qml/qqmlexpression.h b/src/qml/qml/qqmlexpression.h
index 4044546fbf..b60d9f1f86 100644
--- a/src/qml/qml/qqmlexpression.h
+++ b/src/qml/qml/qqmlexpression.h
@@ -96,8 +96,6 @@ Q_SIGNALS:
protected:
QQmlExpression(QQmlContextData *, QObject *, const QString &,
QQmlExpressionPrivate &dd);
- QQmlExpression(QQmlContextData *, QObject *, void *,
- QQmlExpressionPrivate &dd);
QQmlExpression(QQmlContextData *, QObject *, const QString &, bool,
const QString &, int, int, QQmlExpressionPrivate &dd);
QQmlExpression(QQmlContextData *, QObject *, const QByteArray &, bool,
diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h
index deca29ab60..186e3aebf9 100644
--- a/src/qml/qml/qqmlexpression_p.h
+++ b/src/qml/qml/qqmlexpression_p.h
@@ -56,161 +56,22 @@
#include "qqmlexpression.h"
#include <private/qv8engine_p.h>
+#include <private/qqmlguard_p.h>
+#include <private/qqmlengine_p.h>
#include <private/qfieldlist_p.h>
#include <private/qflagpointer_p.h>
#include <private/qdeletewatcher_p.h>
-#include <private/qqmlguard_p.h>
#include <private/qpointervaluepair_p.h>
-#include <private/qqmlengine_p.h>
+#include <private/qqmlabstractexpression_p.h>
+#include <private/qqmljavascriptexpression_p.h>
QT_BEGIN_NAMESPACE
-class QQmlAbstractExpression
-{
-public:
- QQmlAbstractExpression();
- virtual ~QQmlAbstractExpression();
-
- bool isValid() const;
-
- QQmlContextData *context() const;
- void setContext(QQmlContextData *);
-
- virtual void refresh();
-
- class DeleteWatcher {
- public:
- inline DeleteWatcher(QQmlAbstractExpression *);
- inline ~DeleteWatcher();
- inline bool wasDeleted() const;
- private:
- friend class QQmlAbstractExpression;
- QQmlContextData *_c;
- QQmlAbstractExpression **_w;
- QQmlAbstractExpression *_s;
- };
-
-private:
- friend class QQmlContext;
- friend class QQmlContextData;
- friend class QQmlContextPrivate;
-
- QBiPointer<QQmlContextData, DeleteWatcher> m_context;
- QQmlAbstractExpression **m_prevExpression;
- QQmlAbstractExpression *m_nextExpression;
-};
-
-class QQmlDelayedError
-{
-public:
- inline QQmlDelayedError() : nextError(0), prevError(0) {}
- inline ~QQmlDelayedError() { removeError(); }
-
- QQmlError error;
-
- bool addError(QQmlEnginePrivate *);
-
- inline void removeError() {
- if (!prevError) return;
- if (nextError) nextError->prevError = prevError;
- *prevError = nextError;
- nextError = 0;
- prevError = 0;
- }
-
-private:
- QQmlDelayedError *nextError;
- QQmlDelayedError **prevError;
-};
-
-class QQmlJavaScriptExpression
-{
-public:
- // Although this looks crazy, we implement our own "vtable" here, rather than relying on
- // C++ virtuals, to save memory. By doing it ourselves, we can overload the storage
- // location that is use for the vtable to also store the rarely used delayed error.
- // If we use C++ virtuals, we can't do this and it consts us an extra sizeof(void *) in
- // memory for every expression.
- struct VTable {
- QString (*expressionIdentifier)(QQmlJavaScriptExpression *);
- void (*expressionChanged)(QQmlJavaScriptExpression *);
- };
-
- QQmlJavaScriptExpression(VTable *vtable);
-
- v8::Local<v8::Value> evaluate(QQmlContextData *, v8::Handle<v8::Function>,
- bool *isUndefined);
-
- inline bool requiresThisObject() const;
- inline void setRequiresThisObject(bool v);
- inline bool useSharedContext() const;
- inline void setUseSharedContext(bool v);
- inline bool notifyOnValueChanged() const;
-
- void setNotifyOnValueChanged(bool v);
- void resetNotifyOnValueChanged();
-
- inline QObject *scopeObject() const;
- inline void setScopeObject(QObject *v);
-
- class DeleteWatcher {
- public:
- inline DeleteWatcher(QQmlJavaScriptExpression *);
- inline ~DeleteWatcher();
- inline bool wasDeleted() const;
- private:
- friend class QQmlJavaScriptExpression;
- QObject *_c;
- QQmlJavaScriptExpression **_w;
- QQmlJavaScriptExpression *_s;
- };
-
- inline bool hasError() const;
- inline bool hasDelayedError() const;
- QQmlError error() const;
- void clearError();
- QQmlDelayedError *delayedError();
-
-protected:
- ~QQmlJavaScriptExpression();
-
-private:
- typedef QQmlJavaScriptExpressionGuard Guard;
- friend class QQmlJavaScriptExpressionGuard;
-
- struct GuardCapture : public QQmlEnginePrivate::PropertyCapture {
- GuardCapture(QQmlEngine *engine, QQmlJavaScriptExpression *e)
- : engine(engine), expression(e), errorString(0) { }
-
- ~GuardCapture() {
- Q_ASSERT(guards.isEmpty());
- Q_ASSERT(errorString == 0);
- }
-
- virtual void captureProperty(QQmlNotifier *);
- virtual void captureProperty(QObject *, int, int);
-
- QQmlEngine *engine;
- QQmlJavaScriptExpression *expression;
- QFieldList<Guard, &Guard::next> guards;
- QStringList *errorString;
- };
-
- QPointerValuePair<VTable, QQmlDelayedError> m_vtable;
-
- // We store some flag bits in the following flag pointers.
- // m_scopeObject:flag1 - requiresThisObject
- // activeGuards:flag1 - notifyOnValueChanged
- // activeGuards:flag2 - useSharedContext
- QBiPointer<QObject, DeleteWatcher> m_scopeObject;
- QForwardFieldList<Guard, &Guard::next> activeGuards;
-
- void clearGuards();
-};
-
class QQmlExpression;
class QString;
-class Q_QML_PRIVATE_EXPORT QQmlExpressionPrivate : public QObjectPrivate, public QQmlJavaScriptExpression, public QQmlAbstractExpression
+class Q_QML_PRIVATE_EXPORT QQmlExpressionPrivate : public QObjectPrivate,
+ public QQmlJavaScriptExpression,
+ public QQmlAbstractExpression
{
Q_DECLARE_PUBLIC(QQmlExpression)
public:
@@ -218,7 +79,6 @@ public:
~QQmlExpressionPrivate();
void init(QQmlContextData *, const QString &, QObject *);
- void init(QQmlContextData *, v8::Handle<v8::Function>, QObject *);
void init(QQmlContextData *, const QString &, bool, QObject *, const QString &, int, int);
void init(QQmlContextData *, const QByteArray &, bool, QObject *, const QString &, int, int);
@@ -231,18 +91,8 @@ public:
void _q_notify();
- static void exceptionToError(v8::Handle<v8::Message>, QQmlError &);
- static v8::Persistent<v8::Function> evalFunction(QQmlContextData *ctxt, QObject *scope,
- const QString &code, const QString &filename,
- int line,
- v8::Persistent<v8::Object> *qmlscope = 0);
- static v8::Persistent<v8::Function> evalFunction(QQmlContextData *ctxt, QObject *scope,
- const char *code, int codeLength,
- const QString &filename, int line,
- v8::Persistent<v8::Object> *qmlscope = 0);
-
static QQmlExpression *create(QQmlContextData *, QObject *, const QString &, bool,
- const QString &, int, int);
+ const QString &, int, int);
bool expressionFunctionValid:1;
bool expressionFunctionRewritten:1;
@@ -267,103 +117,6 @@ public:
QQmlRefCount *dataRef;
};
-QQmlAbstractExpression::DeleteWatcher::DeleteWatcher(QQmlAbstractExpression *e)
-: _c(0), _w(0), _s(e)
-{
- if (e->m_context.isT1()) {
- _w = &_s;
- _c = e->m_context.asT1();
- e->m_context = this;
- } else {
- // Another watcher is already registered
- _w = &e->m_context.asT2()->_s;
- }
-}
-
-QQmlAbstractExpression::DeleteWatcher::~DeleteWatcher()
-{
- Q_ASSERT(*_w == 0 || (*_w == _s && _s->m_context.isT2()));
- if (*_w && _s->m_context.asT2() == this)
- _s->m_context = _c;
-}
-
-bool QQmlAbstractExpression::DeleteWatcher::wasDeleted() const
-{
- return *_w == 0;
-}
-
-QQmlJavaScriptExpression::DeleteWatcher::DeleteWatcher(QQmlJavaScriptExpression *e)
-: _c(0), _w(0), _s(e)
-{
- if (e->m_scopeObject.isT1()) {
- _w = &_s;
- _c = e->m_scopeObject.asT1();
- e->m_scopeObject = this;
- } else {
- // Another watcher is already registered
- _w = &e->m_scopeObject.asT2()->_s;
- }
-}
-
-QQmlJavaScriptExpression::DeleteWatcher::~DeleteWatcher()
-{
- Q_ASSERT(*_w == 0 || (*_w == _s && _s->m_scopeObject.isT2()));
- if (*_w && _s->m_scopeObject.asT2() == this)
- _s->m_scopeObject = _c;
-}
-
-bool QQmlJavaScriptExpression::DeleteWatcher::wasDeleted() const
-{
- return *_w == 0;
-}
-
-bool QQmlJavaScriptExpression::requiresThisObject() const
-{
- return m_scopeObject.flag();
-}
-
-void QQmlJavaScriptExpression::setRequiresThisObject(bool v)
-{
- m_scopeObject.setFlagValue(v);
-}
-
-bool QQmlJavaScriptExpression::useSharedContext() const
-{
- return activeGuards.flag2();
-}
-
-void QQmlJavaScriptExpression::setUseSharedContext(bool v)
-{
- activeGuards.setFlag2Value(v);
-}
-
-bool QQmlJavaScriptExpression::notifyOnValueChanged() const
-{
- return activeGuards.flag();
-}
-
-QObject *QQmlJavaScriptExpression::scopeObject() const
-{
- if (m_scopeObject.isT1()) return m_scopeObject.asT1();
- else return m_scopeObject.asT2()->_c;
-}
-
-void QQmlJavaScriptExpression::setScopeObject(QObject *v)
-{
- if (m_scopeObject.isT1()) m_scopeObject = v;
- else m_scopeObject.asT2()->_c = v;
-}
-
-bool QQmlJavaScriptExpression::hasError() const
-{
- return m_vtable.hasValue() && m_vtable.constValue()->error.isValid();
-}
-
-bool QQmlJavaScriptExpression::hasDelayedError() const
-{
- return m_vtable.hasValue();
-}
-
QQmlExpressionPrivate *QQmlExpressionPrivate::get(QQmlExpression *expr)
{
return static_cast<QQmlExpressionPrivate *>(QObjectPrivate::get(expr));
@@ -374,32 +127,6 @@ QQmlExpression *QQmlExpressionPrivate::get(QQmlExpressionPrivate *expr)
return expr->q_func();
}
-QQmlJavaScriptExpressionGuard::QQmlJavaScriptExpressionGuard(QQmlJavaScriptExpression *e)
-: expression(e), next(0)
-{
- callback = &endpointCallback;
-}
-
-void QQmlJavaScriptExpressionGuard::endpointCallback(QQmlNotifierEndpoint *e)
-{
- QQmlJavaScriptExpression *expression =
- static_cast<QQmlJavaScriptExpressionGuard *>(e)->expression;
-
- expression->m_vtable->expressionChanged(expression);
-}
-
-QQmlJavaScriptExpressionGuard *
-QQmlJavaScriptExpressionGuard::New(QQmlJavaScriptExpression *e,
- QQmlEngine *engine)
-{
- Q_ASSERT(e);
- return QQmlEnginePrivate::get(engine)->jsExpressionGuardPool.New(e);
-}
-
-void QQmlJavaScriptExpressionGuard::Delete()
-{
- QRecyclePool<QQmlJavaScriptExpressionGuard>::Delete(this);
-}
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp
index c3d8f0b34f..b69fa5da7a 100644
--- a/src/qml/qml/qqmlextensionplugin.cpp
+++ b/src/qml/qml/qqmlextensionplugin.cpp
@@ -57,10 +57,10 @@ QT_BEGIN_NAMESPACE
To write a QML extension plugin:
\list
- \o Subclass QQmlExtensionPlugin, implement registerTypes() method
+ \li Subclass QQmlExtensionPlugin, implement registerTypes() method
to register types using qmlRegisterType(), and export the class using the Q_EXPORT_PLUGIN2() macro
- \o Write an appropriate project file for the plugin
- \o Create a \l{Writing a qmldir file}{qmldir file} to describe the plugin
+ \li Write an appropriate project file for the plugin
+ \li Create a \l{Writing a qmldir file}{qmldir file} to describe the plugin
\endlist
QML extension plugins can be used to provide either application-specific or
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 6e74536fa3..0c1fb3bd93 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -268,9 +268,9 @@ QList<QQmlImports::ScriptReference> QQmlImports::resolvedScripts() const
The given (namespace qualified) \a type is resolved to either
\list
- \o a QQmlImportedNamespace stored at \a ns_return,
- \o a QQmlType stored at \a type_return, or
- \o a component located at \a url_return.
+ \li a QQmlImportedNamespace stored at \a ns_return,
+ \li a QQmlType stored at \a type_return, or
+ \li a component located at \a url_return.
\endlist
If any return pointer is 0, the corresponding search is not done.
@@ -956,12 +956,12 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
Returns the result of the merge of \a baseName with \a dir and the platform suffix.
\table
- \header \i Platform \i Valid suffixes
- \row \i Windows \i \c .dll
- \row \i Unix/Linux \i \c .so
- \row \i AIX \i \c .a
- \row \i HP-UX \i \c .sl, \c .so (HP-UXi)
- \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so
+ \header \li Platform \li Valid suffixes
+ \row \li Windows \li \c .dll
+ \row \li Unix/Linux \li \c .so
+ \row \li AIX \li \c .a
+ \row \li HP-UX \li \c .sl, \c .so (HP-UXi)
+ \row \li Mac OS X \li \c .dylib, \c .bundle, \c .so
\endtable
Version number on unix are ignored.
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index 834d4bbb97..aa9777d89e 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -427,14 +427,14 @@ specified IncubationMode.
QQmlIncubator supports three incubation modes:
\list
-\i Synchronous The creation occurs synchronously. That is, once the
+\li Synchronous The creation occurs synchronously. That is, once the
QQmlComponent::create() call returns, the incubator will already be in either the
Error or Ready state. A synchronous incubator has no real advantage compared to using
the synchronous creation methods on QQmlComponent directly, but it may simplify an
application's implementation to use the same API for both synchronous and asynchronous
creations.
-\i Asynchronous (default) The creation occurs asynchronously, assuming a
+\li Asynchronous (default) The creation occurs asynchronously, assuming a
QQmlIncubatorController is set on the QQmlEngine.
The incubator will remain in the Loading state until either the creation is complete or an error
@@ -446,7 +446,7 @@ that are slightly off screen while the list is being scrolled. If, during async
the object is needed immediately the QQmlIncubator::forceCompletion() method can be called
to complete the creation process synchronously.
-\i AsynchronousIfNested The creation will occur asynchronously if part of a nested asynchronous
+\li AsynchronousIfNested The creation will occur asynchronously if part of a nested asynchronous
creation, or synchronously if not.
In most scenarios where a QML element or component wants the appearance of a synchronous
@@ -542,6 +542,10 @@ void QQmlIncubator::clear()
d->clear();
+ // if we're waiting on any incubators then they should be cleared too.
+ while (d->waitingFor.first())
+ static_cast<QQmlIncubatorPrivate*>(d->waitingFor.first())->q->clear();
+
d->vme.reset();
d->vmeGuard.clear();
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
new file mode 100644
index 0000000000..aad6a04714
--- /dev/null
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -0,0 +1,371 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmljavascriptexpression_p.h"
+
+#include <private/qqmlexpression_p.h>
+
+QT_BEGIN_NAMESPACE
+
+bool QQmlDelayedError::addError(QQmlEnginePrivate *e)
+{
+ if (!e) return false;
+
+ if (e->inProgressCreations == 0) return false; // Not in construction
+
+ if (prevError) return true; // Already in error chain
+
+ prevError = &e->erroredBindings;
+ nextError = e->erroredBindings;
+ e->erroredBindings = this;
+ if (nextError) nextError->prevError = &nextError;
+
+ return true;
+}
+
+QQmlJavaScriptExpression::QQmlJavaScriptExpression(VTable *v)
+: m_vtable(v)
+{
+}
+
+QQmlJavaScriptExpression::~QQmlJavaScriptExpression()
+{
+ clearGuards();
+ if (m_scopeObject.isT2()) // notify DeleteWatcher of our deletion.
+ m_scopeObject.asT2()->_s = 0;
+}
+
+void QQmlJavaScriptExpression::setNotifyOnValueChanged(bool v)
+{
+ activeGuards.setFlagValue(v);
+ if (!v) clearGuards();
+}
+
+void QQmlJavaScriptExpression::resetNotifyOnValueChanged()
+{
+ clearGuards();
+}
+
+v8::Local<v8::Value>
+QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
+ v8::Handle<v8::Function> function, bool *isUndefined)
+{
+ Q_ASSERT(context && context->engine);
+
+ if (function.IsEmpty() || function->IsUndefined()) {
+ if (isUndefined) *isUndefined = true;
+ return v8::Local<v8::Value>();
+ }
+
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context->engine);
+
+ Q_ASSERT(notifyOnValueChanged() || activeGuards.isEmpty());
+ GuardCapture capture(context->engine, this);
+
+ QQmlEnginePrivate::PropertyCapture *lastPropertyCapture = ep->propertyCapture;
+ ep->propertyCapture = notifyOnValueChanged()?&capture:0;
+
+
+ if (notifyOnValueChanged())
+ capture.guards.copyAndClearPrepend(activeGuards);
+
+ QQmlContextData *lastSharedContext = 0;
+ QObject *lastSharedScope = 0;
+
+ bool sharedContext = useSharedContext();
+
+ // All code that follows must check with watcher before it accesses data members
+ // incase we have been deleted.
+ DeleteWatcher watcher(this);
+
+ if (sharedContext) {
+ lastSharedContext = ep->sharedContext;
+ lastSharedScope = ep->sharedScope;
+ ep->sharedContext = context;
+ ep->sharedScope = scopeObject();
+ }
+
+ v8::Local<v8::Value> result;
+ {
+ v8::TryCatch try_catch;
+ v8::Handle<v8::Object> This = ep->v8engine()->global();
+ if (scopeObject() && requiresThisObject()) {
+ v8::Handle<v8::Value> value = ep->v8engine()->newQObject(scopeObject());
+ if (value->IsObject()) This = v8::Handle<v8::Object>::Cast(value);
+ }
+
+ result = function->Call(This, 0, 0);
+
+ if (isUndefined)
+ *isUndefined = try_catch.HasCaught() || result->IsUndefined();
+
+ if (watcher.wasDeleted()) {
+ } else if (try_catch.HasCaught()) {
+ v8::Context::Scope scope(ep->v8engine()->context());
+ v8::Local<v8::Message> message = try_catch.Message();
+ if (!message.IsEmpty()) {
+ QQmlExpressionPrivate::exceptionToError(message, delayedError()->error);
+ } else {
+ if (hasDelayedError()) delayedError()->error = QQmlError();
+ }
+ } else {
+ if (hasDelayedError()) delayedError()->error = QQmlError();
+ }
+ }
+
+ if (sharedContext) {
+ ep->sharedContext = lastSharedContext;
+ ep->sharedScope = lastSharedScope;
+ }
+
+ if (capture.errorString) {
+ for (int ii = 0; ii < capture.errorString->count(); ++ii)
+ qWarning("%s", qPrintable(capture.errorString->at(ii)));
+ delete capture.errorString;
+ capture.errorString = 0;
+ }
+
+ while (Guard *g = capture.guards.takeFirst())
+ g->Delete();
+
+ ep->propertyCapture = lastPropertyCapture;
+
+ return result;
+}
+
+void QQmlJavaScriptExpression::GuardCapture::captureProperty(QQmlNotifier *n)
+{
+ if (expression) {
+
+ // Try and find a matching guard
+ while (!guards.isEmpty() && !guards.first()->isConnected(n))
+ guards.takeFirst()->Delete();
+
+ Guard *g = 0;
+ if (!guards.isEmpty()) {
+ g = guards.takeFirst();
+ g->cancelNotify();
+ Q_ASSERT(g->isConnected(n));
+ } else {
+ g = Guard::New(expression, engine);
+ g->connect(n);
+ }
+
+ expression->activeGuards.prepend(g);
+ }
+}
+
+void QQmlJavaScriptExpression::GuardCapture::captureProperty(QObject *o, int c, int n)
+{
+ if (expression) {
+ if (n == -1) {
+ if (!errorString) {
+ errorString = new QStringList;
+ QString preamble = QLatin1String("QQmlExpression: Expression ") +
+ expression->m_vtable->expressionIdentifier(expression) +
+ QLatin1String(" depends on non-NOTIFYable properties:");
+ errorString->append(preamble);
+ }
+
+ const QMetaObject *metaObj = o->metaObject();
+ QMetaProperty metaProp = metaObj->property(c);
+
+ QString error = QLatin1String(" ") +
+ QString::fromUtf8(metaObj->className()) +
+ QLatin1String("::") +
+ QString::fromUtf8(metaProp.name());
+ errorString->append(error);
+ } else {
+
+ // Try and find a matching guard
+ while (!guards.isEmpty() && !guards.first()->isConnected(o, n))
+ guards.takeFirst()->Delete();
+
+ Guard *g = 0;
+ if (!guards.isEmpty()) {
+ g = guards.takeFirst();
+ g->cancelNotify();
+ Q_ASSERT(g->isConnected(o, n));
+ } else {
+ g = Guard::New(expression, engine);
+ g->connect(o, n);
+ }
+
+ expression->activeGuards.prepend(g);
+ }
+ }
+}
+
+void QQmlJavaScriptExpression::clearError()
+{
+ if (m_vtable.hasValue()) {
+ m_vtable.value().error = QQmlError();
+ m_vtable.value().removeError();
+ }
+}
+
+QQmlError QQmlJavaScriptExpression::error() const
+{
+ if (m_vtable.hasValue()) return m_vtable.constValue()->error;
+ else return QQmlError();
+}
+
+QQmlDelayedError *QQmlJavaScriptExpression::delayedError()
+{
+ return &m_vtable.value();
+}
+
+void QQmlJavaScriptExpression::exceptionToError(v8::Handle<v8::Message> message, QQmlError &error)
+{
+ Q_ASSERT(!message.IsEmpty());
+
+ v8::Handle<v8::Value> name = message->GetScriptResourceName();
+ v8::Handle<v8::String> description = message->Get();
+ int lineNumber = message->GetLineNumber();
+
+ v8::Local<v8::String> file = name->IsString()?name->ToString():v8::Local<v8::String>();
+ if (file.IsEmpty() || file->Length() == 0)
+ error.setUrl(QUrl(QLatin1String("<Unknown File>")));
+ else
+ error.setUrl(QUrl(QV8Engine::toStringStatic(file)));
+
+ error.setLine(lineNumber);
+ error.setColumn(-1);
+
+ QString qDescription = QV8Engine::toStringStatic(description);
+ if (qDescription.startsWith(QLatin1String("Uncaught ")))
+ qDescription = qDescription.mid(9 /* strlen("Uncaught ") */);
+
+ error.setDescription(qDescription);
+}
+
+// Callee owns the persistent handle
+v8::Persistent<v8::Function>
+QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope,
+ const char *code, int codeLength,
+ const QString &filename, int line,
+ v8::Persistent<v8::Object> *qmlscope)
+{
+ QQmlEngine *engine = ctxt->engine;
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
+
+ v8::HandleScope handle_scope;
+ v8::Context::Scope ctxtscope(ep->v8engine()->context());
+
+ v8::TryCatch tc;
+ v8::Local<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope);
+ v8::Local<v8::Script> script = ep->v8engine()->qmlModeCompile(code, codeLength, filename, line);
+ if (tc.HasCaught()) {
+ QQmlError error;
+ error.setDescription(QLatin1String("Exception occurred during function compilation"));
+ error.setLine(line);
+ error.setUrl(QUrl::fromLocalFile(filename));
+ v8::Local<v8::Message> message = tc.Message();
+ if (!message.IsEmpty())
+ QQmlExpressionPrivate::exceptionToError(message, error);
+ ep->warning(error);
+ return v8::Persistent<v8::Function>();
+ }
+ v8::Local<v8::Value> result = script->Run(scopeobject);
+ if (tc.HasCaught()) {
+ QQmlError error;
+ error.setDescription(QLatin1String("Exception occurred during function evaluation"));
+ error.setLine(line);
+ error.setUrl(QUrl::fromLocalFile(filename));
+ v8::Local<v8::Message> message = tc.Message();
+ if (!message.IsEmpty())
+ QQmlExpressionPrivate::exceptionToError(message, error);
+ ep->warning(error);
+ return v8::Persistent<v8::Function>();
+ }
+ if (qmlscope) *qmlscope = qPersistentNew<v8::Object>(scopeobject);
+ return qPersistentNew<v8::Function>(v8::Local<v8::Function>::Cast(result));
+}
+
+// Callee owns the persistent handle
+v8::Persistent<v8::Function>
+QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope,
+ const QString &code, const QString &filename, int line,
+ v8::Persistent<v8::Object> *qmlscope)
+{
+ QQmlEngine *engine = ctxt->engine;
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
+
+ v8::HandleScope handle_scope;
+ v8::Context::Scope ctxtscope(ep->v8engine()->context());
+
+ v8::TryCatch tc;
+ v8::Local<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope);
+ v8::Local<v8::Script> script = ep->v8engine()->qmlModeCompile(code, filename, line);
+ if (tc.HasCaught()) {
+ QQmlError error;
+ error.setDescription(QLatin1String("Exception occurred during function compilation"));
+ error.setLine(line);
+ error.setUrl(QUrl::fromLocalFile(filename));
+ v8::Local<v8::Message> message = tc.Message();
+ if (!message.IsEmpty())
+ QQmlExpressionPrivate::exceptionToError(message, error);
+ ep->warning(error);
+ return v8::Persistent<v8::Function>();
+ }
+ v8::Local<v8::Value> result = script->Run(scopeobject);
+ if (tc.HasCaught()) {
+ QQmlError error;
+ error.setDescription(QLatin1String("Exception occurred during function evaluation"));
+ error.setLine(line);
+ error.setUrl(QUrl::fromLocalFile(filename));
+ v8::Local<v8::Message> message = tc.Message();
+ if (!message.IsEmpty())
+ QQmlExpressionPrivate::exceptionToError(message, error);
+ ep->warning(error);
+ return v8::Persistent<v8::Function>();
+ }
+ if (qmlscope) *qmlscope = qPersistentNew<v8::Object>(scopeobject);
+ return qPersistentNew<v8::Function>(v8::Local<v8::Function>::Cast(result));
+}
+
+void QQmlJavaScriptExpression::clearGuards()
+{
+ while (Guard *g = activeGuards.takeFirst())
+ g->Delete();
+}
+
+QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
new file mode 100644
index 0000000000..5d790e4570
--- /dev/null
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -0,0 +1,283 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLJAVASCRIPTEXPRESSION_P_H
+#define QQMLJAVASCRIPTEXPRESSION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qv8_p.h>
+#include <QtCore/qglobal.h>
+#include <QtQml/qqmlerror.h>
+#include <private/qqmlengine_p.h>
+#include <private/qpointervaluepair_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlDelayedError
+{
+public:
+ inline QQmlDelayedError() : nextError(0), prevError(0) {}
+ inline ~QQmlDelayedError() { removeError(); }
+
+ QQmlError error;
+
+ bool addError(QQmlEnginePrivate *);
+
+ inline void removeError() {
+ if (!prevError) return;
+ if (nextError) nextError->prevError = prevError;
+ *prevError = nextError;
+ nextError = 0;
+ prevError = 0;
+ }
+
+private:
+ QQmlDelayedError *nextError;
+ QQmlDelayedError **prevError;
+};
+
+class QQmlJavaScriptExpression
+{
+public:
+ // Although this looks crazy, we implement our own "vtable" here, rather than relying on
+ // C++ virtuals, to save memory. By doing it ourselves, we can overload the storage
+ // location that is use for the vtable to also store the rarely used delayed error.
+ // If we use C++ virtuals, we can't do this and it consts us an extra sizeof(void *) in
+ // memory for every expression.
+ struct VTable {
+ QString (*expressionIdentifier)(QQmlJavaScriptExpression *);
+ void (*expressionChanged)(QQmlJavaScriptExpression *);
+ };
+
+ QQmlJavaScriptExpression(VTable *vtable);
+
+ v8::Local<v8::Value> evaluate(QQmlContextData *, v8::Handle<v8::Function>,
+ bool *isUndefined);
+
+ inline bool requiresThisObject() const;
+ inline void setRequiresThisObject(bool v);
+ inline bool useSharedContext() const;
+ inline void setUseSharedContext(bool v);
+ inline bool notifyOnValueChanged() const;
+
+ void setNotifyOnValueChanged(bool v);
+ void resetNotifyOnValueChanged();
+
+ inline QObject *scopeObject() const;
+ inline void setScopeObject(QObject *v);
+
+ class DeleteWatcher {
+ public:
+ inline DeleteWatcher(QQmlJavaScriptExpression *);
+ inline ~DeleteWatcher();
+ inline bool wasDeleted() const;
+ private:
+ friend class QQmlJavaScriptExpression;
+ QObject *_c;
+ QQmlJavaScriptExpression **_w;
+ QQmlJavaScriptExpression *_s;
+ };
+
+ inline bool hasError() const;
+ inline bool hasDelayedError() const;
+ QQmlError error() const;
+ void clearError();
+ QQmlDelayedError *delayedError();
+
+ static void exceptionToError(v8::Handle<v8::Message>, QQmlError &);
+ static v8::Persistent<v8::Function> evalFunction(QQmlContextData *ctxt, QObject *scope,
+ const QString &code, const QString &filename,
+ int line,
+ v8::Persistent<v8::Object> *qmlscope = 0);
+ static v8::Persistent<v8::Function> evalFunction(QQmlContextData *ctxt, QObject *scope,
+ const char *code, int codeLength,
+ const QString &filename, int line,
+ v8::Persistent<v8::Object> *qmlscope = 0);
+protected:
+ ~QQmlJavaScriptExpression();
+
+private:
+ typedef QQmlJavaScriptExpressionGuard Guard;
+ friend class QQmlJavaScriptExpressionGuard;
+
+ struct GuardCapture : public QQmlEnginePrivate::PropertyCapture {
+ GuardCapture(QQmlEngine *engine, QQmlJavaScriptExpression *e)
+ : engine(engine), expression(e), errorString(0) { }
+
+ ~GuardCapture() {
+ Q_ASSERT(guards.isEmpty());
+ Q_ASSERT(errorString == 0);
+ }
+
+ virtual void captureProperty(QQmlNotifier *);
+ virtual void captureProperty(QObject *, int, int);
+
+ QQmlEngine *engine;
+ QQmlJavaScriptExpression *expression;
+ QFieldList<Guard, &Guard::next> guards;
+ QStringList *errorString;
+ };
+
+ QPointerValuePair<VTable, QQmlDelayedError> m_vtable;
+
+ // We store some flag bits in the following flag pointers.
+ // m_scopeObject:flag1 - requiresThisObject
+ // activeGuards:flag1 - notifyOnValueChanged
+ // activeGuards:flag2 - useSharedContext
+ QBiPointer<QObject, DeleteWatcher> m_scopeObject;
+ QForwardFieldList<Guard, &Guard::next> activeGuards;
+
+ void clearGuards();
+};
+
+QQmlJavaScriptExpression::DeleteWatcher::DeleteWatcher(QQmlJavaScriptExpression *e)
+: _c(0), _w(0), _s(e)
+{
+ if (e->m_scopeObject.isT1()) {
+ _w = &_s;
+ _c = e->m_scopeObject.asT1();
+ e->m_scopeObject = this;
+ } else {
+ // Another watcher is already registered
+ _w = &e->m_scopeObject.asT2()->_s;
+ }
+}
+
+QQmlJavaScriptExpression::DeleteWatcher::~DeleteWatcher()
+{
+ Q_ASSERT(*_w == 0 || (*_w == _s && _s->m_scopeObject.isT2()));
+ if (*_w && _s->m_scopeObject.asT2() == this)
+ _s->m_scopeObject = _c;
+}
+
+bool QQmlJavaScriptExpression::DeleteWatcher::wasDeleted() const
+{
+ return *_w == 0;
+}
+
+bool QQmlJavaScriptExpression::requiresThisObject() const
+{
+ return m_scopeObject.flag();
+}
+
+void QQmlJavaScriptExpression::setRequiresThisObject(bool v)
+{
+ m_scopeObject.setFlagValue(v);
+}
+
+bool QQmlJavaScriptExpression::useSharedContext() const
+{
+ return activeGuards.flag2();
+}
+
+void QQmlJavaScriptExpression::setUseSharedContext(bool v)
+{
+ activeGuards.setFlag2Value(v);
+}
+
+bool QQmlJavaScriptExpression::notifyOnValueChanged() const
+{
+ return activeGuards.flag();
+}
+
+QObject *QQmlJavaScriptExpression::scopeObject() const
+{
+ if (m_scopeObject.isT1()) return m_scopeObject.asT1();
+ else return m_scopeObject.asT2()->_c;
+}
+
+void QQmlJavaScriptExpression::setScopeObject(QObject *v)
+{
+ if (m_scopeObject.isT1()) m_scopeObject = v;
+ else m_scopeObject.asT2()->_c = v;
+}
+
+bool QQmlJavaScriptExpression::hasError() const
+{
+ return m_vtable.hasValue() && m_vtable.constValue()->error.isValid();
+}
+
+bool QQmlJavaScriptExpression::hasDelayedError() const
+{
+ return m_vtable.hasValue();
+}
+
+QQmlJavaScriptExpressionGuard::QQmlJavaScriptExpressionGuard(QQmlJavaScriptExpression *e)
+: expression(e), next(0)
+{
+ callback = &endpointCallback;
+}
+
+void QQmlJavaScriptExpressionGuard::endpointCallback(QQmlNotifierEndpoint *e)
+{
+ QQmlJavaScriptExpression *expression =
+ static_cast<QQmlJavaScriptExpressionGuard *>(e)->expression;
+
+ expression->m_vtable->expressionChanged(expression);
+}
+
+QQmlJavaScriptExpressionGuard *
+QQmlJavaScriptExpressionGuard::New(QQmlJavaScriptExpression *e,
+ QQmlEngine *engine)
+{
+ Q_ASSERT(e);
+ return QQmlEnginePrivate::get(engine)->jsExpressionGuardPool.New(e);
+}
+
+void QQmlJavaScriptExpressionGuard::Delete()
+{
+ QRecyclePool<QQmlJavaScriptExpressionGuard>::Delete(this);
+}
+
+
+QT_END_NAMESPACE
+
+#endif // QQMLJAVASCRIPTEXPRESSION_P_H
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index d684378832..4a4563ccd4 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -1023,13 +1023,13 @@ v8::Handle<v8::Value> QQmlLocale::localeCompare(const v8::Arguments &args)
Holds the first day of the week according to the current locale.
\list
- \o Locale.Sunday = 0
- \o Locale.Monday = 1
- \o Locale.Tuesday = 2
- \o Locale.Wednesday = 3
- \o Locale.Thursday = 4
- \o Locale.Friday = 5
- \o Locale.Saturday = 6
+ \li Locale.Sunday = 0
+ \li Locale.Monday = 1
+ \li Locale.Tuesday = 2
+ \li Locale.Wednesday = 3
+ \li Locale.Thursday = 4
+ \li Locale.Friday = 5
+ \li Locale.Saturday = 6
\endlist
\note that these values match the JS Date API which is different
@@ -1062,8 +1062,8 @@ v8::Handle<v8::Value> QQmlLocale::localeCompare(const v8::Arguments &args)
Holds the text direction of the language:
\list
- \o Qt.LeftToRight
- \o Qt.RightToLeft
+ \li Qt.LeftToRight
+ \li Qt.RightToLeft
\endlist
*/
@@ -1084,9 +1084,9 @@ v8::Handle<v8::Value> QQmlLocale::localeCompare(const v8::Arguments &args)
Returns the currency symbol for the specified \a format:
\list
- \o Locale.CurrencyIsoCode a ISO-4217 code of the currency.
- \o Locale.CurrencySymbol a currency symbol.
- \o Locale.CurrencyDisplayName a user readable name of the currency.
+ \li Locale.CurrencyIsoCode a ISO-4217 code of the currency.
+ \li Locale.CurrencySymbol a currency symbol.
+ \li Locale.CurrencyDisplayName a user readable name of the currency.
\endlist
\sa Number::toLocaleCurrencyString()
*/
@@ -1115,9 +1115,9 @@ v8::Handle<v8::Value> QQmlLocale::localeCompare(const v8::Arguments &args)
This property defines which units are used for measurement.
\list
- \o Locale.MetricSystem This value indicates metric units, such as meters,
+ \li Locale.MetricSystem This value indicates metric units, such as meters,
centimeters and millimeters.
- \o Locale.ImperialSystem This value indicates imperial units, such as inches and
+ \li Locale.ImperialSystem This value indicates imperial units, such as inches and
miles. There are several distinct imperial systems in the world; this
value stands for the official United States imperial units.
\endlist
diff --git a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
index cc33f387d9..e5d0d708e2 100644
--- a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
+++ b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
@@ -65,12 +65,12 @@ QT_BEGIN_NAMESPACE
be created in a different thread:
\list
- \o The QML engine internally handles all requests, and cleans up any
+ \li The QML engine internally handles all requests, and cleans up any
QNetworkReply objects it creates. Receiving the
QNetworkAccessManager::finished() signal in another thread may not
provide the receiver with a valid reply object if it has already
been deleted.
- \o Authentication details provided to QNetworkAccessManager::authenticationRequired()
+ \li Authentication details provided to QNetworkAccessManager::authenticationRequired()
must be provided immediately, so this signal cannot be connected as a
Qt::QueuedConnection (or as the default Qt::AutoConnection from another
thread).
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 34d9d0a5f5..d3778fa5c5 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -55,6 +55,7 @@
#include "qqmlcompiler_p.h"
#include "qqmlvmemetaobject_p.h"
#include "qqmlexpression_p.h"
+#include "qqmlvaluetypeproxybinding_p.h"
#include <QStringList>
#include <QtCore/qdebug.h>
@@ -1530,24 +1531,6 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
return true;
}
-bool QQmlPropertyPrivate::writeBinding(const QQmlProperty &that,
- QQmlContextData *context,
- QQmlJavaScriptExpression *expression,
- v8::Handle<v8::Value> result, bool isUndefined,
- WriteFlags flags)
-{
- QQmlPropertyPrivate *pp = that.d;
-
- if (!pp)
- return true;
-
- QObject *object = that.object();
- if (!object)
- return true;
-
- return writeBinding(object, pp->core, context, expression, result, isUndefined, flags);
-}
-
const QMetaObject *QQmlPropertyPrivate::rawMetaObjectForType(QQmlEnginePrivate *engine, int userType)
{
if (engine) {
diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h
index 0f97a63155..f4a9ced53b 100644
--- a/src/qml/qml/qqmlproperty_p.h
+++ b/src/qml/qml/qqmlproperty_p.h
@@ -54,6 +54,7 @@
//
#include "qqmlproperty.h"
+#include "qqmlengine.h"
#include <private/qobject_p.h>
#include <private/qtqmlglobal_p.h>
@@ -77,7 +78,7 @@ public:
Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
QQmlContextData *context;
- QQmlEngine *engine;
+ QQmlGuard<QQmlEngine> engine;
QQmlGuard<QObject> object;
QQmlPropertyData core;
@@ -143,11 +144,6 @@ public:
static QQmlExpression *setSignalExpression(const QQmlProperty &that,
QQmlExpression *) ;
static bool write(const QQmlProperty &that, const QVariant &, WriteFlags);
- static bool writeBinding(const QQmlProperty &that,
- QQmlContextData *context,
- QQmlJavaScriptExpression *expression,
- v8::Handle<v8::Value> result, bool isUndefined,
- WriteFlags flags);
static bool writeBinding(QObject *, const QQmlPropertyData &,
QQmlContextData *context,
QQmlJavaScriptExpression *expression,
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 5cbb2f6943..781915e23e 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -63,6 +63,19 @@
#include <dirent.h>
#endif
+#if defined (QT_LINUXBASE)
+// LSB doesn't declare NAME_MAX. Use SYMLINK_MAX instead, which seems to
+// always be identical to NAME_MAX
+#ifndef NAME_MAX
+# define NAME_MAX _POSIX_SYMLINK_MAX
+#endif
+
+// LSB has a broken version of offsetof that can't be used at compile time
+// https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=3462
+#undef offsetof
+#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
+#endif
+
// #define DATABLOB_DEBUG
#ifdef DATABLOB_DEBUG
@@ -248,14 +261,14 @@ The QQmlDataLoader invokes callbacks on the QQmlDataBlob as data becomes availab
This enum describes the status of the data blob.
\list
-\o Null The blob has not yet been loaded by a QQmlDataLoader
-\o Loading The blob is loading network data. The QQmlDataBlob::setData() callback has not yet been
+\li Null The blob has not yet been loaded by a QQmlDataLoader
+\li Loading The blob is loading network data. The QQmlDataBlob::setData() callback has not yet been
invoked or has not yet returned.
-\o WaitingForDependencies The blob is waiting for dependencies to be done before continueing. This status
+\li WaitingForDependencies The blob is waiting for dependencies to be done before continueing. This status
only occurs after the QQmlDataBlob::setData() callback has been made, and when the blob has outstanding
dependencies.
-\o Complete The blob's data has been loaded and all dependencies are done.
-\o Error An error has been set on this blob.
+\li Complete The blob's data has been loaded and all dependencies are done.
+\li Error An error has been set on this blob.
\endlist
*/
@@ -265,9 +278,9 @@ dependencies.
This enum describes the type of the data blob.
\list
-\o QmlFile This is a QQmlTypeData
-\o JavaScriptFile This is a QQmlScriptData
-\o QmldirFile This is a QQmlQmldirData
+\li QmlFile This is a QQmlTypeData
+\li JavaScriptFile This is a QQmlScriptData
+\li QmldirFile This is a QQmlQmldirData
\endlist
*/
@@ -877,9 +890,9 @@ To complete processing, the QQmlDataBlob::done() callback is invoked. done() is
one of these three preconditions are met.
\list 1
-\o The QQmlDataBlob has no dependencies.
-\o The QQmlDataBlob has an error set.
-\o All the QQmlDataBlob's dependencies are themselves "done()".
+\li The QQmlDataBlob has no dependencies.
+\li The QQmlDataBlob has an error set.
+\li All the QQmlDataBlob's dependencies are themselves "done()".
\endlist
Thus QQmlDataBlob::done() will always eventually be called, even if the blob has an error set.
@@ -1171,7 +1184,7 @@ This enum defines the options that control the way type data is handled.
/*!
Returns a QQmlTypeData for the specified \a url. The QQmlTypeData may be cached.
*/
-QQmlTypeData *QQmlTypeLoader::get(const QUrl &url)
+QQmlTypeData *QQmlTypeLoader::get(const QUrl &url, Mode mode)
{
Q_ASSERT(!url.isRelative() &&
(QQmlEnginePrivate::urlToLocalFileOrQrc(url).isEmpty() ||
@@ -1184,7 +1197,7 @@ QQmlTypeData *QQmlTypeLoader::get(const QUrl &url)
if (!typeData) {
typeData = new QQmlTypeData(url, None, this);
m_typeCache.insert(url, typeData);
- QQmlDataLoader::load(typeData);
+ QQmlDataLoader::load(typeData, mode);
}
typeData->addref();
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index 0dd7adecac..c8c2756bd5 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -236,7 +236,7 @@ public:
};
Q_DECLARE_FLAGS(Options, Option)
- QQmlTypeData *get(const QUrl &url);
+ QQmlTypeData *get(const QUrl &url, Mode mode = PreferSynchronous);
QQmlTypeData *get(const QByteArray &, const QUrl &url, Options = None);
void clearCache();
diff --git a/src/qml/qml/qqmlvaluetypeproxybinding.cpp b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
new file mode 100644
index 0000000000..2cc15a50f5
--- /dev/null
+++ b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlvaluetypeproxybinding_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QQmlValueTypeProxyBinding::QQmlValueTypeProxyBinding(QObject *o, int index)
+: m_object(o), m_index(index), m_bindings(0)
+{
+}
+
+QQmlValueTypeProxyBinding::~QQmlValueTypeProxyBinding()
+{
+ while (m_bindings) {
+ QQmlAbstractBinding *binding = m_bindings;
+ binding->setEnabled(false, 0);
+ binding->destroy();
+ }
+}
+
+void QQmlValueTypeProxyBinding::setEnabled(bool e, QQmlPropertyPrivate::WriteFlags flags)
+{
+ if (e) {
+ QQmlAbstractBinding *bindings = m_bindings;
+ recursiveEnable(bindings, flags);
+ } else {
+ QQmlAbstractBinding *bindings = m_bindings;
+ recursiveDisable(bindings);
+ }
+}
+
+void QQmlValueTypeProxyBinding::recursiveEnable(QQmlAbstractBinding *b, QQmlPropertyPrivate::WriteFlags flags)
+{
+ if (!b)
+ return;
+
+ recursiveEnable(b->m_nextBinding, flags);
+
+ if (b)
+ b->setEnabled(true, flags);
+}
+
+void QQmlValueTypeProxyBinding::recursiveDisable(QQmlAbstractBinding *b)
+{
+ if (!b)
+ return;
+
+ recursiveDisable(b->m_nextBinding);
+
+ if (b)
+ b->setEnabled(false, 0);
+}
+
+void QQmlValueTypeProxyBinding::update(QQmlPropertyPrivate::WriteFlags)
+{
+}
+
+QQmlAbstractBinding *QQmlValueTypeProxyBinding::binding(int propertyIndex)
+{
+ QQmlAbstractBinding *binding = m_bindings;
+
+ while (binding && binding->propertyIndex() != propertyIndex)
+ binding = binding->m_nextBinding;
+
+ return binding;
+}
+
+/*!
+Removes a collection of bindings, corresponding to the set bits in \a mask.
+*/
+void QQmlValueTypeProxyBinding::removeBindings(quint32 mask)
+{
+ QQmlAbstractBinding *binding = m_bindings;
+ while (binding) {
+ if (mask & (1 << (binding->propertyIndex() >> 24))) {
+ QQmlAbstractBinding *remove = binding;
+ binding = remove->m_nextBinding;
+ *remove->m_prevBinding = remove->m_nextBinding;
+ if (remove->m_nextBinding) remove->m_nextBinding->m_prevBinding = remove->m_prevBinding;
+ remove->m_prevBinding = 0;
+ remove->m_nextBinding = 0;
+ remove->destroy();
+ } else {
+ binding = binding->m_nextBinding;
+ }
+ }
+}
+
+int QQmlValueTypeProxyBinding::propertyIndex() const
+{
+ return m_index;
+}
+
+QObject *QQmlValueTypeProxyBinding::object() const
+{
+ return m_object;
+}
+
+QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlbinding_p_p.h b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
index b53c903916..0135d575df 100644
--- a/src/qml/qml/qqmlbinding_p_p.h
+++ b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QQMLBINDING_P_P_H
-#define QQMLBINDING_P_P_H
+#ifndef QQMLVALUETYPEPROXYBINDING_P_H
+#define QQMLVALUETYPEPROXYBINDING_P_H
//
// W A R N I N G
@@ -53,37 +53,39 @@
// We mean it.
//
-#include "qqmlbinding_p.h"
-
-#include "qqmlproperty.h"
-#include "qqmlexpression_p.h"
+#include <private/qqmlabstractbinding_p.h>
QT_BEGIN_NAMESPACE
-class QQmlBindingPrivate : public QQmlExpressionPrivate
+class QQmlValueTypeProxyBinding : public QQmlAbstractBinding
{
- Q_DECLARE_PUBLIC(QQmlBinding)
public:
- QQmlBindingPrivate();
- ~QQmlBindingPrivate();
+ QQmlValueTypeProxyBinding(QObject *o, int coreIndex);
+
+ virtual Type bindingType() const { return ValueTypeProxy; }
+
+ virtual void setEnabled(bool, QQmlPropertyPrivate::WriteFlags);
+ virtual void update(QQmlPropertyPrivate::WriteFlags);
+ virtual int propertyIndex() const;
+ virtual QObject *object() const;
- virtual void expressionChanged();
+ QQmlAbstractBinding *binding(int propertyIndex);
- static void printBindingLoopError(QQmlProperty &prop);
+ void removeBindings(quint32 mask);
protected:
- virtual void refresh();
+ ~QQmlValueTypeProxyBinding();
private:
- bool updating:1;
- bool enabled:1;
- int columnNumber;
- QQmlProperty property;
+ void recursiveEnable(QQmlAbstractBinding *, QQmlPropertyPrivate::WriteFlags);
+ void recursiveDisable(QQmlAbstractBinding *);
- QObject *target;
- int targetProperty;
+ friend class QQmlAbstractBinding;
+ QObject *m_object;
+ int m_index;
+ QQmlAbstractBinding *m_bindings;
};
QT_END_NAMESPACE
-#endif // QQMLBINDING_P_P_H
+#endif // QQMLVALUETYPEPROXYBINDING_P_H
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 9ef9ca96ef..86e9f0963a 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -57,7 +57,6 @@
#include "qqmlengine_p.h"
#include "qqmlcomponent_p.h"
#include "qqmlvmemetaobject_p.h"
-#include "qqmlbinding_p_p.h"
#include "qqmlcontext_p.h"
#include <private/qv4bindings_p.h>
#include <private/qv8bindings_p.h>
@@ -66,6 +65,7 @@
#include "qqmlscriptstring.h"
#include "qqmlscriptstring_p.h"
#include "qqmlpropertyvalueinterceptor_p.h"
+#include "qqmlvaluetypeproxybinding_p.h"
#include <QStack>
#include <QColor>
@@ -767,8 +767,8 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_NEXT_INSTR(StoreBinding);
QQmlBinding *bind = new QQmlBinding(PRIMITIVES.at(instr.value), true,
- context, CTXT, COMP->name, instr.line,
- instr.column);
+ context, CTXT, COMP->name, instr.line,
+ instr.column);
bindValues.push(bind);
bind->m_mePtr = &bindValues.top();
bind->setTarget(target, instr.property, CTXT);
@@ -790,8 +790,8 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_NEXT_INSTR(StoreBindingOnAlias);
QQmlBinding *bind = new QQmlBinding(PRIMITIVES.at(instr.value), true,
- context, CTXT, COMP->name, instr.line,
- instr.column);
+ context, CTXT, COMP->name, instr.line,
+ instr.column);
bindValues.push(bind);
bind->m_mePtr = &bindValues.top();
bind->setTarget(target, instr.property, CTXT);
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index a7af2db837..c4e801f2db 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -56,6 +56,28 @@ Q_DECLARE_METATYPE(QJSValue);
QT_BEGIN_NAMESPACE
+QQmlVMEVariantQObjectPtr::QQmlVMEVariantQObjectPtr()
+ : QQmlGuard<QObject>(0), m_target(0), m_index(-1)
+{
+}
+
+QQmlVMEVariantQObjectPtr::~QQmlVMEVariantQObjectPtr()
+{
+}
+
+void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *)
+{
+ if (m_target && m_index >= 0)
+ m_target->activate(m_target->object, m_target->methodOffset + m_index, 0);
+}
+
+void QQmlVMEVariantQObjectPtr::setGuardedValue(QObject *obj, QQmlVMEMetaObject *target, int index)
+{
+ m_target = target;
+ m_index = index;
+ setObject(obj);
+}
+
class QQmlVMEVariant
{
public:
@@ -79,7 +101,7 @@ public:
inline const QDateTime &asQDateTime();
inline const QJSValue &asQJSValue();
- inline void setValue(QObject *);
+ inline void setValue(QObject *v, QQmlVMEMetaObject *target, int index);
inline void setValue(const QVariant &);
inline void setValue(int);
inline void setValue(bool);
@@ -93,7 +115,7 @@ public:
inline void setValue(const QJSValue &);
private:
int type;
- void *data[4]; // Large enough to hold all types
+ void *data[6]; // Large enough to hold all types
inline void cleanup();
};
@@ -127,7 +149,7 @@ void QQmlVMEVariant::cleanup()
type == QMetaType::Double) {
type = QVariant::Invalid;
} else if (type == QMetaType::QObjectStar) {
- ((QQmlGuard<QObject>*)dataPtr())->~QQmlGuard<QObject>();
+ ((QQmlVMEVariantQObjectPtr*)dataPtr())->~QQmlVMEVariantQObjectPtr();
type = QVariant::Invalid;
} else if (type == QMetaType::QString) {
((QString *)dataPtr())->~QString();
@@ -174,8 +196,8 @@ void *QQmlVMEVariant::dataPtr()
QObject *QQmlVMEVariant::asQObject()
{
- if (type != QMetaType::QObjectStar)
- setValue((QObject *)0);
+ if (type != QMetaType::QObjectStar)
+ setValue((QObject *)0, 0, -1);
return *(QQmlGuard<QObject> *)(dataPtr());
}
@@ -268,14 +290,14 @@ const QJSValue &QQmlVMEVariant::asQJSValue()
return *(QJSValue *)(dataPtr());
}
-void QQmlVMEVariant::setValue(QObject *v)
+void QQmlVMEVariant::setValue(QObject *v, QQmlVMEMetaObject *target, int index)
{
if (type != QMetaType::QObjectStar) {
cleanup();
type = QMetaType::QObjectStar;
- new (dataPtr()) QQmlGuard<QObject>();
+ new (dataPtr()) QQmlVMEVariantQObjectPtr;
}
- *(QQmlGuard<QObject>*)(dataPtr()) = v;
+ reinterpret_cast<QQmlVMEVariantQObjectPtr*>(dataPtr())->setGuardedValue(v, target, index);
}
void QQmlVMEVariant::setValue(const QVariant &v)
@@ -629,7 +651,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
break;
case QMetaType::QObjectStar:
needActivate = *reinterpret_cast<QObject **>(a[0]) != data[id].asQObject();
- data[id].setValue(*reinterpret_cast<QObject **>(a[0]));
+ data[id].setValue(*reinterpret_cast<QObject **>(a[0]), this, id);
break;
case QMetaType::QVariant:
writeProperty(id, *reinterpret_cast<QVariant *>(a[0]));
@@ -810,15 +832,17 @@ v8::Handle<v8::Value> QQmlVMEMetaObject::readVarProperty(int id)
{
Q_ASSERT(id >= firstVarPropertyIndex);
- ensureVarPropertiesAllocated();
- return varProperties->Get(id - firstVarPropertyIndex);
+ if (ensureVarPropertiesAllocated())
+ return varProperties->Get(id - firstVarPropertyIndex);
+ return v8::Handle<v8::Value>();
}
QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id)
{
if (id >= firstVarPropertyIndex) {
- ensureVarPropertiesAllocated();
- return QQmlEnginePrivate::get(ctxt->engine)->v8engine()->toVariant(varProperties->Get(id - firstVarPropertyIndex), -1);
+ if (ensureVarPropertiesAllocated())
+ return QQmlEnginePrivate::get(ctxt->engine)->v8engine()->toVariant(varProperties->Get(id - firstVarPropertyIndex), -1);
+ return QVariant();
} else {
if (data[id].dataType() == QMetaType::QObjectStar) {
return QVariant::fromValue(data[id].asQObject());
@@ -831,7 +855,8 @@ QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id)
void QQmlVMEMetaObject::writeVarProperty(int id, v8::Handle<v8::Value> value)
{
Q_ASSERT(id >= firstVarPropertyIndex);
- ensureVarPropertiesAllocated();
+ if (!ensureVarPropertiesAllocated())
+ return;
// Importantly, if the current value is a scarce resource, we need to ensure that it
// gets automatically released by the engine if no other references to it exist.
@@ -860,7 +885,8 @@ void QQmlVMEMetaObject::writeVarProperty(int id, v8::Handle<v8::Value> value)
void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value)
{
if (id >= firstVarPropertyIndex) {
- ensureVarPropertiesAllocated();
+ if (!ensureVarPropertiesAllocated())
+ return;
// Importantly, if the current value is a scarce resource, we need to ensure that it
// gets automatically released by the engine if no other references to it exist.
@@ -892,7 +918,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value)
if (value.userType() == QMetaType::QObjectStar) {
QObject *o = qvariant_cast<QObject *>(value);
needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o);
- data[id].setValue(qvariant_cast<QObject *>(value));
+ data[id].setValue(qvariant_cast<QObject *>(value), this, id);
} else {
needActivate = (data[id].dataType() != qMetaTypeId<QVariant>() ||
data[id].asQVariant().userType() != value.userType() ||
@@ -1007,10 +1033,17 @@ void QQmlVMEMetaObject::setVMEProperty(int index, v8::Handle<v8::Value> v)
return writeVarProperty(index - propOffset, v);
}
-void QQmlVMEMetaObject::ensureVarPropertiesAllocated()
+bool QQmlVMEMetaObject::ensureVarPropertiesAllocated()
{
if (!varPropertiesInitialized)
allocateVarPropertiesArray();
+
+ // in some situations, the QObject's v8object (and associated v8 data,
+ // such as the varProperties array) will have been cleaned up, but the
+ // QObject ptr will not yet have been deleted (eg, waiting on deleteLater).
+ // In this situation, the varProperties handle will be (and should remain)
+ // empty.
+ return !varProperties.IsEmpty();
}
// see also: QV8GCCallback::garbageCollectorPrologueCallback()
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index deee989383..1b5ceb8203 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -136,6 +136,19 @@ struct QQmlVMEMetaData
}
};
+class QQmlVMEMetaObject;
+class QQmlVMEVariantQObjectPtr : public QQmlGuard<QObject>
+{
+public:
+ inline QQmlVMEVariantQObjectPtr();
+ inline ~QQmlVMEVariantQObjectPtr();
+ inline void objectDestroyed(QObject *);
+ inline void setGuardedValue(QObject *obj, QQmlVMEMetaObject *target, int index);
+
+ QQmlVMEMetaObject *m_target;
+ int m_index;
+};
+
class QV8QObjectWrapper;
class QQmlVMEVariant;
class QQmlRefCount;
@@ -163,6 +176,7 @@ protected:
private:
friend class QQmlVMEMetaObjectEndpoint;
+ friend class QQmlVMEVariantQObjectPtr;
QObject *object;
QQmlCompiledData *compiledData;
@@ -181,7 +195,7 @@ private:
static void VarPropertiesWeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter);
static void GcPrologueCallback(QV8GCCallback::Node *node);
inline void allocateVarPropertiesArray();
- inline void ensureVarPropertiesAllocated();
+ inline bool ensureVarPropertiesAllocated();
void connectAlias(int aliasId);
QBitArray aConnected;
diff --git a/src/qml/qml/qquickworkerscript.cpp b/src/qml/qml/qquickworkerscript.cpp
index 529f181e7a..e689f9da72 100644
--- a/src/qml/qml/qquickworkerscript.cpp
+++ b/src/qml/qml/qquickworkerscript.cpp
@@ -640,9 +640,9 @@ void QQuickWorkerScript::setSource(const QUrl &source)
types:
\list
- \o boolean, number, string
- \o JavaScript objects and arrays
- \o ListModel objects (any other type of QObject* is not allowed)
+ \li boolean, number, string
+ \li JavaScript objects and arrays
+ \li ListModel objects (any other type of QObject* is not allowed)
\endlist
All objects and arrays are copied to the \c message. With the exception
diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp
index 93c7820ca2..5d367f2ae6 100644
--- a/src/qml/qml/v4/qv4bindings.cpp
+++ b/src/qml/qml/v4/qv4bindings.cpp
@@ -66,6 +66,7 @@ struct Register {
typedef QQmlRegisterType Type;
void setUndefined() { dataType = UndefinedType; }
+ void setNull() { dataType = NullType; }
void setNaN() { setqreal(qSNaN()); }
bool isUndefined() const { return dataType == UndefinedType; }
@@ -820,6 +821,29 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks,
registers[instr->load.reg].setQObject(context->contextObject);
QML_V4_END_INSTR(LoadRoot, load)
+ QML_V4_BEGIN_INSTR(LoadModuleObject, load)
+ {
+ Register &reg = registers[instr->load.reg];
+
+ const QString *name = reg.getstringptr();
+ QQmlTypeNameCache::Result r = context->imports->query(*name);
+ reg.cleanupString();
+
+ if (r.isValid() && r.importNamespace) {
+ QQmlMetaType::ModuleApiInstance *moduleApi = context->imports->moduleApi(r.importNamespace);
+ if (moduleApi) {
+ if (moduleApi->qobjectCallback) {
+ moduleApi->qobjectApi = moduleApi->qobjectCallback(context->engine, context->engine);
+ moduleApi->qobjectCallback = 0;
+ moduleApi->scriptCallback = 0;
+ }
+ if (moduleApi->qobjectApi)
+ reg.setQObject(moduleApi->qobjectApi);
+ }
+ }
+ }
+ QML_V4_END_INSTR(LoadModuleObject, load)
+
QML_V4_BEGIN_INSTR(LoadAttached, attached)
{
const Register &input = registers[instr->attached.reg];
@@ -1216,6 +1240,10 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks,
}
QML_V4_END_INSTR(MathPIReal, unaryop)
+ QML_V4_BEGIN_INSTR(LoadNull, null_value)
+ registers[instr->null_value.reg].setNull();
+ QML_V4_END_INSTR(LoadNull, null_value)
+
QML_V4_BEGIN_INSTR(LoadReal, real_value)
registers[instr->real_value.reg].setqreal(instr->real_value.value);
QML_V4_END_INSTR(LoadReal, real_value)
@@ -1498,6 +1526,46 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks,
}
QML_V4_END_INSTR(StrictNotEqualString, binaryop)
+ QML_V4_BEGIN_INSTR(EqualObject, binaryop)
+ {
+ const Register &left = registers[instr->binaryop.left];
+ const Register &right = registers[instr->binaryop.right];
+ QObject *leftobj = (left.gettype() == NullType) ? 0 : left.getQObject();
+ QObject *rightobj = (right.gettype() == NullType) ? 0 : right.getQObject();
+ registers[instr->binaryop.output].setbool(leftobj == rightobj);
+ }
+ QML_V4_END_INSTR(EqualObject, binaryop)
+
+ QML_V4_BEGIN_INSTR(NotEqualObject, binaryop)
+ {
+ const Register &left = registers[instr->binaryop.left];
+ const Register &right = registers[instr->binaryop.right];
+ QObject *leftobj = (left.gettype() == NullType) ? 0 : left.getQObject();
+ QObject *rightobj = (right.gettype() == NullType) ? 0 : right.getQObject();
+ registers[instr->binaryop.output].setbool(leftobj != rightobj);
+ }
+ QML_V4_END_INSTR(NotEqualObject, binaryop)
+
+ QML_V4_BEGIN_INSTR(StrictEqualObject, binaryop)
+ {
+ const Register &left = registers[instr->binaryop.left];
+ const Register &right = registers[instr->binaryop.right];
+ QObject *leftobj = (left.gettype() == NullType) ? 0 : left.getQObject();
+ QObject *rightobj = (right.gettype() == NullType) ? 0 : right.getQObject();
+ registers[instr->binaryop.output].setbool(leftobj == rightobj);
+ }
+ QML_V4_END_INSTR(StrictEqualObject, binaryop)
+
+ QML_V4_BEGIN_INSTR(StrictNotEqualObject, binaryop)
+ {
+ const Register &left = registers[instr->binaryop.left];
+ const Register &right = registers[instr->binaryop.right];
+ QObject *leftobj = (left.gettype() == NullType) ? 0 : left.getQObject();
+ QObject *rightobj = (right.gettype() == NullType) ? 0 : right.getQObject();
+ registers[instr->binaryop.output].setbool(leftobj != rightobj);
+ }
+ QML_V4_END_INSTR(StrictNotEqualObject, binaryop)
+
QML_V4_BEGIN_INSTR(MathMaxReal, binaryop)
{
const Register &left = registers[instr->binaryop.left];
diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp
index 620d260053..09b0f3861b 100644
--- a/src/qml/qml/v4/qv4compiler.cpp
+++ b/src/qml/qml/v4/qv4compiler.cpp
@@ -234,6 +234,12 @@ void QV4CompilerPrivate::visitConst(IR::Const *e)
gen(i);
} break;
+ case IR::NullType: {
+ Instr::LoadNull i;
+ i.reg = currentReg;
+ gen(i);
+ } break;
+
default:
if (qmlVerboseCompiler())
qWarning() << Q_FUNC_INFO << "unexpected type";
@@ -318,6 +324,22 @@ void QV4CompilerPrivate::visitName(IR::Name *e)
gen(attached);
} break;
+ case IR::Name::ModuleObject: {
+ /*
+ Existing module object lookup methods include:
+ 1. string -> module object (search via importCache->query(name))
+ 2. QQmlMetaType::ModuleApi -> module object (via QQmlEnginePrivate::moduleApiInstance() cache)
+ We currently use 1, which is not ideal for performance
+ */
+ _subscribeName << *e->id;
+
+ registerLiteralString(currentReg, e->id);
+
+ Instr::LoadModuleObject module;
+ module.reg = currentReg;
+ gen(module);
+ } break;
+
case IR::Name::Property: {
_subscribeName << *e->id;
@@ -666,21 +688,29 @@ quint8 QV4CompilerPrivate::instructionOpcode(IR::Binop *e)
return V4Instr::LeReal;
case IR::OpEqual:
+ if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
+ return V4Instr::EqualObject;
if (e->left->type == IR::StringType)
return V4Instr::EqualString;
return V4Instr::EqualReal;
case IR::OpNotEqual:
+ if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
+ return V4Instr::NotEqualObject;
if (e->left->type == IR::StringType)
return V4Instr::NotEqualString;
return V4Instr::NotEqualReal;
case IR::OpStrictEqual:
+ if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
+ return V4Instr::StrictEqualObject;
if (e->left->type == IR::StringType)
return V4Instr::StrictEqualString;
return V4Instr::StrictEqualReal;
case IR::OpStrictNotEqual:
+ if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
+ return V4Instr::StrictNotEqualObject;
if (e->left->type == IR::StringType)
return V4Instr::StrictNotEqualString;
return V4Instr::StrictNotEqualReal;
@@ -758,7 +788,7 @@ void QV4CompilerPrivate::visitBinop(IR::Binop *e)
case IR::OpNotEqual:
case IR::OpStrictEqual:
case IR::OpStrictNotEqual:
- if (e->left->type != IR::StringType) {
+ if (e->left->type >= IR::FirstNumberType) {
convertToReal(e->left, left);
convertToReal(e->right, right);
}
diff --git a/src/qml/qml/v4/qv4instruction.cpp b/src/qml/qml/v4/qv4instruction.cpp
index a392c9392c..1ed8bd245e 100644
--- a/src/qml/qml/v4/qv4instruction.cpp
+++ b/src/qml/qml/v4/qv4instruction.cpp
@@ -114,6 +114,9 @@ void Bytecode::dump(const V4Instr *i, int address) const
case V4Instr::LoadRoot:
INSTR_DUMP << "\t" << "LoadRoot" << "\t\t" << "-> Output_Reg(" << i->load.reg << ")";
break;
+ case V4Instr::LoadModuleObject:
+ INSTR_DUMP << "\t" << "LoadModuleObject" << "\t\t" << ") -> Output_Reg(" << i->load.reg << ")";
+ break;
case V4Instr::LoadAttached:
INSTR_DUMP << "\t" << "LoadAttached" << "\t\t" << "Object_Reg(" << i->attached.reg << ") Attached_Index(" << i->attached.id << ") -> Output_Reg(" << i->attached.output << ")";
break;
@@ -210,6 +213,9 @@ void Bytecode::dump(const V4Instr *i, int address) const
case V4Instr::MathPIReal:
INSTR_DUMP << "\t" << "MathPIReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
+ case V4Instr::LoadNull:
+ INSTR_DUMP << "\t" << "LoadNull" << "\t\t" << "Constant(null) -> Output_Reg(" << i->null_value.reg << ")";
+ break;
case V4Instr::LoadReal:
INSTR_DUMP << "\t" << "LoadReal" << "\t\t" << "Constant(" << i->real_value.value << ") -> Output_Reg(" << i->real_value.reg << ")";
break;
@@ -312,6 +318,18 @@ void Bytecode::dump(const V4Instr *i, int address) const
case V4Instr::StrictNotEqualString:
INSTR_DUMP << "\t" << "StrictNotEqualString" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
+ case V4Instr::EqualObject:
+ INSTR_DUMP << "\t" << "EqualObject" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ break;
+ case V4Instr::NotEqualObject:
+ INSTR_DUMP << "\t" << "NotEqualObject" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ break;
+ case V4Instr::StrictEqualObject:
+ INSTR_DUMP << "\t" << "StrictEqualObject" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ break;
+ case V4Instr::StrictNotEqualObject:
+ INSTR_DUMP << "\t" << "StrictNotEqualObject" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ break;
case V4Instr::MathMaxReal:
INSTR_DUMP << "\t" << "MathMaxReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
diff --git a/src/qml/qml/v4/qv4instruction_p.h b/src/qml/qml/v4/qv4instruction_p.h
index 9727c23959..d6c790e46f 100644
--- a/src/qml/qml/v4/qv4instruction_p.h
+++ b/src/qml/qml/v4/qv4instruction_p.h
@@ -73,6 +73,7 @@ QT_BEGIN_NAMESPACE
F(LoadId, load) \
F(LoadScope, load) \
F(LoadRoot, load) \
+ F(LoadModuleObject, load) \
F(LoadAttached, attached) \
F(UnaryNot, unaryop) \
F(UnaryMinusReal, unaryop) \
@@ -105,6 +106,7 @@ QT_BEGIN_NAMESPACE
F(MathFloorReal, unaryop) \
F(MathCeilReal, unaryop) \
F(MathPIReal, unaryop) \
+ F(LoadNull, null_value) \
F(LoadReal, real_value) \
F(LoadInt, int_value) \
F(LoadBool, bool_value) \
@@ -139,6 +141,10 @@ QT_BEGIN_NAMESPACE
F(NotEqualString, binaryop) \
F(StrictEqualString, binaryop) \
F(StrictNotEqualString, binaryop) \
+ F(EqualObject, binaryop) \
+ F(NotEqualObject, binaryop) \
+ F(StrictEqualObject, binaryop) \
+ F(StrictNotEqualObject, binaryop) \
F(MathMaxReal, binaryop) \
F(MathMinReal, binaryop) \
F(NewString, construct) \
@@ -270,6 +276,11 @@ union V4Instr {
qint8 reg;
};
+ struct instr_null_value {
+ QML_V4_INSTR_HEADER
+ qint8 reg;
+ };
+
struct instr_real_value {
QML_V4_INSTR_HEADER
qint8 reg;
@@ -357,6 +368,7 @@ union V4Instr {
instr_fetch fetch;
instr_copy copy;
instr_construct construct;
+ instr_null_value null_value;
instr_real_value real_value;
instr_int_value int_value;
instr_bool_value bool_value;
diff --git a/src/qml/qml/v4/qv4ir.cpp b/src/qml/qml/v4/qv4ir.cpp
index 54679c3d8c..34245f5bf4 100644
--- a/src/qml/qml/v4/qv4ir.cpp
+++ b/src/qml/qml/v4/qv4ir.cpp
@@ -543,6 +543,17 @@ Name *BasicBlock::ATTACH_TYPE(const QString &id, const QQmlType *attachType, Nam
return name;
}
+Name *BasicBlock::MODULE_OBJECT(const QString &id, const QMetaObject *meta, Name::Storage storage,
+ quint32 line, quint32 column)
+{
+ Name *name = function->pool->New<Name>();
+ name->init(/*base = */ 0, IR::ObjectType,
+ function->newString(id),
+ Name::ModuleObject, line, column);
+ name->meta = meta;
+ name->storage = storage;
+ return name;
+}
Expr *BasicBlock::UNOP(AluOp op, Expr *expr)
{
@@ -675,6 +686,8 @@ static const char *symbolname(Name::Symbol s)
return "IdObject";
case Name::AttachType:
return "AttachType";
+ case Name::ModuleObject:
+ return "ModuleObject";
case Name::Object:
return "Object";
case Name::Property:
diff --git a/src/qml/qml/v4/qv4ir_p.h b/src/qml/qml/v4/qv4ir_p.h
index 79f50cd6c9..4e9f9faacd 100644
--- a/src/qml/qml/v4/qv4ir_p.h
+++ b/src/qml/qml/v4/qv4ir_p.h
@@ -252,6 +252,7 @@ struct Name: Expr {
Unbound,
IdObject, // This is a load of a id object. Storage will always be IdStorage
AttachType, // This is a load of an attached object
+ ModuleObject, // This is a load of a module object
Object, // XXX what is this for?
Property, // This is a load of a regular property
Slot // XXX what is this for?
@@ -538,6 +539,7 @@ struct BasicBlock {
Name *SYMBOL(Name *base, Type type, const QString &id, const QMetaObject *meta, QQmlPropertyData *property, Name::Storage storage, quint32 line, quint32 column);
Name *ID_OBJECT(const QString &id, const QQmlScript::Object *object, quint32 line, quint32 column);
Name *ATTACH_TYPE(const QString &id, const QQmlType *attachType, Name::Storage storage, quint32 line, quint32 column);
+ Name *MODULE_OBJECT(const QString &id, const QMetaObject *meta, Name::Storage storage, quint32 line, quint32 column);
Expr *UNOP(AluOp op, Expr *expr);
Expr *BINOP(AluOp op, Expr *left, Expr *right);
diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp
index 06f4024423..481b23eb4a 100644
--- a/src/qml/qml/v4/qv4irbuilder.cpp
+++ b/src/qml/qml/v4/qv4irbuilder.cpp
@@ -428,6 +428,17 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast)
if (r.isValid()) {
if (r.type) {
_expr.code = _block->ATTACH_TYPE(name, r.type, IR::Name::ScopeStorage, line, column);
+ } else if (r.importNamespace) {
+ QQmlMetaType::ModuleApiInstance *moduleApi = m_expression->importCache->moduleApi(r.importNamespace);
+ if (moduleApi) {
+ if (moduleApi->qobjectCallback) {
+ moduleApi->qobjectApi = moduleApi->qobjectCallback(QQmlEnginePrivate::get(m_engine), QQmlEnginePrivate::get(m_engine));
+ moduleApi->qobjectCallback = 0;
+ moduleApi->scriptCallback = 0;
+ }
+ if (moduleApi->qobjectApi)
+ _expr.code = _block->MODULE_OBJECT(name, moduleApi->qobjectApi->metaObject(), IR::Name::MemberStorage, line, column);
+ }
}
// We don't support anything else
} else {
@@ -603,6 +614,46 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast)
}
break;
+ case IR::Name::ModuleObject: {
+ if (name.at(0).isUpper()) {
+ QByteArray utf8Name = name.toUtf8();
+ const char *enumName = utf8Name.constData();
+
+ const QMetaObject *meta = baseName->meta;
+ bool found = false;
+ for (int ii = 0; !found && ii < meta->enumeratorCount(); ++ii) {
+ QMetaEnum e = meta->enumerator(ii);
+ for (int jj = 0; !found && jj < e.keyCount(); ++jj) {
+ if (0 == strcmp(e.key(jj), enumName)) {
+ found = true;
+ _expr.code = _block->CONST(IR::IntType, e.value(jj));
+ }
+ }
+ }
+ if (!found && qmlVerboseCompiler())
+ qWarning() << "*** unresolved enum:"
+ << (*baseName->id + QLatin1String(".") + ast->name.toString());
+ } else {
+ QQmlPropertyCache *cache = m_engine->cache(baseName->meta);
+ if (!cache) return false;
+ QQmlPropertyData *data = cache->property(name);
+
+ if (!data || data->isFunction())
+ return false; // Don't support methods (or non-existing properties ;)
+
+ if (!data->isFinal()) {
+ if (qmlVerboseCompiler())
+ qWarning() << "*** non-final attached property:"
+ << (*baseName->id + QLatin1String(".") + ast->name.toString());
+ return false; // We don't know enough about this property
+ }
+
+ IR::Type irType = irTypeFromVariantType(data->propType, m_engine, baseName->meta);
+ _expr.code = _block->SYMBOL(baseName, irType, name, baseName->meta, data, line, column);
+ }
+ }
+ break;
+
case IR::Name::IdObject: {
const QQmlScript::Object *idObject = baseName->idObject;
QQmlPropertyCache *cache =
@@ -830,13 +881,15 @@ void QV4IRBuilder::binop(AST::BinaryExpression *ast, ExprResult left, ExprResult
implicitCvt(left, t);
implicitCvt(right, t);
}
+ } else if ((left.type() != IR::ObjectType && left.type() != IR::NullType) ||
+ (right.type() != IR::ObjectType && right.type() != IR::NullType))
+ return;
- if (_expr.hint == ExprResult::cx) {
- _expr.format = ExprResult::cx;
- _block->CJUMP(_block->BINOP(IR::binaryOperator(ast->op), left, right), _expr.iftrue, _expr.iffalse);
- } else {
- _expr.code = _block->BINOP(IR::binaryOperator(ast->op), left, right);
- }
+ if (_expr.hint == ExprResult::cx) {
+ _expr.format = ExprResult::cx;
+ _block->CJUMP(_block->BINOP(IR::binaryOperator(ast->op), left, right), _expr.iftrue, _expr.iffalse);
+ } else {
+ _expr.code = _block->BINOP(IR::binaryOperator(ast->op), left, right);
}
}
@@ -860,12 +913,15 @@ bool QV4IRBuilder::visit(AST::BinaryExpression *ast)
IR::BasicBlock *iffalse = _function->newBasicBlock();
IR::BasicBlock *endif = _function->newBasicBlock();
- condition(ast->left, iftrue, iffalse);
+ ExprResult left = expression(ast->left);
+ IR::Temp *cond = _block->TEMP(IR::BoolType);
+ _block->MOVE(cond, left);
+ _block->CJUMP(cond, iftrue, iffalse);
IR::Temp *r = _block->TEMP(IR::InvalidType);
_block = iffalse;
- _block->MOVE(r, _block->CONST(IR::BoolType, 0)); // ### use the right null value
+ _block->MOVE(r, cond);
_block->JUMP(endif);
_block = iftrue;
@@ -873,9 +929,12 @@ bool QV4IRBuilder::visit(AST::BinaryExpression *ast)
_block->MOVE(r, right);
_block->JUMP(endif);
+ if (left.type() != right.type())
+ discard();
+
_block = endif;
- r->type = right.type(); // ### not exactly, it can be IR::BoolType.
+ r->type = right.type();
_expr.code = r;
}
} break;
@@ -942,9 +1001,6 @@ bool QV4IRBuilder::visit(AST::BinaryExpression *ast)
implicitCvt(left, IR::RealType);
implicitCvt(right, IR::RealType);
binop(ast, left, right);
- } else if (left.type() == IR::BoolType || right.type() == IR::BoolType) {
- implicitCvt(left, IR::BoolType);
- implicitCvt(right, IR::BoolType);
} else if (left.isValid() && right.isValid()) {
binop(ast, left, right);
}
@@ -956,16 +1012,21 @@ bool QV4IRBuilder::visit(AST::BinaryExpression *ast)
ExprResult right = expression(ast->right);
if (left.type() == right.type()) {
binop(ast, left, right);
- } else if (left.type() >= IR::BoolType && right.type() >= IR::BoolType) {
+ } else if (left.type() > IR::BoolType && right.type() > IR::BoolType) {
// left and right have numeric type (int or real)
binop(ast, left, right);
+ } else if ((left.type() == IR::ObjectType && right.type() == IR::NullType) ||
+ (right.type() == IR::ObjectType && left.type() == IR::NullType)) {
+ // comparing a qobject with null
+ binop(ast, left, right);
} else if (left.isValid() && right.isValid()) {
+ // left and right have different types
const bool isEq = ast->op == QSOperator::StrictEqual;
if (_expr.hint == ExprResult::cx) {
_expr.format = ExprResult::cx;
- _block->JUMP(isEq ? _expr.iftrue : _expr.iffalse);
+ _block->JUMP(isEq ? _expr.iffalse : _expr.iftrue);
} else {
- _expr.code = _block->CONST(IR::BoolType, isEq ? 1 : 0);
+ _expr.code = _block->CONST(IR::BoolType, isEq ? 0 : 1);
}
}
} break;
diff --git a/src/qml/qml/v4/qv4program_p.h b/src/qml/qml/v4/qv4program_p.h
index d23cc6192f..60e7403786 100644
--- a/src/qml/qml/v4/qv4program_p.h
+++ b/src/qml/qml/v4/qv4program_p.h
@@ -85,6 +85,7 @@ struct QV4Program {
enum QQmlRegisterType {
UndefinedType,
+ NullType,
QObjectStarType,
QRealType,
IntType,
diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp
index 3121d1b361..92c968f9aa 100644
--- a/src/qml/qml/v8/qjsengine.cpp
+++ b/src/qml/qml/v8/qjsengine.cpp
@@ -92,7 +92,7 @@ Q_DECLARE_METATYPE(QList<int>)
\section1 Engine Configuration
- The globalObject() function returns the \bold {Global Object}
+ The globalObject() function returns the \b {Global Object}
associated with the script engine. Properties of the Global Object
are accessible from any script code (i.e. they are global
variables). Typically, before evaluating "user" scripts, you will
diff --git a/src/qml/qml/v8/qjsvalue.cpp b/src/qml/qml/v8/qjsvalue.cpp
index e0a925c3bb..4471e68a61 100644
--- a/src/qml/qml/v8/qjsvalue.cpp
+++ b/src/qml/qml/v8/qjsvalue.cpp
@@ -426,18 +426,18 @@ quint32 QJSValue::toUInt() const
The conversion is performed according to the following table:
\table
- \header \o Input Type \o Result
- \row \o Undefined \o An invalid QVariant.
- \row \o Null \o An invalid QVariant.
- \row \o Boolean \o A QVariant containing the value of the boolean.
- \row \o Number \o A QVariant containing the value of the number.
- \row \o String \o A QVariant containing the value of the string.
- \row \o QVariant Object \o The result is the QVariant value of the object (no conversion).
- \row \o QObject Object \o A QVariant containing a pointer to the QObject.
- \row \o Date Object \o A QVariant containing the date value (toDateTime()).
- \row \o RegExp Object \o A QVariant containing the regular expression value.
- \row \o Array Object \o The array is converted to a QVariantList. Each element is converted to a QVariant, recursively; cyclic references are not followed.
- \row \o Object \o The object is converted to a QVariantMap. Each property is converted to a QVariant, recursively; cyclic references are not followed.
+ \header \li Input Type \li Result
+ \row \li Undefined \li An invalid QVariant.
+ \row \li Null \li An invalid QVariant.
+ \row \li Boolean \li A QVariant containing the value of the boolean.
+ \row \li Number \li A QVariant containing the value of the number.
+ \row \li String \li A QVariant containing the value of the string.
+ \row \li QVariant Object \li The result is the QVariant value of the object (no conversion).
+ \row \li QObject Object \li A QVariant containing a pointer to the QObject.
+ \row \li Date Object \li A QVariant containing the date value (toDateTime()).
+ \row \li RegExp Object \li A QVariant containing the regular expression value.
+ \row \li Array Object \li The array is converted to a QVariantList. Each element is converted to a QVariant, recursively; cyclic references are not followed.
+ \row \li Object \li The object is converted to a QVariantMap. Each property is converted to a QVariant, recursively; cyclic references are not followed.
\endtable
\sa isVariant()
@@ -634,13 +634,13 @@ bool QJSValue::equals(const QJSValue& other) const
the result depends on the type, as shown in the following table:
\table
- \header \o Type \o Result
- \row \o Undefined \o true
- \row \o Null \o true
- \row \o Boolean \o true if both values are true, false otherwise
- \row \o Number \o false if either value is NaN (Not-a-Number); true if values are equal, false otherwise
- \row \o String \o true if both values are exactly the same sequence of characters, false otherwise
- \row \o Object \o true if both values refer to the same object, false otherwise
+ \header \li Type \li Result
+ \row \li Undefined \li true
+ \row \li Null \li true
+ \row \li Boolean \li true if both values are true, false otherwise
+ \row \li Number \li false if either value is NaN (Not-a-Number); true if values are equal, false otherwise
+ \row \li String \li true if both values are exactly the same sequence of characters, false otherwise
+ \row \li Object \li true if both values refer to the same object, false otherwise
\endtable
\sa equals()
@@ -737,11 +737,11 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
delete operator. In particular:
\list
- \o Non-configurable properties cannot be deleted.
- \o This function will return true even if this object doesn't
+ \li Non-configurable properties cannot be deleted.
+ \li This function will return true even if this object doesn't
have a property of the given \a name (i.e., non-existent
properties are "trivially deletable").
- \o If this object doesn't have an own property of the given
+ \li If this object doesn't have an own property of the given
\a name, but an object in the prototype() chain does, the
prototype object's property is not deleted, and this function
returns true.
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 143ccee960..68c62ef240 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -797,54 +797,54 @@ If \a format is not provided, \a dateTime is formatted using
\a format should be either:
\list
-\o One of the Qt::DateFormat enumeration values, such as
+\li One of the Qt::DateFormat enumeration values, such as
\c Qt.DefaultLocaleShortDate or \c Qt.ISODate
-\o A string that specifies the format of the returned string, as detailed below.
+\li A string that specifies the format of the returned string, as detailed below.
\endlist
If \a format specifies a format string, it should use the following expressions
to specify the date:
\table
- \header \i Expression \i Output
- \row \i d \i the day as number without a leading zero (1 to 31)
- \row \i dd \i the day as number with a leading zero (01 to 31)
- \row \i ddd
- \i the abbreviated localized day name (e.g. 'Mon' to 'Sun').
+ \header \li Expression \li Output
+ \row \li d \li the day as number without a leading zero (1 to 31)
+ \row \li dd \li the day as number with a leading zero (01 to 31)
+ \row \li ddd
+ \li the abbreviated localized day name (e.g. 'Mon' to 'Sun').
Uses QDate::shortDayName().
- \row \i dddd
- \i the long localized day name (e.g. 'Monday' to 'Qt::Sunday').
+ \row \li dddd
+ \li the long localized day name (e.g. 'Monday' to 'Qt::Sunday').
Uses QDate::longDayName().
- \row \i M \i the month as number without a leading zero (1-12)
- \row \i MM \i the month as number with a leading zero (01-12)
- \row \i MMM
- \i the abbreviated localized month name (e.g. 'Jan' to 'Dec').
+ \row \li M \li the month as number without a leading zero (1-12)
+ \row \li MM \li the month as number with a leading zero (01-12)
+ \row \li MMM
+ \li the abbreviated localized month name (e.g. 'Jan' to 'Dec').
Uses QDate::shortMonthName().
- \row \i MMMM
- \i the long localized month name (e.g. 'January' to 'December').
+ \row \li MMMM
+ \li the long localized month name (e.g. 'January' to 'December').
Uses QDate::longMonthName().
- \row \i yy \i the year as two digit number (00-99)
- \row \i yyyy \i the year as four digit number
+ \row \li yy \li the year as two digit number (00-99)
+ \row \li yyyy \li the year as four digit number
\endtable
In addition the following expressions can be used to specify the time:
\table
- \header \i Expression \i Output
- \row \i h
- \i the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
- \row \i hh
- \i the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
- \row \i m \i the minute without a leading zero (0 to 59)
- \row \i mm \i the minute with a leading zero (00 to 59)
- \row \i s \i the second without a leading zero (0 to 59)
- \row \i ss \i the second with a leading zero (00 to 59)
- \row \i z \i the milliseconds without leading zeroes (0 to 999)
- \row \i zzz \i the milliseconds with leading zeroes (000 to 999)
- \row \i AP
- \i use AM/PM display. \e AP will be replaced by either "AM" or "PM".
- \row \i ap
- \i use am/pm display. \e ap will be replaced by either "am" or "pm".
+ \header \li Expression \li Output
+ \row \li h
+ \li the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
+ \row \li hh
+ \li the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
+ \row \li m \li the minute without a leading zero (0 to 59)
+ \row \li mm \li the minute with a leading zero (00 to 59)
+ \row \li s \li the second without a leading zero (0 to 59)
+ \row \li ss \li the second with a leading zero (00 to 59)
+ \row \li z \li the milliseconds without leading zeroes (0 to 999)
+ \row \li zzz \li the milliseconds with leading zeroes (000 to 999)
+ \row \li AP
+ \li use AM/PM display. \e AP will be replaced by either "AM" or "PM".
+ \row \li ap
+ \li use am/pm display. \e ap will be replaced by either "am" or "pm".
\endtable
All other input characters will be ignored. Any sequence of characters that
@@ -864,11 +864,11 @@ This \a dateTime value could be passed to \c Qt.formatDateTime(),
with the \a format values below to produce the following results:
\table
- \header \i Format \i Result
- \row \i "dd.MM.yyyy" \i 21.05.2001
- \row \i "ddd MMMM d yy" \i Tue May 21 01
- \row \i "hh:mm:ss.zzz" \i 14:13:09.042
- \row \i "h:m:s ap" \i 2:13:9 pm
+ \header \li Format \li Result
+ \row \li "dd.MM.yyyy" \li 21.05.2001
+ \row \li "ddd MMMM d yy" \li Tue May 21 01
+ \row \li "hh:mm:ss.zzz" \li 14:13:09.042
+ \row \li "h:m:s ap" \li 2:13:9 pm
\endtable
\sa Locale
@@ -1120,7 +1120,7 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args)
}
/*!
-\qmlmethod object Qt::createComponent(url)
+\qmlmethod object Qt::createComponent(url, mode)
Returns a \l Component object created using the QML file at the specified \a url,
or \c null if an empty string was given.
@@ -1129,6 +1129,12 @@ The returned component's \l Component::status property indicates whether the
component was successfully created. If the status is \c Component.Error,
see \l Component::errorString() for an error description.
+If the optional \a mode parameter is set to \c Component.Asynchronous, the
+component will be loaded in a background thread. The Component::status property
+will be \c Component.Loading while it is loading. The status will change to
+\c Component.Ready if the component loads successfully, or \c Component.Error
+if loading fails.
+
Call \l {Component::createObject()}{Component.createObject()} on the returned
component to create an object instance of the component.
@@ -1143,8 +1149,9 @@ use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}.
*/
v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
{
- if (args.Length() != 1)
- V8THROW_ERROR("Qt.createComponent(): Invalid arguments");
+ const char *invalidArgs = "Qt.createComponent(): Invalid arguments";
+ if (args.Length() < 1 || args.Length() > 2)
+ V8THROW_ERROR(invalidArgs);
QV8Engine *v8engine = V8ENGINE();
QQmlEngine *engine = v8engine->engine();
@@ -1159,8 +1166,20 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
if (arg.isEmpty())
return v8::Null();
+ QQmlComponent::CompilationMode compileMode = QQmlComponent::PreferSynchronous;
+ if (args.Length() == 2) {
+ if (args[1]->IsInt32()) {
+ int mode = args[1]->Int32Value();
+ if (mode != int(QQmlComponent::PreferSynchronous) && mode != int(QQmlComponent::Asynchronous))
+ V8THROW_ERROR(invalidArgs);
+ compileMode = QQmlComponent::CompilationMode(mode);
+ } else {
+ V8THROW_ERROR(invalidArgs);
+ }
+ }
+
QUrl url = context->resolvedUrl(QUrl(arg));
- QQmlComponent *c = new QQmlComponent(engine, url, engine);
+ QQmlComponent *c = new QQmlComponent(engine, url, compileMode, engine);
QQmlComponentPrivate::get(c)->creationContext = effectiveContext;
QQmlData::get(c, true)->setImplicitDestructible();
return v8engine->newQObject(c);
@@ -1287,9 +1306,9 @@ v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args)
or "C", where:
\list
- \o language is a lowercase, two-letter, ISO 639 language code,
- \o territory is an uppercase, two-letter, ISO 3166 country code,
- \o and codeset and modifier are ignored.
+ \li language is a lowercase, two-letter, ISO 639 language code,
+ \li territory is an uppercase, two-letter, ISO 3166 country code,
+ \li and codeset and modifier are ignored.
\endlist
If the string violates the locale format, or language is not a
diff --git a/src/qml/qml/v8/qv8bindings.cpp b/src/qml/qml/v8/qv8bindings.cpp
index 76fbea137e..4b96679cf3 100644
--- a/src/qml/qml/v8/qv8bindings.cpp
+++ b/src/qml/qml/v8/qv8bindings.cpp
@@ -45,7 +45,6 @@
#include <private/qqmlbinding_p.h>
#include <private/qqmlcompiler_p.h>
#include <private/qqmlproperty_p.h>
-#include <private/qqmlbinding_p_p.h>
#include <private/qqmlexpression_p.h>
#include <private/qobject_p.h>
#include <private/qqmltrace_p.h>
@@ -157,9 +156,8 @@ void QV8Bindings::Binding::update(QQmlPropertyPrivate::WriteFlags flags)
ep->dereferenceScarceResources();
} else {
- QQmlProperty p = QQmlPropertyPrivate::restore(target, instruction->property,
- context);
- QQmlBindingPrivate::printBindingLoopError(p);
+ QQmlProperty p = QQmlPropertyPrivate::restore(target, instruction->property, context);
+ QQmlAbstractBinding::printBindingLoopError(p);
}
}
diff --git a/src/qml/qml/v8/qv8contextwrapper.cpp b/src/qml/qml/v8/qv8contextwrapper.cpp
index 246b716aa0..39392b8984 100644
--- a/src/qml/qml/v8/qv8contextwrapper.cpp
+++ b/src/qml/qml/v8/qv8contextwrapper.cpp
@@ -238,16 +238,11 @@ QQmlContextData *QV8ContextWrapper::context(v8::Handle<v8::Value> value)
return r?r->getContext():0;
}
-v8::Handle<v8::Value> QV8ContextWrapper::NullGetter(v8::Local<v8::String> property,
- const v8::AccessorInfo &info)
+v8::Handle<v8::Value> QV8ContextWrapper::NullGetter(v8::Local<v8::String>,
+ const v8::AccessorInfo &)
{
- QV8ContextResource *resource = v8_resource_check<QV8ContextResource>(info.This());
-
- QV8Engine *engine = resource->engine;
-
- QString error = QLatin1String("Can't find variable: ") + engine->toString(property);
- v8::ThrowException(v8::Exception::ReferenceError(engine->toString(error)));
- return v8::Undefined();
+ // V8 will throw a ReferenceError if appropriate ("typeof" should not throw)
+ return v8::Handle<v8::Value>();
}
v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property,
@@ -365,9 +360,8 @@ v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property,
expressionContext->unresolvedNames = true;
- QString error = QLatin1String("Can't find variable: ") + engine->toString(property);
- v8::ThrowException(v8::Exception::ReferenceError(engine->toString(error)));
- return v8::Undefined();
+ // V8 will throw a ReferenceError if appropriate ("typeof" should not throw)
+ return v8::Handle<v8::Value>();
}
v8::Handle<v8::Value> QV8ContextWrapper::NullSetter(v8::Local<v8::String> property,
diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp
index 61cfa242c9..2350b9dc2c 100644
--- a/src/qml/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp
@@ -599,11 +599,10 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QQmlPropert
v8::StackTrace::kScriptName));
v8::Local<v8::StackFrame> frame = trace->GetFrame(0);
int lineNumber = frame->GetLineNumber();
- int columNumber = frame->GetColumn();
+ int columnNumber = frame->GetColumn();
QString url = engine->toString(frame->GetScriptName());
- newBinding = new QQmlBinding(&function, object, context);
- newBinding->setSourceLocation(url, lineNumber, columNumber);
+ newBinding = new QQmlBinding(&function, object, context, url, lineNumber, columnNumber);
newBinding->setTarget(object, *property, context);
newBinding->setEvaluateFlags(newBinding->evaluateFlags() |
QQmlBinding::RequiresThisObject);
@@ -619,11 +618,10 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QQmlPropert
v8::StackTrace::kScriptName));
v8::Local<v8::StackFrame> frame = trace->GetFrame(0);
int lineNumber = frame->GetLineNumber();
- int columNumber = frame->GetColumn();
+ int columnNumber = frame->GetColumn();
QString url = engine->toString(frame->GetScriptName());
- newBinding = new QQmlBinding(&function, object, context);
- newBinding->setSourceLocation(url, lineNumber, columNumber);
+ newBinding = new QQmlBinding(&function, object, context, url, lineNumber, columnNumber);
newBinding->setTarget(object, *property, context);
newBinding->setEvaluateFlags(newBinding->evaluateFlags() |
QQmlBinding::RequiresThisObject);
@@ -925,8 +923,10 @@ static void WeakQObjectReferenceCallback(v8::Persistent<v8::Value> handle, void
QQmlData *ddata = QQmlData::get(object, false);
if (ddata) {
ddata->v8object.Clear();
- if (!object->parent() && !ddata->indestructible)
+ if (!object->parent() && !ddata->indestructible) {
+ ddata->isQueuedForDeletion = true;
object->deleteLater();
+ }
}
}
@@ -1084,13 +1084,16 @@ v8::Handle<v8::Value> QV8QObjectWrapper::newQObject(QObject *object)
return v8::Null();
if (QObjectPrivate::get(object)->wasDeleted)
- return v8::Undefined();
-
+ return v8::Null();
+
QQmlData *ddata = QQmlData::get(object, true);
if (!ddata)
return v8::Undefined();
+ if (ddata->isQueuedForDeletion)
+ return v8::Null();
+
if (ddata->v8objectid == m_id && !ddata->v8object.IsEmpty()) {
// We own the v8object
return v8::Local<v8::Object>::New(ddata->v8object);
diff --git a/src/qml/qml/v8/qv8valuetypewrapper.cpp b/src/qml/qml/v8/qv8valuetypewrapper.cpp
index d54f04a9b0..cf2c13fce9 100644
--- a/src/qml/qml/v8/qv8valuetypewrapper.cpp
+++ b/src/qml/qml/v8/qv8valuetypewrapper.cpp
@@ -352,8 +352,8 @@ v8::Handle<v8::Value> QV8ValueTypeWrapper::Setter(v8::Local<v8::String> property
int columnNumber = frame->GetColumn();
QString url = r->engine->toString(frame->GetScriptName());
- newBinding = new QQmlBinding(&function, reference->object, context);
- newBinding->setSourceLocation(url, lineNumber, columnNumber);
+ newBinding = new QQmlBinding(&function, reference->object, context,
+ url, lineNumber, columnNumber);
newBinding->setTarget(reference->object, cacheData, context);
newBinding->setEvaluateFlags(newBinding->evaluateFlags() |
QQmlBinding::RequiresThisObject);
diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp
index 5010af17c8..1571d2dfc9 100644
--- a/src/qml/util/qqmlpropertymap.cpp
+++ b/src/qml/util/qqmlpropertymap.cpp
@@ -146,7 +146,7 @@ int QQmlPropertyMapMetaObject::createProperty(const char *name, const char *valu
key will be updated as well.
To detect value changes made in the UI layer you can connect to the valueChanged() signal.
- However, note that valueChanged() is \bold NOT emitted when changes are made by calling insert()
+ However, note that valueChanged() is \b NOT emitted when changes are made by calling insert()
or clear() - it is only emitted when a value is updated from QML.
\note It is not possible to remove keys from the map; once a key has been added, you can only
@@ -302,7 +302,7 @@ QVariant QQmlPropertyMap::operator[](const QString &key) const
This signal is emitted whenever one of the values in the map is changed. \a key
is the key corresponding to the \a value that was changed.
- \note valueChanged() is \bold NOT emitted when changes are made by calling insert()
+ \note valueChanged() is \b NOT emitted when changes are made by calling insert()
or clear() - it is only emitted when a value is updated from QML.
*/
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 2e32a60b2d..1c69cee456 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -203,8 +203,11 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
}
// Determine where to look for the test data.
- if (testPath.isEmpty() && sourceDir)
- testPath = QString::fromLocal8Bit(sourceDir);
+ if (testPath.isEmpty() && sourceDir) {
+ const QString s = QString::fromLocal8Bit(sourceDir);
+ if (QFile::exists(s))
+ testPath = s;
+ }
if (testPath.isEmpty()) {
QDir current = QDir::current();
#ifdef Q_OS_WIN
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index f89ac186eb..4f849c771b 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -169,13 +169,13 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
Although the Canvas item is provides a HTML5 like API, HTML5 canvas
applications need to be modified to run in the Canvas item:
\list
- \o Replace all DOM API calls with QML property bindings or Canvas item methods.
- \o Replace all HTML event handlers with the \a MouseArea item.
- \o Change setInterval/setTimeout function calls with the \a Timer item or
+ \li Replace all DOM API calls with QML property bindings or Canvas item methods.
+ \li Replace all HTML event handlers with the \a MouseArea item.
+ \li Change setInterval/setTimeout function calls with the \a Timer item or
the use of requestAnimationFrame.
- \o Place painting code into the \a QtQuick2::Canvas::onPaint handler and trigger
+ \li Place painting code into the \a QtQuick2::Canvas::onPaint handler and trigger
painting by calling the \c markDirty or \c requestPaint methods.
- \o To draw images, load them by calling the Canvas's loadImage method and then request to paint
+ \li To draw images, load them by calling the Canvas's loadImage method and then request to paint
them in the onImageLoaded handler.
\endlist
@@ -369,8 +369,8 @@ void QQuickCanvasItem::setCanvasWindow(const QRectF& rect)
Holds the current canvas render target.
\list
- \o Canvas.Image - render to an in memory image buffer.
- \o Canvas.FramebufferObject - render to an OpenGL frame buffer
+ \li Canvas.Image - render to an in memory image buffer.
+ \li Canvas.FramebufferObject - render to an OpenGL frame buffer
\endlist
This hint is supplied along with renderStrategy to the graphics context to
@@ -404,9 +404,9 @@ void QQuickCanvasItem::setRenderTarget(QQuickCanvasItem::RenderTarget target)
Holds the current canvas rendering strategy.
\list
- \o Canvas.Immediate - context will perform graphics commands immediately in the main UI thread.
- \o Canvas.Threaded - context will defer graphics commands to a private rendering thread.
- \o Canvas.Cooperative - context will defer graphics commands to the applications global render thread.
+ \li Canvas.Immediate - context will perform graphics commands immediately in the main UI thread.
+ \li Canvas.Threaded - context will defer graphics commands to a private rendering thread.
+ \li Canvas.Cooperative - context will defer graphics commands to the applications global render thread.
\endlist
This hint is supplied along with renderTarget to the graphics context to
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 05577e8c5c..f8e5e3c57f 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
{http://www.w3.org/TR/2dcontext}{W3C Canvas 2D Context API standard} with
some enhanced features.
- The Context2D API provides the rendering \bold{context} which defines the
+ The Context2D API provides the rendering \b{context} which defines the
methods and attributes needed to draw on the \c Canvas item. The following
assigns the canvas rendering context to a \c{context} variable:
\code
@@ -495,22 +495,22 @@ static v8::Handle<v8::Value> ctx2d_reset(const v8::Arguments &args)
Each state consists of the current transformation matrix, clipping region,
and values of the following attributes:
\list
- \o\a QtQuick2::Context2D::strokeStyle
- \o\a QtQuick2::Context2D::fillStyle
- \o\a QtQuick2::Context2D::fillRule
- \o\a QtQuick2::Context2D::globalAlpha
- \o\a QtQuick2::Context2D::lineWidth
- \o\a QtQuick2::Context2D::lineCap
- \o\a QtQuick2::Context2D::lineJoin
- \o\a QtQuick2::Context2D::miterLimit
- \o\a QtQuick2::Context2D::shadowOffsetX
- \o\a QtQuick2::Context2D::shadowOffsetY
- \o\a QtQuick2::Context2D::shadowBlur
- \o\a QtQuick2::Context2D::shadowColor
- \o\a QtQuick2::Context2D::globalCompositeOperation
- \o\a QtQuick2::Context2D::font
- \o\a QtQuick2::Context2D::textAlign
- \o\a QtQuick2::Context2D::textBaseline
+ \li\a QtQuick2::Context2D::strokeStyle
+ \li\a QtQuick2::Context2D::fillStyle
+ \li\a QtQuick2::Context2D::fillRule
+ \li\a QtQuick2::Context2D::globalAlpha
+ \li\a QtQuick2::Context2D::lineWidth
+ \li\a QtQuick2::Context2D::lineCap
+ \li\a QtQuick2::Context2D::lineJoin
+ \li\a QtQuick2::Context2D::miterLimit
+ \li\a QtQuick2::Context2D::shadowOffsetX
+ \li\a QtQuick2::Context2D::shadowOffsetY
+ \li\a QtQuick2::Context2D::shadowBlur
+ \li\a QtQuick2::Context2D::shadowColor
+ \li\a QtQuick2::Context2D::globalCompositeOperation
+ \li\a QtQuick2::Context2D::font
+ \li\a QtQuick2::Context2D::textAlign
+ \li\a QtQuick2::Context2D::textBaseline
\endlist
The current path is NOT part of the drawing state. The path can be reset by
@@ -606,19 +606,19 @@ static v8::Handle<v8::Value> ctx2d_scale(const v8::Arguments &args)
\image qml-item-canvas-math.png
where:
\list
- \o \c{a} is the scale factor in the horizontal (x) direction
+ \li \c{a} is the scale factor in the horizontal (x) direction
\image qml-item-canvas-scalex.png
- \o \c{c} is the skew factor in the x direction
+ \li \c{c} is the skew factor in the x direction
\image qml-item-canvas-canvas-skewx.png
- \o \c{e} is the translation in the x direction
+ \li \c{e} is the translation in the x direction
\image qml-item-canvas-canvas-translate.png
- \o \c{b} is the skew factor in the y (vertical) direction
+ \li \c{b} is the skew factor in the y (vertical) direction
\image qml-item-canvas-canvas-skewy.png
- \o \c{d} is the scale factor in the y direction
+ \li \c{d} is the scale factor in the y direction
\image qml-item-canvas-canvas-scaley.png
- \o \c{f} is the translation in the y direction
+ \li \c{f} is the translation in the y direction
\image qml-item-canvas-canvas-translatey.png
- \o the last row remains constant
+ \li the last row remains constant
\endlist
The scale factors and skew factors are multiples; \c{e} and \c{f} are
coordinate space units, just like the units in the \a QtQuick2::Context2D::translate(x,y)
@@ -799,22 +799,22 @@ static void ctx2d_globalAlpha_set(v8::Local<v8::String>, v8::Local<v8::Value> va
\qmlproperty string QtQuick2::Context2D::globalCompositeOperation
Holds the the current the current composition operation, from the list below:
\list
- \o source-atop - A atop B. Display the source image wherever both images are opaque.
+ \li source-atop - A atop B. Display the source image wherever both images are opaque.
Display the destination image wherever the destination image is opaque but the source image is transparent.
Display transparency elsewhere.
- \o source-in - A in B. Display the source image wherever both the source image and destination image are opaque.
+ \li source-in - A in B. Display the source image wherever both the source image and destination image are opaque.
Display transparency elsewhere.
- \o source-out - A out B. Display the source image wherever the source image is opaque and the destination image is transparent.
+ \li source-out - A out B. Display the source image wherever the source image is opaque and the destination image is transparent.
Display transparency elsewhere.
- \o source-over - (default) A over B. Display the source image wherever the source image is opaque.
+ \li source-over - (default) A over B. Display the source image wherever the source image is opaque.
Display the destination image elsewhere.
- \o destination-atop - B atop A. Same as source-atop but using the destination image instead of the source image and vice versa.
- \o destination-in - B in A. Same as source-in but using the destination image instead of the source image and vice versa.
- \o destination-out - B out A. Same as source-out but using the destination image instead of the source image and vice versa.
- \o destination-over - B over A. Same as source-over but using the destination image instead of the source image and vice versa.
- \o lighter - A plus B. Display the sum of the source image and destination image, with color values approaching 255 (100%) as a limit.
- \o copy - A (B is ignored). Display the source image instead of the destination image.
- \o xor - A xor B. Exclusive OR of the source image and destination image.
+ \li destination-atop - B atop A. Same as source-atop but using the destination image instead of the source image and vice versa.
+ \li destination-in - B in A. Same as source-in but using the destination image instead of the source image and vice versa.
+ \li destination-out - B out A. Same as source-out but using the destination image instead of the source image and vice versa.
+ \li destination-over - B over A. Same as source-over but using the destination image instead of the source image and vice versa.
+ \li lighter - A plus B. Display the sum of the source image and destination image, with color values approaching 255 (100%) as a limit.
+ \li copy - A (B is ignored). Display the source image instead of the destination image.
+ \li xor - A xor B. Exclusive OR of the source image and destination image.
\endlist
Additionally, this property also accepts the compositon modes listed in \a {QPainter::CompositionMode}. According to the W3C standard, these
@@ -858,12 +858,12 @@ static void ctx2d_globalCompositeOperation_set(v8::Local<v8::String>, v8::Local<
The style can be either a string containing a CSS color, a CanvasGradient or CanvasPattern object. Invalid values are ignored.
This property accepts several color syntaxes:
\list
- \o 'rgb(red, green, blue)' - for example: 'rgb(255, 100, 55)' or 'rgb(100%, 70%, 30%)'
- \o 'rgba(red, green, blue, alpha)' - for example: 'rgb(255, 100, 55, 1.0)' or 'rgb(100%, 70%, 30%, 0.5)'
- \o 'hsl(hue, saturation, lightness)'
- \o 'hsla(hue, saturation, lightness, alpha)'
- \o '#RRGGBB' - for example: '#00FFCC'
- \o Qt.rgba(red, green, blue, alpha) - for example: Qt.rgba(0.3, 0.7, 1, 1.0)
+ \li 'rgb(red, green, blue)' - for example: 'rgb(255, 100, 55)' or 'rgb(100%, 70%, 30%)'
+ \li 'rgba(red, green, blue, alpha)' - for example: 'rgb(255, 100, 55, 1.0)' or 'rgb(100%, 70%, 30%, 0.5)'
+ \li 'hsl(hue, saturation, lightness)'
+ \li 'hsla(hue, saturation, lightness, alpha)'
+ \li '#RRGGBB' - for example: '#00FFCC'
+ \li Qt.rgba(red, green, blue, alpha) - for example: Qt.rgba(0.3, 0.7, 1, 1.0)
\endlist
If the \a fillStyle or \a strokeStyle is assigned many times in a loop, the last Qt.rgba() syntax should be chosen, as it has the
best performance, because it's already a valid QColor value, does not need to be parsed everytime.
@@ -931,8 +931,8 @@ static void ctx2d_fillStyle_set(v8::Local<v8::String>, v8::Local<v8::Value> valu
\qmlproperty enumeration QtQuick2::Context2D::fillRule
Holds the current fill rule used for filling shapes. The following fill rules supported:
\list
- \o Qt.OddEvenFill
- \o Qt.WindingFill
+ \li Qt.OddEvenFill
+ \li Qt.WindingFill
\endlist
Note: Unlike the \a QPainterPath, the Canvas API uses the winding fill as the default fill rule.
The fillRule property is part of the context rendering state.
@@ -1183,20 +1183,20 @@ static v8::Handle<v8::Value> ctx2d_createConicalGradient(const v8::Arguments &ar
Returns a CanvasPattern object that uses the given \c color and \c patternMode.
The valid pattern modes are:
\list
- \o Qt.SolidPattern
- \o Qt.Dense1Pattern
- \o Qt.Dense2Pattern
- \o Qt.Dense3Pattern
- \o Qt.Dense4Pattern
- \o Qt.Dense5Pattern
- \o Qt.Dense6Pattern
- \o Qt.Dense7Pattern
- \o Qt.HorPattern
- \o Qt.VerPattern
- \o Qt.CrossPattern
- \o Qt.BDiagPattern
- \o Qt.FDiagPattern
- \o Qt.DiagCrossPattern
+ \li Qt.SolidPattern
+ \li Qt.Dense1Pattern
+ \li Qt.Dense2Pattern
+ \li Qt.Dense3Pattern
+ \li Qt.Dense4Pattern
+ \li Qt.Dense5Pattern
+ \li Qt.Dense6Pattern
+ \li Qt.Dense7Pattern
+ \li Qt.HorPattern
+ \li Qt.VerPattern
+ \li Qt.CrossPattern
+ \li Qt.BDiagPattern
+ \li Qt.FDiagPattern
+ \li Qt.DiagCrossPattern
\endlist
\sa Qt::BrushStyle
*/
@@ -1209,10 +1209,10 @@ static v8::Handle<v8::Value> ctx2d_createConicalGradient(const v8::Arguments &ar
The allowed values for \a repetition are:
\list
- \o "repeat" - both directions
- \o "repeat-x - horizontal only
- \o "repeat-y" - vertical only
- \o "no-repeat" - neither
+ \li "repeat" - both directions
+ \li "repeat-x - horizontal only
+ \li "repeat-y" - vertical only
+ \li "no-repeat" - neither
\endlist
If the repetition argument is empty or null, the value "repeat" is used.
@@ -1287,9 +1287,9 @@ static v8::Handle<v8::Value> ctx2d_createPattern(const v8::Arguments &args)
Holds the the current line cap style.
The possible line cap styles are:
\list
- \o butt - the end of each line has a flat edge perpendicular to the direction of the line, this is the default line cap value.
- \o round - a semi-circle with the diameter equal to the width of the line must then be added on to the end of the line.
- \o square - a rectangle with the length of the line width and the width of half the line width, placed flat against the edge perpendicular to the direction of the line.
+ \li butt - the end of each line has a flat edge perpendicular to the direction of the line, this is the default line cap value.
+ \li round - a semi-circle with the diameter equal to the width of the line must then be added on to the end of the line.
+ \li square - a rectangle with the length of the line width and the width of half the line width, placed flat against the edge perpendicular to the direction of the line.
\endlist
Other values are ignored.
*/
@@ -1345,9 +1345,9 @@ static void ctx2d_lineCap_set(v8::Local<v8::String>, v8::Local<v8::Value> value,
The possible line join styles are:
\list
- \o bevel - this is all that is rendered at joins.
- \o round - a filled arc connecting the two aforementioned corners of the join, abutting (and not overlapping) the aforementioned triangle, with the diameter equal to the line width and the origin at the point of the join, must be rendered at joins.
- \o miter - a second filled triangle must (if it can given the miter length) be rendered at the join, this is the default line join style.
+ \li bevel - this is all that is rendered at joins.
+ \li round - a filled arc connecting the two aforementioned corners of the join, abutting (and not overlapping) the aforementioned triangle, with the diameter equal to the line width and the origin at the point of the join, must be rendered at joins.
+ \li miter - a second filled triangle must (if it can given the miter length) be rendered at the join, this is the default line join style.
\endlist
Other values are ignored.
*/
@@ -1711,9 +1711,9 @@ static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args)
Adds an arc with the given control points and radius to the current subpath, connected to the previous point by a straight line.
To draw an arc, you begin with the same steps your followed to create a line:
\list
- \o Call the context.beginPath() method to set a new path.
- \o Call the context.moveTo(\c x, \c y) method to set your starting position on the canvas at the point (\c x,\c y).
- \o To draw an arc or circle, call the context.arcTo(\c x1, \c y1, \c x2, \c y2,\c radius) method.
+ \li Call the context.beginPath() method to set a new path.
+ \li Call the context.moveTo(\c x, \c y) method to set your starting position on the canvas at the point (\c x,\c y).
+ \li To draw an arc or circle, call the context.arcTo(\c x1, \c y1, \c x2, \c y2,\c radius) method.
This adds an arc with starting point (\c x1,\c y1), ending point (\c x2, \c y2), and radius \c radius to the current subpath and connects
it to the previous subpath by a straight line.
\endlist
@@ -1820,10 +1820,10 @@ static v8::Handle<v8::Value> ctx2d_bezierCurveTo(const v8::Arguments &args)
To create a complex shape using the \a clip() method:
\list 1
- \o Call the \c{context.beginPath()} method to set the clipping path.
- \o Define the clipping path by calling any combination of the \c{lineTo},
+ \li Call the \c{context.beginPath()} method to set the clipping path.
+ \li Define the clipping path by calling any combination of the \c{lineTo},
\c{arcTo}, \c{arc}, \c{moveTo}, etc and \c{closePath} methods.
- \o Call the \c{context.clip()} method.
+ \li Call the \c{context.clip()} method.
\endlist
The new shape displays. The following shows how a clipping path can
@@ -2168,11 +2168,11 @@ static void ctx2d_font_set(v8::Local<v8::String>, v8::Local<v8::Value> value, co
Holds the current text alignment settings.
The possible values are:
\list
- \o start
- \o end
- \o left
- \o right
- \o center
+ \li start
+ \li end
+ \li left
+ \li right
+ \li center
\endlist
Other values are ignored. The default value is "start".
*/
@@ -2231,12 +2231,12 @@ static void ctx2d_textAlign_set(v8::Local<v8::String>, v8::Local<v8::Value> valu
Holds the current baseline alignment settings.
The possible values are:
\list
- \o top
- \o hanging
- \o middle
- \o alphabetic
- \o ideographic
- \o bottom
+ \li top
+ \li hanging
+ \li middle
+ \li alphabetic
+ \li ideographic
+ \li bottom
\endlist
Other values are ignored. The default value is "alphabetic".
*/
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 1e07d96690..46f85417d2 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -113,22 +113,22 @@ QT_BEGIN_NAMESPACE
\table
\header
- \o \bold {Role}
- \o \bold {Expected property}
- \o
+ \li \b {Role}
+ \li \b {Expected property}
+ \li
\row
- \o Button
- \o function accessiblePressAction
- \o Called when the button receives a press action. The implementation should visually simulate a button click and perform the button action.
+ \li Button
+ \li function accessiblePressAction
+ \li Called when the button receives a press action. The implementation should visually simulate a button click and perform the button action.
\row
- \o CheckBox, Radiobutton
- \o checked
- \o The check state of the check box. Updated on Press, Check and Uncheck actions.
+ \li CheckBox, Radiobutton
+ \li checked
+ \li The check state of the check box. Updated on Press, Check and Uncheck actions.
\row
- \o Slider, SpinBox, Dial, ScrollBar
- \o value, minimumValue, maximumValue, stepSize
- \o value will be updated on increase and decrase actions, in accordance with the other properties
+ \li Slider, SpinBox, Dial, ScrollBar
+ \li value, minimumValue, maximumValue, stepSize
+ \li value will be updated on increase and decrase actions, in accordance with the other properties
\endtable
*/
@@ -144,7 +144,6 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
// Enable accessibility for items with accessible content. This also
// enables accessibility for the ancestors of souch items.
item->d_func()->setAccessibleFlagAndListener();
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectCreated, item, 0));
}
QQuickAccessibleAttached::~QQuickAccessibleAttached()
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 5eea44b6e4..129c3ef240 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -85,7 +85,6 @@ public:
if (name != m_name) {
m_name = name;
emit nameChanged();
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, parent(), 0));
}
}
@@ -95,7 +94,6 @@ public:
if (m_description != description) {
m_description = description;
emit descriptionChanged();
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DescriptionChanged, parent(), 0));
}
}
diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp
index eef20db361..6567892fb4 100644
--- a/src/quick/items/qquickanimatedimage.cpp
+++ b/src/quick/items/qquickanimatedimage.cpp
@@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE
about its state, such as the current frame and total number of frames.
The result is an animated image with a simple progress indicator underneath it.
- \bold Note: Unlike images, animated images are not cached or shared internally.
+ \b Note: Unlike images, animated images are not cached or shared internally.
\clearfloat
\snippet doc/src/snippets/qml/animatedimage.qml document
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index 5beb345afc..71514593a3 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -71,12 +71,12 @@ QT_BEGIN_NAMESPACE
create the displayed border image in the following way:
\list
- \i The corners (regions 1, 3, 7, and 9) are not scaled at all.
- \i Regions 2 and 8 are scaled according to
+ \li The corners (regions 1, 3, 7, and 9) are not scaled at all.
+ \li Regions 2 and 8 are scaled according to
\l{BorderImage::horizontalTileMode}{horizontalTileMode}.
- \i Regions 4 and 6 are scaled according to
+ \li Regions 4 and 6 are scaled according to
\l{BorderImage::verticalTileMode}{verticalTileMode}.
- \i The middle (region 5) is scaled according to both
+ \li The middle (region 5) is scaled according to both
\l{BorderImage::horizontalTileMode}{horizontalTileMode} and
\l{BorderImage::verticalTileMode}{verticalTileMode}.
\endlist
@@ -182,10 +182,10 @@ QQuickBorderImage::~QQuickBorderImage()
This property describes the status of image loading. It can be one of:
\list
- \o BorderImage.Null - no image has been set
- \o BorderImage.Ready - the image has been loaded
- \o BorderImage.Loading - the image is currently being loaded
- \o BorderImage.Error - an error occurred while loading the image
+ \li BorderImage.Null - no image has been set
+ \li BorderImage.Ready - the image has been loaded
+ \li BorderImage.Loading - the image is currently being loaded
+ \li BorderImage.Error - an error occurred while loading the image
\endlist
\sa progress
@@ -393,9 +393,9 @@ QQuickScaleGrid *QQuickBorderImage::border()
This property describes how to repeat or stretch the middle parts of the border image.
\list
- \o BorderImage.Stretch - Scales the image to fit to the available area.
- \o BorderImage.Repeat - Tile the image until there is no more space. May crop the last image.
- \o BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.
+ \li BorderImage.Stretch - Scales the image to fit to the available area.
+ \li BorderImage.Repeat - Tile the image until there is no more space. May crop the last image.
+ \li BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.
\endlist
The default tile mode for each property is BorderImage.Stretch.
diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp
index f14eccd9a9..cd3bbbfa2a 100644
--- a/src/quick/items/qquickcanvas.cpp
+++ b/src/quick/items/qquickcanvas.cpp
@@ -607,7 +607,6 @@ void QQuickCanvasPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
{
Q_Q(QQuickCanvas);
- Q_UNUSED(item);
Q_ASSERT(item);
Q_ASSERT(scope || item == rootItem);
@@ -618,7 +617,12 @@ void QQuickCanvasPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
qWarning() << " activeFocusItem:" << (QObject *)activeFocusItem;
#endif
- QQuickItemPrivate *scopePrivate = scope ? QQuickItemPrivate::get(scope) : 0;
+ QQuickItemPrivate *scopePrivate = 0;
+ if (scope) {
+ scopePrivate = QQuickItemPrivate::get(scope);
+ if ( !scopePrivate->subFocusItem )
+ return;//No focus, nothing to do.
+ }
QQuickItem *oldActiveFocusItem = 0;
QQuickItem *newActiveFocusItem = 0;
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index f8c1281af5..3316169741 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -410,10 +410,10 @@ void QQuickDragAttached::start(QQmlV8Function *args)
The returned drop action may be one of:
\list
- \o Qt.CopyAction Copy the data to the target
- \o Qt.MoveAction Move the data from the source to the target
- \o Qt.LinkAction Create a link from the source to the target.
- \o Qt.IgnoreAction Ignore the action (do nothing with the data).
+ \li Qt.CopyAction Copy the data to the target
+ \li Qt.MoveAction Move the data from the source to the target
+ \li Qt.LinkAction Create a link from the source to the target.
+ \li Qt.IgnoreAction Ignore the action (do nothing with the data).
\endlist
*/
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index ed5fb23658..51ba4c56ec 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -378,10 +378,10 @@ QStringList QQuickDropEvent::keys() const
The drop action may be one of:
\list
- \o Qt.CopyAction Copy the data to the target
- \o Qt.MoveAction Move the data from the source to the target
- \o Qt.LinkAction Create a link from the source to the target.
- \o Qt.IgnoreAction Ignore the action (do nothing with the data).
+ \li Qt.CopyAction Copy the data to the target
+ \li Qt.MoveAction Move the data from the source to the target
+ \li Qt.LinkAction Create a link from the source to the target.
+ \li Qt.IgnoreAction Ignore the action (do nothing with the data).
\endlist
*/
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 9222a7766d..bf58e4411d 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -117,12 +117,12 @@ Item {
It contains a bitwise combination of:
\list
- \o Qt.NoModifier - No modifier key is pressed.
- \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
- \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
- \o Qt.AltModifier - An Alt key on the keyboard is pressed.
- \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
- \o Qt.KeypadModifier - A keypad button is pressed.
+ \li Qt.NoModifier - No modifier key is pressed.
+ \li Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \li Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \li Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \li Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \li Qt.KeypadModifier - A keypad button is pressed.
\endlist
For example, to react to a Shift key + Enter key combination:
@@ -179,9 +179,9 @@ Item {
This property holds the button that caused the event. It can be one of:
\list
- \o Qt.LeftButton
- \o Qt.RightButton
- \o Qt.MiddleButton
+ \li Qt.LeftButton
+ \li Qt.RightButton
+ \li Qt.MiddleButton
\endlist
*/
@@ -202,9 +202,9 @@ Item {
It contains a bitwise combination of:
\list
- \o Qt.LeftButton
- \o Qt.RightButton
- \o Qt.MiddleButton
+ \li Qt.LeftButton
+ \li Qt.RightButton
+ \li Qt.MiddleButton
\endlist
*/
@@ -216,12 +216,12 @@ Item {
It contains a bitwise combination of:
\list
- \o Qt.NoModifier - No modifier key is pressed.
- \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
- \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
- \o Qt.AltModifier - An Alt key on the keyboard is pressed.
- \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
- \o Qt.KeypadModifier - A keypad button is pressed.
+ \li Qt.NoModifier - No modifier key is pressed.
+ \li Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \li Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \li Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \li Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \li Qt.KeypadModifier - A keypad button is pressed.
\endlist
For example, to react to a Shift key + Left mouse button click:
@@ -277,9 +277,9 @@ Item {
It contains a bitwise combination of:
\list
- \o Qt.LeftButton
- \o Qt.RightButton
- \o Qt.MiddleButton
+ \li Qt.LeftButton
+ \li Qt.RightButton
+ \li Qt.MiddleButton
\endlist
*/
@@ -317,12 +317,12 @@ Item {
It contains a bitwise combination of:
\list
- \o Qt.NoModifier - No modifier key is pressed.
- \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
- \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
- \o Qt.AltModifier - An Alt key on the keyboard is pressed.
- \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
- \o Qt.KeypadModifier - A keypad button is pressed.
+ \li Qt.NoModifier - No modifier key is pressed.
+ \li Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \li Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \li Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \li Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \li Qt.KeypadModifier - A keypad button is pressed.
\endlist
For example, to react to a Control key pressed during the wheel event:
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 82f674741f..b6d3ebd7f2 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
// The number of samples to discard when calculating the flick velocity.
// Touch panels often produce inaccurate results as the finger is lifted.
#ifndef QML_FLICK_DISCARDSAMPLES
-#define QML_FLICK_DISCARDSAMPLES 1
+#define QML_FLICK_DISCARDSAMPLES 0
#endif
// The default maximum velocity of a flick.
@@ -103,7 +103,7 @@ QT_BEGIN_NAMESPACE
// FlickThreshold determines how far the "mouse" must have moved
// before we perform a flick.
-static const int FlickThreshold = 20;
+static const int FlickThreshold = 15;
// RetainGrabVelocity is the maxmimum instantaneous velocity that
// will ensure the Flickable retains the grab on consecutive flicks.
@@ -771,13 +771,13 @@ QQuickFlickableVisibleArea *QQuickFlickable::visibleArea()
This property determines which directions the view can be flicked.
\list
- \o Flickable.AutoFlickDirection (default) - allows flicking vertically if the
+ \li Flickable.AutoFlickDirection (default) - allows flicking vertically if the
\e contentHeight is not equal to the \e height of the Flickable.
Allows flicking horizontally if the \e contentWidth is not equal
to the \e width of the Flickable.
- \o Flickable.HorizontalFlick - allows flicking horizontally.
- \o Flickable.VerticalFlick - allows flicking vertically.
- \o Flickable.HorizontalAndVerticalFlick - allows flicking in both directions.
+ \li Flickable.HorizontalFlick - allows flicking horizontally.
+ \li Flickable.VerticalFlick - allows flicking vertically.
+ \li Flickable.HorizontalAndVerticalFlick - allows flicking in both directions.
\endlist
*/
QQuickFlickable::FlickableDirection QQuickFlickable::flickableDirection() const
@@ -1030,7 +1030,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event)
vVelocity = (extended && extended->capabilities().testFlag(QTouchDevice::Velocity))
? extended->velocity().y() : vData.velocity;
}
- if (vData.atBeginning || vData.atEnd) {
+ if ((vData.atBeginning && vVelocity > 0.) || (vData.atEnd && vVelocity < 0.)) {
vVelocity /= 2;
} else if (vData.continuousFlickVelocity != 0.0
&& vData.viewSize/q->height() > QML_FLICK_MULTIFLICK_RATIO
@@ -1046,7 +1046,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event)
hVelocity = (extended && extended->capabilities().testFlag(QTouchDevice::Velocity))
? extended->velocity().x() : hData.velocity;
}
- if (hData.atBeginning || hData.atEnd) {
+ if ((hData.atBeginning && hVelocity > 0.) || (hData.atEnd && hVelocity < 0.)) {
hVelocity /= 2;
} else if (hData.continuousFlickVelocity != 0.0
&& hData.viewSize/q->width() > QML_FLICK_MULTIFLICK_RATIO
@@ -1449,11 +1449,11 @@ QQmlListProperty<QQuickItem> QQuickFlickable::flickableChildren()
The \c boundsBehavior can be one of:
\list
- \o Flickable.StopAtBounds - the contents can not be dragged beyond the boundary
+ \li Flickable.StopAtBounds - the contents can not be dragged beyond the boundary
of the flickable, and flicks will not overshoot.
- \o Flickable.DragOverBounds - the contents can be dragged beyond the boundary
+ \li Flickable.DragOverBounds - the contents can be dragged beyond the boundary
of the Flickable, but flicks will not overshoot.
- \o Flickable.DragAndOvershootBounds (default) - the contents can be dragged
+ \li Flickable.DragAndOvershootBounds (default) - the contents can be dragged
beyond the boundary of the Flickable, and can overshoot the
boundary when flicked.
\endlist
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 78899b27e5..1fab4a8c99 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -66,13 +66,22 @@ QT_BEGIN_NAMESPACE
class FxGridItemSG : public FxViewItem
{
public:
- FxGridItemSG(QQuickItem *i, QQuickGridView *v, bool own) : FxViewItem(i, own), view(v) {
+ FxGridItemSG(QQuickItem *i, QQuickGridView *v, bool own, bool trackGeometry) : FxViewItem(i, own, trackGeometry), view(v) {
attached = static_cast<QQuickGridViewAttached*>(qmlAttachedPropertiesObject<QQuickGridView>(item));
if (attached)
static_cast<QQuickGridViewAttached*>(attached)->setView(view);
+ if (trackGeometry) {
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ itemPrivate->addItemChangeListener(QQuickItemViewPrivate::get(view), QQuickItemPrivate::Geometry);
+ }
}
- ~FxGridItemSG() {}
+ ~FxGridItemSG() {
+ if (trackGeom) {
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ itemPrivate->removeItemChangeListener(QQuickItemViewPrivate::get(view), QQuickItemPrivate::Geometry);
+ }
+ }
qreal position() const {
return rowPos();
@@ -423,7 +432,7 @@ FxViewItem *QQuickGridViewPrivate::newViewItem(int modelIndex, QQuickItem *item)
{
Q_Q(QQuickGridView);
Q_UNUSED(modelIndex);
- return new FxGridItemSG(item, q, false);
+ return new FxGridItemSG(item, q, false, false);
}
void QQuickGridViewPrivate::initializeViewItem(FxViewItem *item)
@@ -685,7 +694,7 @@ void QQuickGridViewPrivate::createHighlight()
if (currentItem) {
QQuickItem *item = createHighlightItem();
if (item) {
- FxGridItemSG *newHighlight = new FxGridItemSG(item, q, true);
+ FxGridItemSG *newHighlight = new FxGridItemSG(item, q, true, true);
if (autoHighlight)
resetHighlightPosition();
highlightXAnimator = new QSmoothedAnimation;
@@ -760,11 +769,11 @@ void QQuickGridViewPrivate::updateFooter()
Q_Q(QQuickGridView);
bool created = false;
if (!footer) {
- QQuickItem *item = createComponentItem(footerComponent, true);
+ QQuickItem *item = createComponentItem(footerComponent);
if (!item)
return;
item->setZ(1);
- footer = new FxGridItemSG(item, q, true);
+ footer = new FxGridItemSG(item, q, true, true);
created = true;
}
@@ -799,11 +808,11 @@ void QQuickGridViewPrivate::updateHeader()
Q_Q(QQuickGridView);
bool created = false;
if (!header) {
- QQuickItem *item = createComponentItem(headerComponent, true);
+ QQuickItem *item = createComponentItem(headerComponent);
if (!item)
return;
item->setZ(1);
- header = new FxGridItemSG(item, q, true);
+ header = new FxGridItemSG(item, q, true, true);
created = true;
}
@@ -1344,13 +1353,13 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
Valid values for \c highlightRangeMode are:
\list
- \o GridView.ApplyRange - the view attempts to maintain the highlight within the range.
+ \li GridView.ApplyRange - the view attempts to maintain the highlight within the range.
However, the highlight can move outside of the range at the ends of the view or due
to mouse interaction.
- \o GridView.StrictlyEnforceRange - the highlight never moves outside of the range.
+ \li GridView.StrictlyEnforceRange - the highlight never moves outside of the range.
The current item changes if a keyboard or mouse action would cause the highlight to move
outside of the range.
- \o GridView.NoHighlightRange - this is the default value.
+ \li GridView.NoHighlightRange - this is the default value.
\endlist
*/
@@ -1362,13 +1371,13 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
Possible values:
\list
- \o Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is
+ \li Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is
dependent on the \l GridView::flow property.
- \o Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent
+ \li Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent
on the \l GridView::flow property.
\endlist
- \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if
+ \b Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if
GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply
indicates that the flow is horizontal.
*/
@@ -1437,8 +1446,8 @@ void QQuickGridView::setHighlightMoveDuration(int duration)
Possible values:
\list
- \o GridView.LeftToRight (default) - Items are laid out from left to right, and the view scrolls vertically
- \o GridView.TopToBottom - Items are laid out from top to bottom, and the view scrolls horizontally
+ \li GridView.LeftToRight (default) - Items are laid out from left to right, and the view scrolls vertically
+ \li GridView.TopToBottom - Items are laid out from top to bottom, and the view scrolls horizontally
\endlist
*/
QQuickGridView::Flow QQuickGridView::flow() const
@@ -1517,10 +1526,10 @@ void QQuickGridView::setCellHeight(qreal cellHeight)
The possible values are:
\list
- \o GridView.NoSnap (default) - the view stops anywhere within the visible area.
- \o GridView.SnapToRow - the view settles with a row (or column for \c GridView.TopToBottom flow)
+ \li GridView.NoSnap (default) - the view stops anywhere within the visible area.
+ \li GridView.SnapToRow - the view settles with a row (or column for \c GridView.TopToBottom flow)
aligned with the start of the view.
- \o GridView.SnapOneRow - the view will settle no more than one row (or column for \c GridView.TopToBottom flow)
+ \li GridView.SnapOneRow - the view will settle no more than one row (or column for \c GridView.TopToBottom flow)
away from the first visible row at the time the mouse button is released.
This mode is particularly useful for moving one page at a time.
\endlist
@@ -1590,9 +1599,9 @@ void QQuickGridView::setSnapMode(SnapMode mode)
It is applied to all items that are created when:
\list
- \o The view is first created
- \o The view's \l model changes
- \o The view's \l model is \l {QAbstractItemModel::reset}{reset}, if the model is a QAbstractItemModel subclass
+ \li The view is first created
+ \li The view's \l model changes
+ \li The view's \l model is \l {QAbstractItemModel::reset}{reset}, if the model is a QAbstractItemModel subclass
\endlist
For example, here is a view that specifies such a transition:
@@ -1971,7 +1980,7 @@ void QQuickGridView::geometryChanged(const QRectF &newGeometry, const QRectF &ol
The current index will wrap if keyNavigationWraps is true and it
is currently at the end. This method has no effect if the \l count is zero.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
@@ -2001,7 +2010,7 @@ void QQuickGridView::moveCurrentIndexUp()
The current index will wrap if keyNavigationWraps is true and it
is currently at the end. This method has no effect if the \l count is zero.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QQuickGridView::moveCurrentIndexDown()
{
@@ -2029,7 +2038,7 @@ void QQuickGridView::moveCurrentIndexDown()
The current index will wrap if keyNavigationWraps is true and it
is currently at the end. This method has no effect if the \l count is zero.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QQuickGridView::moveCurrentIndexLeft()
{
@@ -2072,7 +2081,7 @@ void QQuickGridView::moveCurrentIndexLeft()
The current index will wrap if keyNavigationWraps is true and it
is currently at the end. This method has no effect if the \l count is zero.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QQuickGridView::moveCurrentIndexRight()
{
@@ -2307,12 +2316,12 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
\a mode:
\list
- \o GridView.Beginning - position item at the top (or left for \c GridView.TopToBottom flow) of the view.
- \o GridView.Center - position item in the center of the view.
- \o GridView.End - position item at bottom (or right for horizontal orientation) of the view.
- \o GridView.Visible - if any part of the item is visible then take no action, otherwise
+ \li GridView.Beginning - position item at the top (or left for \c GridView.TopToBottom flow) of the view.
+ \li GridView.Center - position item in the center of the view.
+ \li GridView.End - position item at bottom (or right for horizontal orientation) of the view.
+ \li GridView.Visible - if any part of the item is visible then take no action, otherwise
bring the item into view.
- \o GridView.Contain - ensure the entire item is visible. If the item is larger than
+ \li GridView.Contain - ensure the entire item is visible. If the item is larger than
the view the item is positioned at the top (or left for \c GridView.TopToBottom flow) of the view.
\endlist
@@ -2324,7 +2333,7 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
of the view does not cause all other items to be repositioned.
The correct way to bring an item into view is with \c positionViewAtIndex.
- \bold Note: methods should only be called after the Component has completed. To position
+ \b Note: methods should only be called after the Component has completed. To position
the view at startup, this method should be called by Component.onCompleted. For
example, to position the view at the end:
@@ -2344,7 +2353,7 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
of the list does not cause all other items to be repositioned, and because
the actual start of the view can vary based on the size of the delegates.
- \bold Note: methods should only be called after the Component has completed. To position
+ \b Note: methods should only be called after the Component has completed. To position
the view at startup, this method should be called by Component.onCompleted. For
example, to position the view at the end on startup:
@@ -2363,7 +2372,7 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
If the item is outside the visible area, -1 is returned, regardless of
whether an item will exist at that point when scrolled into view.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
/*!
@@ -2376,7 +2385,7 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
If the item is outside the visible area, null is returned, regardless of
whether an item will exist at that point when scrolled into view.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
QQuickGridViewAttached *QQuickGridView::qmlAttachedProperties(QObject *obj)
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index a939365e98..2346689178 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -142,7 +142,7 @@ QQuickImagePrivate::QQuickImagePrivate()
Images are cached and shared internally, so if several Image elements have the same \l source,
only one copy of the image will be loaded.
- \bold Note: Images are often the greatest user of memory in QML user interfaces. It is recommended
+ \b Note: Images are often the greatest user of memory in QML user interfaces. It is recommended
that images which do not form part of the user interface have their
size bounded via the \l sourceSize property. This is especially important for content
that is loaded from external sources or provided by the user.
@@ -185,20 +185,20 @@ void QQuickImagePrivate::setImage(const QImage &image)
than the item.
\list
- \o Image.Stretch - the image is scaled to fit
- \o Image.PreserveAspectFit - the image is scaled uniformly to fit without cropping
- \o Image.PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary
- \o Image.Tile - the image is duplicated horizontally and vertically
- \o Image.TileVertically - the image is stretched horizontally and tiled vertically
- \o Image.TileHorizontally - the image is stretched vertically and tiled horizontally
- \o Image.Pad - the image is not transformed
+ \li Image.Stretch - the image is scaled to fit
+ \li Image.PreserveAspectFit - the image is scaled uniformly to fit without cropping
+ \li Image.PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary
+ \li Image.Tile - the image is duplicated horizontally and vertically
+ \li Image.TileVertically - the image is stretched horizontally and tiled vertically
+ \li Image.TileHorizontally - the image is stretched vertically and tiled horizontally
+ \li Image.Pad - the image is not transformed
\endlist
\table
\row
- \o \image declarative-qtlogo-stretch.png
- \o Stretch (default)
+ \li \image declarative-qtlogo-stretch.png
+ \li Stretch (default)
\qml
Image {
width: 130; height: 100
@@ -208,8 +208,8 @@ void QQuickImagePrivate::setImage(const QImage &image)
\endqml
\row
- \o \image declarative-qtlogo-preserveaspectfit.png
- \o PreserveAspectFit
+ \li \image declarative-qtlogo-preserveaspectfit.png
+ \li PreserveAspectFit
\qml
Image {
width: 130; height: 100
@@ -220,8 +220,8 @@ void QQuickImagePrivate::setImage(const QImage &image)
\endqml
\row
- \o \image declarative-qtlogo-preserveaspectcrop.png
- \o PreserveAspectCrop
+ \li \image declarative-qtlogo-preserveaspectcrop.png
+ \li PreserveAspectCrop
\qml
Image {
width: 130; height: 100
@@ -233,8 +233,8 @@ void QQuickImagePrivate::setImage(const QImage &image)
\endqml
\row
- \o \image declarative-qtlogo-tile.png
- \o Tile
+ \li \image declarative-qtlogo-tile.png
+ \li Tile
\qml
Image {
width: 120; height: 120
@@ -244,8 +244,8 @@ void QQuickImagePrivate::setImage(const QImage &image)
\endqml
\row
- \o \image declarative-qtlogo-tilevertically.png
- \o TileVertically
+ \li \image declarative-qtlogo-tilevertically.png
+ \li TileVertically
\qml
Image {
width: 120; height: 120
@@ -256,8 +256,8 @@ void QQuickImagePrivate::setImage(const QImage &image)
\endqml
\row
- \o \image declarative-qtlogo-tilehorizontally.png
- \o TileHorizontally
+ \li \image declarative-qtlogo-tilehorizontally.png
+ \li TileHorizontally
\qml
Image {
width: 120; height: 120
@@ -319,22 +319,22 @@ qreal QQuickImage::paintedHeight() const
This property holds the status of image loading. It can be one of:
\list
- \o Image.Null - no image has been set
- \o Image.Ready - the image has been loaded
- \o Image.Loading - the image is currently being loaded
- \o Image.Error - an error occurred while loading the image
+ \li Image.Null - no image has been set
+ \li Image.Ready - the image has been loaded
+ \li Image.Loading - the image is currently being loaded
+ \li Image.Error - an error occurred while loading the image
\endlist
Use this status to provide an update or respond to the status change in some way.
For example, you could:
\list
- \o Trigger a state change:
+ \li Trigger a state change:
\qml
State { name: 'loaded'; when: image.status == Image.Ready }
\endqml
- \o Implement an \c onStatusChanged signal handler:
+ \li Implement an \c onStatusChanged signal handler:
\qml
Image {
id: image
@@ -342,7 +342,7 @@ qreal QQuickImage::paintedHeight() const
}
\endqml
- \o Bind to the status value:
+ \li Bind to the status value:
\qml
Text { text: image.status == Image.Ready ? 'Loaded' : 'Not loaded' }
\endqml
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 8e351f1527..423fb0f40c 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -116,9 +116,9 @@ void QQuickItemPrivate::registerAccessorProperties()
The following concrete Transform types are available:
\list
- \o \l Rotation
- \o \l Scale
- \o \l Translate
+ \li \l Rotation
+ \li \l Scale
+ \li \l Translate
\endlist
The Transform elements let you create and control advanced transformations that can be configured
@@ -696,10 +696,10 @@ void QQuickKeyNavigationAttached::setBacktab(QQuickItem *i)
or after the attached item's own key handling.
\list
- \o KeyNavigation.BeforeItem - process the key events before normal
+ \li KeyNavigation.BeforeItem - process the key events before normal
item key processing. If the event is used for key navigation, it will be accepted and will not
be passed on to the item.
- \o KeyNavigation.AfterItem (default) - process the key events after normal item key
+ \li KeyNavigation.AfterItem (default) - process the key events after normal item key
handling. If the item accepts the key event it will not be
handled by the KeyNavigation attached property handler.
\endlist
@@ -933,21 +933,21 @@ bool QQuickKeysAttachedPrivate::isConnected(const char *signalName)
If \l priority is Keys.BeforeItem (default) the order of key event processing is:
\list 1
- \o Items specified in \c forwardTo
- \o specific key handlers, e.g. onReturnPressed
- \o onKeyPress, onKeyRelease handlers
- \o Item specific key handling, e.g. TextInput key handling
- \o parent item
+ \li Items specified in \c forwardTo
+ \li specific key handlers, e.g. onReturnPressed
+ \li onKeyPress, onKeyRelease handlers
+ \li Item specific key handling, e.g. TextInput key handling
+ \li parent item
\endlist
If priority is Keys.AfterItem the order of key event processing is:
\list 1
- \o Item specific key handling, e.g. TextInput key handling
- \o Items specified in \c forwardTo
- \o specific key handlers, e.g. onReturnPressed
- \o onKeyPress, onKeyRelease handlers
- \o parent item
+ \li Item specific key handling, e.g. TextInput key handling
+ \li Items specified in \c forwardTo
+ \li specific key handlers, e.g. onReturnPressed
+ \li onKeyPress, onKeyRelease handlers
+ \li parent item
\endlist
If the event is accepted during any of the above steps, key
@@ -970,10 +970,10 @@ bool QQuickKeysAttachedPrivate::isConnected(const char *signalName)
or after the attached item's own key handling.
\list
- \o Keys.BeforeItem (default) - process the key events before normal
+ \li Keys.BeforeItem (default) - process the key events before normal
item key processing. If the event is accepted it will not
be passed on to the item.
- \o Keys.AfterItem - process the key events after normal item key
+ \li Keys.AfterItem - process the key events after normal item key
handling. If the item accepts the key event it will not be
handled by the Keys attached property handler.
\endlist
@@ -2644,8 +2644,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
\table
\row
- \o \image declarative-item_stacking1.png
- \o Same \c z - later children above earlier children:
+ \li \image declarative-item_stacking1.png
+ \li Same \c z - later children above earlier children:
\qml
Item {
Rectangle {
@@ -2659,8 +2659,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
}
\endqml
\row
- \o \image declarative-item_stacking2.png
- \o Higher \c z on top:
+ \li \image declarative-item_stacking2.png
+ \li Higher \c z on top:
\qml
Item {
Rectangle {
@@ -2675,8 +2675,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
}
\endqml
\row
- \o \image declarative-item_stacking3.png
- \o Same \c z - children above parents:
+ \li \image declarative-item_stacking3.png
+ \li Same \c z - children above parents:
\qml
Item {
Rectangle {
@@ -2690,8 +2690,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
}
\endqml
\row
- \o \image declarative-item_stacking4.png
- \o Lower \c z below:
+ \li \image declarative-item_stacking4.png
+ \li Lower \c z below:
\qml
Item {
Rectangle {
@@ -2769,8 +2769,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
\table
\row
- \o \image declarative-anchors_example.png
- \o Text anchored to Image, horizontally centered and vertically below, with a margin.
+ \li \image declarative-anchors_example.png
+ \li Text anchored to Image, horizontally centered and vertically below, with a margin.
\qml
Item {
Image {
@@ -2787,8 +2787,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
}
\endqml
\row
- \o \image declarative-anchors_example2.png
- \o
+ \li \image declarative-anchors_example2.png
+ \li
Left of Text anchored to right of Image, with a margin. The y
property of both defaults to 0.
@@ -3018,7 +3018,6 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event)
void QQuickItem::focusInEvent(QFocusEvent *)
{
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, 0));
}
void QQuickItem::focusOutEvent(QFocusEvent *)
@@ -3734,8 +3733,8 @@ void QQuickItem::setZ(qreal v)
\table
\row
- \o \image declarative-rotation.png
- \o
+ \li \image declarative-rotation.png
+ \li
\qml
Rectangle {
color: "blue"
@@ -3768,8 +3767,8 @@ void QQuickItem::setZ(qreal v)
\table
\row
- \o \image declarative-scale.png
- \o
+ \li \image declarative-scale.png
+ \li
\qml
Rectangle {
color: "blue"
@@ -3805,8 +3804,8 @@ void QQuickItem::setZ(qreal v)
\table
\row
- \o \image declarative-item_opacity1.png
- \o
+ \li \image declarative-item_opacity1.png
+ \li
\qml
Item {
Rectangle {
@@ -3820,8 +3819,8 @@ void QQuickItem::setZ(qreal v)
}
\endqml
\row
- \o \image declarative-item_opacity2.png
- \o
+ \li \image declarative-item_opacity2.png
+ \li
\qml
Item {
Rectangle {
@@ -3990,9 +3989,6 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
itemChange(QQuickItem::ItemVisibleHasChanged, effectiveVisible);
- if (isAccessible)
- QAccessible::updateAccessibility(QAccessibleEvent(effectiveVisible ? QAccessible::ObjectShow : QAccessible::ObjectHide, q, 0));
-
emit q->visibleChanged();
if (childVisibilityChanged)
emit q->visibleChildrenChanged();
@@ -4445,7 +4441,7 @@ qreal QQuickItem::implicitWidth() const
}
\endqml
- \bold Note: using implicitWidth of Text or TextEdit and setting the width explicitly
+ \b Note: using implicitWidth of Text or TextEdit and setting the width explicitly
incurs a performance penalty as the text must be laid out twice.
*/
@@ -5638,9 +5634,9 @@ void QQuickItemLayer::setMipmap(bool mipmap)
allow you to save some texture memory.
\list
- \o ShaderEffectSource.Alpha - GL_ALPHA
- \o ShaderEffectSource.RGB - GL_RGB
- \o ShaderEffectSource.RGBA - GL_RGBA
+ \li ShaderEffectSource.Alpha - GL_ALPHA
+ \li ShaderEffectSource.RGB - GL_RGB
+ \li ShaderEffectSource.RGBA - GL_RGBA
\endlist
\note Some OpenGL implementations do not support the GL_ALPHA format.
@@ -5735,10 +5731,10 @@ void QQuickItemLayer::setSize(const QSize &size)
specified.
\list
- \o ShaderEffectSource.ClampToEdge - GL_CLAMP_TO_EDGE both horizontally and vertically
- \o ShaderEffectSource.RepeatHorizontally - GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically
- \o ShaderEffectSource.RepeatVertically - GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically
- \o ShaderEffectSource.Repeat - GL_REPEAT both horizontally and vertically
+ \li ShaderEffectSource.ClampToEdge - GL_CLAMP_TO_EDGE both horizontally and vertically
+ \li ShaderEffectSource.RepeatHorizontally - GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically
+ \li ShaderEffectSource.RepeatVertically - GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically
+ \li ShaderEffectSource.Repeat - GL_REPEAT both horizontally and vertically
\endlist
\note Some OpenGL ES 2 implementations do not support the GL_REPEAT
@@ -5747,7 +5743,7 @@ void QQuickItemLayer::setSize(const QSize &size)
void QQuickItemLayer::setWrapMode(QQuickShaderEffectSource::WrapMode mode)
{
- if (mode != m_wrapMode)
+ if (mode == m_wrapMode)
return;
m_wrapMode = mode;
diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp
index 32f1047e51..a1c398eeb6 100644
--- a/src/quick/items/qquickitemanimation.cpp
+++ b/src/quick/items/qquickitemanimation.cpp
@@ -701,12 +701,12 @@ void QQuickPathAnimation::setTargetObject(QQuickItem *target)
item to achieve the specified orientation as it travels along the path.
\list
- \o PathAnimation.Fixed (default) - the PathAnimation will not control
+ \li PathAnimation.Fixed (default) - the PathAnimation will not control
the rotation of the item.
- \o PathAnimation.RightFirst - The right side of the item will lead along the path.
- \o PathAnimation.LeftFirst - The left side of the item will lead along the path.
- \o PathAnimation.BottomFirst - The bottom of the item will lead along the path.
- \o PathAnimation.TopFirst - The top of the item will lead along the path.
+ \li PathAnimation.RightFirst - The right side of the item will lead along the path.
+ \li PathAnimation.LeftFirst - The left side of the item will lead along the path.
+ \li PathAnimation.BottomFirst - The bottom of the item will lead along the path.
+ \li PathAnimation.TopFirst - The top of the item will lead along the path.
\endlist
*/
QQuickPathAnimation::Orientation QQuickPathAnimation::orientation() const
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 501b206ef6..50a3216bf0 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -45,11 +45,12 @@
QT_BEGIN_NAMESPACE
-FxViewItem::FxViewItem(QQuickItem *i, bool own)
+FxViewItem::FxViewItem(QQuickItem *i, bool own, bool trackGeometry)
: item(i)
, transitionableItem(0)
, ownItem(own)
, releaseAfterTransition(false)
+ , trackGeom(trackGeometry)
{
}
@@ -257,8 +258,8 @@ void QQuickItemView::setModel(const QVariant &model)
QQuickVisualModel *oldModel = d->model;
d->clear();
- d->setPosition(d->contentStartOffset());
d->model = 0;
+ d->setPosition(d->contentStartOffset());
d->modelVariant = model;
QObject *object = qvariant_cast<QObject*>(model);
@@ -2195,10 +2196,10 @@ bool QQuickItemViewPrivate::releaseItem(FxViewItem *item)
QQuickItem *QQuickItemViewPrivate::createHighlightItem()
{
- return createComponentItem(highlightComponent, true, true);
+ return createComponentItem(highlightComponent, true);
}
-QQuickItem *QQuickItemViewPrivate::createComponentItem(QQmlComponent *component, bool receiveItemGeometryChanges, bool createDefault)
+QQuickItem *QQuickItemViewPrivate::createComponentItem(QQmlComponent *component, bool createDefault)
{
Q_Q(QQuickItemView);
@@ -2222,10 +2223,6 @@ QQuickItem *QQuickItemViewPrivate::createComponentItem(QQmlComponent *component,
if (item) {
QQml_setParent_noEvent(item, q->contentItem());
item->setParentItem(q->contentItem());
- if (receiveItemGeometryChanges) {
- QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- itemPrivate->addItemChangeListener(this, QQuickItemPrivate::Geometry);
- }
}
return item;
}
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index dfc0a8bc7e..7516761ee8 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -60,7 +60,7 @@ QT_MODULE(Quick)
class FxViewItem
{
public:
- FxViewItem(QQuickItem *, bool own);
+ FxViewItem(QQuickItem *, bool own, bool trackGeometry);
virtual ~FxViewItem();
qreal itemX() const;
@@ -92,6 +92,7 @@ public:
int index;
bool ownItem;
bool releaseAfterTransition;
+ bool trackGeom;
};
@@ -124,6 +125,8 @@ public:
QQuickItemViewPrivate();
~QQuickItemViewPrivate();
+ static inline QQuickItemViewPrivate *get(QQuickItemView *o) { return o->d_func(); }
+
struct ChangeResult {
QQmlNullableValue<qreal> visiblePos;
bool changedFirstItem;
@@ -191,7 +194,7 @@ public:
virtual bool releaseItem(FxViewItem *item);
QQuickItem *createHighlightItem();
- QQuickItem *createComponentItem(QQmlComponent *component, bool receiveItemGeometryChanges, bool createDefault = false);
+ QQuickItem *createComponentItem(QQmlComponent *component, bool createDefault = false);
void updateCurrent(int modelIndex);
void updateTrackedItem();
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index 823269bfc1..cdc1c19518 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -579,14 +579,14 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
operations:
\list
- \o \c populate - the transition to run when a view is created, or when the model changes
- \o \c add - the transition to apply to items that are added to the view
- \o \c remove - the transition to apply to items that are removed from the view
- \o \c move - the transition to apply to items that are moved within the view (i.e. as a result
+ \li \c populate - the transition to run when a view is created, or when the model changes
+ \li \c add - the transition to apply to items that are added to the view
+ \li \c remove - the transition to apply to items that are removed from the view
+ \li \c move - the transition to apply to items that are moved within the view (i.e. as a result
of a move operation in the model)
- \o \c displaced - the generic transition to be applied to any items that are displaced by an
+ \li \c displaced - the generic transition to be applied to any items that are displaced by an
add, move or remove operation
- \o \c addDisplaced, \c removeDisplaced and \c moveDisplaced - the transitions to be applied when
+ \li \c addDisplaced, \c removeDisplaced and \c moveDisplaced - the transitions to be applied when
items are displaced by add, move, or remove operations, respectively (these override the
generic displaced transition if specified)
\endlist
@@ -595,9 +595,9 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
items rather than data models, the following properties are used instead:
\list
- \o \c add - the transition to apply to items that are created for the positioner, added to
+ \li \c add - the transition to apply to items that are created for the positioner, added to
or reparented to the positioner, or items that have become \l {Item::}{visible}
- \o \c move - the transition to apply to items that have moved within the positioner, including
+ \li \c move - the transition to apply to items that have moved within the positioner, including
when they are displaced due to the addition or removal of other items, or when items are otherwise
rearranged within the positioner, or when items are repositioned due to the resizing of other
items in the positioner
@@ -612,17 +612,17 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
which the transition is applied:
\list
- \o ViewTransition.item - the item that is under transition
- \o ViewTransition.index - the index of this item
- \o ViewTransition.destination - the (x,y) point to which this item is moving for the relevant view operation
+ \li ViewTransition.item - the item that is under transition
+ \li ViewTransition.index - the index of this item
+ \li ViewTransition.destination - the (x,y) point to which this item is moving for the relevant view operation
\endlist
In addition, ViewTransition provides properties specific to the items which are the target
of the operation that triggered the transition:
\list
- \o ViewTransition.targetIndexes - the indexes of the target items
- \o ViewTransition.targetItems - the target items themselves
+ \li ViewTransition.targetIndexes - the indexes of the target items
+ \li ViewTransition.targetItems - the target items themselves
\endlist
(Note that for the \l Row, \l Column, \l Grid and \l Flow positioner elements, the \c move transition only
@@ -679,29 +679,29 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
\table
\header
- \o Property
- \o Value
- \o Explanation
+ \li Property
+ \li Value
+ \li Explanation
\row
- \o ViewTransition.item
- \o "Item 0" delegate instance
- \o The "Item 0" \l Rectangle object itself
+ \li ViewTransition.item
+ \li "Item 0" delegate instance
+ \li The "Item 0" \l Rectangle object itself
\row
- \o ViewTransition.index
- \o \c int value of 4
- \o The index of "Item 0" within the model following the add operation
+ \li ViewTransition.index
+ \li \c int value of 4
+ \li The index of "Item 0" within the model following the add operation
\row
- \o ViewTransition.destination
- \o \l point value of (0, 120)
- \o The position that "Item 0" is moving to
+ \li ViewTransition.destination
+ \li \l point value of (0, 120)
+ \li The position that "Item 0" is moving to
\row
- \o ViewTransition.targetIndexes
- \o \c int array, just contains the integer "0" (zero)
- \o The index of "Item 4", the new item added to the view
+ \li ViewTransition.targetIndexes
+ \li \c int array, just contains the integer "0" (zero)
+ \li The index of "Item 4", the new item added to the view
\row
- \o ViewTransition.targetItems
- \o object array, just contains the "Item 4" delegate instance
- \o The "Item 4" \l Rectangle object - the new item added to the view
+ \li ViewTransition.targetItems
+ \li object array, just contains the "Item 4" delegate instance
+ \li The "Item 4" \l Rectangle object - the new item added to the view
\endtable
The ViewTransition.targetIndexes and ViewTransition.targetItems lists provide the items and
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 9db2060d89..6f33545185 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -236,13 +236,22 @@ void QQuickViewSection::setLabelPositioning(int l)
class FxListItemSG : public FxViewItem
{
public:
- FxListItemSG(QQuickItem *i, QQuickListView *v, bool own) : FxViewItem(i, own), view(v) {
+ FxListItemSG(QQuickItem *i, QQuickListView *v, bool own, bool trackGeometry) : FxViewItem(i, own, trackGeometry), view(v) {
attached = static_cast<QQuickListViewAttached*>(qmlAttachedPropertiesObject<QQuickListView>(item));
if (attached)
static_cast<QQuickListViewAttached*>(attached)->setView(view);
+ if (trackGeometry) {
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ itemPrivate->addItemChangeListener(QQuickItemViewPrivate::get(view), QQuickItemPrivate::Geometry);
+ }
}
- ~FxListItemSG() {}
+ ~FxListItemSG() {
+ if (trackGeom) {
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ itemPrivate->removeItemChangeListener(QQuickItemViewPrivate::get(view), QQuickItemPrivate::Geometry);
+ }
+ }
inline QQuickItem *section() const {
return attached ? static_cast<QQuickListViewAttached*>(attached)->m_sectionItem : 0;
@@ -524,7 +533,9 @@ void QQuickListViewPrivate::clear()
sectionCache[i] = 0;
}
visiblePos = 0;
+ releaseSectionItem(currentSectionItem);
currentSectionItem = 0;
+ releaseSectionItem(nextSectionItem);
nextSectionItem = 0;
lastVisibleSection = QString();
QQuickItemViewPrivate::clear();
@@ -534,7 +545,7 @@ FxViewItem *QQuickListViewPrivate::newViewItem(int modelIndex, QQuickItem *item)
{
Q_Q(QQuickListView);
- FxListItemSG *listItem = new FxListItemSG(item, q, false);
+ FxListItemSG *listItem = new FxListItemSG(item, q, false, false);
listItem->index = modelIndex;
// initialise attached properties
@@ -833,7 +844,7 @@ void QQuickListViewPrivate::createHighlight()
if (currentItem) {
QQuickItem *item = createHighlightItem();
if (item) {
- FxListItemSG *newHighlight = new FxListItemSG(item, q, true);
+ FxListItemSG *newHighlight = new FxListItemSG(item, q, true, true);
if (autoHighlight) {
newHighlight->setSize(static_cast<FxListItemSG*>(currentItem)->itemSize());
@@ -933,6 +944,8 @@ QQuickItem * QQuickListViewPrivate::getSectionItem(const QString &section)
void QQuickListViewPrivate::releaseSectionItem(QQuickItem *item)
{
+ if (!item)
+ return;
int i = 0;
do {
if (!sectionCache[i]) {
@@ -970,7 +983,7 @@ void QQuickListViewPrivate::updateInlineSection(FxListItemSG *listItem)
void QQuickListViewPrivate::updateStickySections()
{
- if (!sectionCriteria || visibleItems.isEmpty()
+ if (!sectionCriteria
|| (!sectionCriteria->labelPositioning() && !currentSectionItem && !nextSectionItem))
return;
@@ -1006,7 +1019,7 @@ void QQuickListViewPrivate::updateStickySections()
}
// Current section header
- if (sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart) {
+ if (sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart && isValid() && visibleItems.count()) {
if (!currentSectionItem) {
currentSectionItem = getSectionItem(currentSection);
} else if (currentStickySection != currentSection) {
@@ -1039,7 +1052,7 @@ void QQuickListViewPrivate::updateStickySections()
}
// Next section footer
- if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd) {
+ if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd && isValid() && visibleItems.count()) {
if (!nextSectionItem) {
nextSectionItem = getSectionItem(nextSection);
} else if (nextStickySection != nextSection) {
@@ -1077,7 +1090,7 @@ void QQuickListViewPrivate::updateSections()
QQuickItemViewPrivate::updateSections();
- if (sectionCriteria && !visibleItems.isEmpty()) {
+ if (sectionCriteria && !visibleItems.isEmpty() && isValid()) {
QString prevSection;
if (visibleIndex > 0)
prevSection = sectionAt(visibleIndex-1);
@@ -1234,11 +1247,11 @@ void QQuickListViewPrivate::updateFooter()
Q_Q(QQuickListView);
bool created = false;
if (!footer) {
- QQuickItem *item = createComponentItem(footerComponent, true);
+ QQuickItem *item = createComponentItem(footerComponent);
if (!item)
return;
item->setZ(1);
- footer = new FxListItemSG(item, q, true);
+ footer = new FxListItemSG(item, q, true, true);
created = true;
}
@@ -1265,11 +1278,11 @@ void QQuickListViewPrivate::updateHeader()
Q_Q(QQuickListView);
bool created = false;
if (!header) {
- QQuickItem *item = createComponentItem(headerComponent, true);
+ QQuickItem *item = createComponentItem(headerComponent);
if (!item)
return;
item->setZ(1);
- header = new FxListItemSG(item, q, true);
+ header = new FxListItemSG(item, q, true, true);
created = true;
}
@@ -1848,13 +1861,13 @@ QQuickListView::~QQuickListView()
Valid values for \c highlightRangeMode are:
\list
- \o ListView.ApplyRange - the view attempts to maintain the highlight within the range.
+ \li ListView.ApplyRange - the view attempts to maintain the highlight within the range.
However, the highlight can move outside of the range at the ends of the list or due
to mouse interaction.
- \o ListView.StrictlyEnforceRange - the highlight never moves outside of the range.
+ \li ListView.StrictlyEnforceRange - the highlight never moves outside of the range.
The current item changes if a keyboard or mouse action would cause the highlight to move
outside of the range.
- \o ListView.NoHighlightRange - this is the default value.
+ \li ListView.NoHighlightRange - this is the default value.
\endlist
*/
void QQuickListView::setHighlightFollowsCurrentItem(bool autoHighlight)
@@ -1902,17 +1915,17 @@ void QQuickListView::setSpacing(qreal spacing)
Possible values:
\list
- \o ListView.Horizontal - Items are laid out horizontally
- \o ListView.Vertical (default) - Items are laid out vertically
+ \li ListView.Horizontal - Items are laid out horizontally
+ \li ListView.Vertical (default) - Items are laid out vertically
\endlist
\table
\row
- \o Horizontal orientation:
+ \li Horizontal orientation:
\image ListViewHorizontal.png
\row
- \o Vertical orientation:
+ \li Vertical orientation:
\image listview-highlight.png
\endtable
*/
@@ -1948,8 +1961,8 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
Possible values:
\list
- \o Qt.LeftToRight (default) - Items will be laid out from left to right.
- \o Qt.RightToLeft - Items will be laid out from right to let.
+ \li Qt.LeftToRight (default) - Items will be laid out from left to right.
+ \li Qt.RightToLeft - Items will be laid out from right to let.
\endlist
\sa ListView::effectiveLayoutDirection
@@ -2020,9 +2033,9 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
\c section.property. This value can be one of:
\list
- \o ViewSection.FullString (default) - sections are created based on the
+ \li ViewSection.FullString (default) - sections are created based on the
\c section.property value.
- \o ViewSection.FirstCharacter - sections are created based on the first
+ \li ViewSection.FirstCharacter - sections are created based on the first
character of the \c section.property value (for example, 'A', 'B', 'C'
sections, etc. for an address book)
\endlist
@@ -2034,11 +2047,11 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
the labels are shown inline. This value can be a combination of:
\list
- \o ViewSection.InlineLabels - section labels are shown inline between
+ \li ViewSection.InlineLabels - section labels are shown inline between
the item delegates separating sections (default).
- \o ViewSection.CurrentLabelAtStart - the current section label sticks to the
+ \li ViewSection.CurrentLabelAtStart - the current section label sticks to the
start of the view as it is moved.
- \o ViewSection.NextLabelAtEnd - the next section label (beyond all visible
+ \li ViewSection.NextLabelAtEnd - the next section label (beyond all visible
sections) sticks to the end of the view as it is moved. \note Enabling
\c ViewSection.NextLabelAtEnd requires the view to scan ahead for the next
section, which has performance implications, especially for slower models.
@@ -2174,10 +2187,10 @@ void QQuickListView::setHighlightResizeDuration(int duration)
The possible values are:
\list
- \o ListView.NoSnap (default) - the view stops anywhere within the visible area.
- \o ListView.SnapToItem - the view settles with an item aligned with the start of
+ \li ListView.NoSnap (default) - the view stops anywhere within the visible area.
+ \li ListView.SnapToItem - the view settles with an item aligned with the start of
the view.
- \o ListView.SnapOneItem - the view settles no more than one item away from the first
+ \li ListView.SnapOneItem - the view settles no more than one item away from the first
visible item at the time the mouse button is released. This mode is particularly
useful for moving one page at a time.
\endlist
@@ -2254,9 +2267,9 @@ void QQuickListView::setSnapMode(SnapMode mode)
It is applied to all items that are created when:
\list
- \o The view is first created
- \o The view's \l model changes
- \o The view's \l model is \l {QAbstractItemModel::reset}{reset}, if the model is a QAbstractItemModel subclass
+ \li The view is first created
+ \li The view's \l model changes
+ \li The view's \l model is \l {QAbstractItemModel::reset}{reset}, if the model is a QAbstractItemModel subclass
\endlist
For example, here is a view that specifies such a transition:
@@ -2670,7 +2683,7 @@ void QQuickListView::geometryChanged(const QRectF &newGeometry, const QRectF &ol
if keyNavigationWraps is true and it is currently at the end.
This method has no effect if the \l count is zero.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QQuickListView::incrementCurrentIndex()
{
@@ -2690,7 +2703,7 @@ void QQuickListView::incrementCurrentIndex()
if keyNavigationWraps is true and it is currently at the beginning.
This method has no effect if the \l count is zero.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QQuickListView::decrementCurrentIndex()
{
@@ -2879,12 +2892,12 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
\a mode:
\list
- \o ListView.Beginning - position item at the top (or left for horizontal orientation) of the view.
- \o ListView.Center - position item in the center of the view.
- \o ListView.End - position item at bottom (or right for horizontal orientation) of the view.
- \o ListView.Visible - if any part of the item is visible then take no action, otherwise
+ \li ListView.Beginning - position item at the top (or left for horizontal orientation) of the view.
+ \li ListView.Center - position item in the center of the view.
+ \li ListView.End - position item at bottom (or right for horizontal orientation) of the view.
+ \li ListView.Visible - if any part of the item is visible then take no action, otherwise
bring the item into view.
- \o ListView.Contain - ensure the entire item is visible. If the item is larger than
+ \li ListView.Contain - ensure the entire item is visible. If the item is larger than
the view the item is positioned at the top (or left for horizontal orientation) of the view.
\endlist
@@ -2897,7 +2910,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
the actual start of the view can vary based on the size of the delegates.
The correct way to bring an item into view is with \c positionViewAtIndex.
- \bold Note: methods should only be called after the Component has completed. To position
+ \b Note: methods should only be called after the Component has completed. To position
the view at startup, this method should be called by Component.onCompleted. For
example, to position the view at the end:
@@ -2917,7 +2930,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
of the list does not cause all other items to be repositioned, and because
the actual start of the view can vary based on the size of the delegates.
- \bold Note: methods should only be called after the Component has completed. To position
+ \b Note: methods should only be called after the Component has completed. To position
the view at startup, this method should be called by Component.onCompleted. For
example, to position the view at the end on startup:
@@ -2936,7 +2949,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
If the item is outside the visible area, -1 is returned, regardless of
whether an item will exist at that point when scrolled into view.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
/*!
@@ -2949,7 +2962,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
If the item is outside the visible area, null is returned, regardless of
whether an item will exist at that point when scrolled into view.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
QQuickListViewAttached *QQuickListView::qmlAttachedProperties(QObject *obj)
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index bbc51a4d26..59cb37c15d 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -148,10 +148,10 @@ void QQuickLoaderPrivate::initResize()
accordingly to become visible.
\list
- \o If an explicit size is not specified for the Loader, the Loader
+ \li If an explicit size is not specified for the Loader, the Loader
is automatically resized to the size of the loaded item once the
component is loaded.
- \o If the size of the Loader is specified explicitly by setting
+ \li If the size of the Loader is specified explicitly by setting
the width, height or by anchoring, the loaded item will be resized
to the size of the Loader.
\endlist
@@ -162,14 +162,14 @@ void QQuickLoaderPrivate::initResize()
\table
\row
- \o sizeloader.qml
- \o sizeitem.qml
+ \li sizeloader.qml
+ \li sizeitem.qml
\row
- \o \snippet doc/src/snippets/qml/loader/sizeloader.qml 0
- \o \snippet doc/src/snippets/qml/loader/sizeitem.qml 0
+ \li \snippet doc/src/snippets/qml/loader/sizeloader.qml 0
+ \li \snippet doc/src/snippets/qml/loader/sizeitem.qml 0
\row
- \o The red rectangle will be sized to the size of the root item.
- \o The red rectangle will be 50x50, centered in the root item.
+ \li The red rectangle will be sized to the size of the root item.
+ \li The red rectangle will be 50x50, centered in the root item.
\endtable
@@ -182,11 +182,11 @@ void QQuickLoaderPrivate::initResize()
\table
\row
- \o application.qml
- \o MyItem.qml
+ \li application.qml
+ \li MyItem.qml
\row
- \o \snippet doc/src/snippets/qml/loader/connections.qml 0
- \o \snippet doc/src/snippets/qml/loader/MyItem.qml 0
+ \li \snippet doc/src/snippets/qml/loader/connections.qml 0
+ \li \snippet doc/src/snippets/qml/loader/MyItem.qml 0
\endtable
Alternatively, since \c MyItem.qml is loaded within the scope of the
@@ -209,11 +209,11 @@ void QQuickLoaderPrivate::initResize()
\table
\row
- \o application.qml
- \o KeyReader.qml
+ \li application.qml
+ \li KeyReader.qml
\row
- \o \snippet doc/src/snippets/qml/loader/focus.qml 0
- \o \snippet doc/src/snippets/qml/loader/KeyReader.qml 0
+ \li \snippet doc/src/snippets/qml/loader/focus.qml 0
+ \li \snippet doc/src/snippets/qml/loader/KeyReader.qml 0
\endtable
Once \c KeyReader.qml is loaded, it accepts key events and sets
@@ -344,7 +344,8 @@ void QQuickLoader::loadFromSource()
}
if (isComponentComplete()) {
- d->component = new QQmlComponent(qmlEngine(this), d->source, this);
+ QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
+ d->component = new QQmlComponent(qmlEngine(this), d->source, mode, this);
d->load();
}
}
@@ -428,7 +429,7 @@ void QQuickLoader::loadFromSourceComponent()
the \a source component will be created with the initial \a properties set.
Setting the initial property values of an instance of a component in this manner
- will \bold{not} trigger any associated \l{Behavior}s.
+ will \b{not} trigger any associated \l{Behavior}s.
Note that the cached \a properties will be cleared if the \l source or \l sourceComponent
is changed after calling this function but prior to setting the loader \l active.
@@ -436,7 +437,7 @@ void QQuickLoader::loadFromSourceComponent()
Example:
\table
\row
- \o
+ \li
\qml
// ExampleComponent.qml
import QtQuick 2.0
@@ -456,7 +457,7 @@ void QQuickLoader::loadFromSourceComponent()
}
}
\endqml
- \o
+ \li
\qml
// example.qml
import QtQuick 2.0
@@ -633,22 +634,22 @@ void QQuickLoaderPrivate::_q_sourceLoaded()
This property holds the status of QML loading. It can be one of:
\list
- \o Loader.Null - the loader is inactive or no QML source has been set
- \o Loader.Ready - the QML source has been loaded
- \o Loader.Loading - the QML source is currently being loaded
- \o Loader.Error - an error occurred while loading the QML source
+ \li Loader.Null - the loader is inactive or no QML source has been set
+ \li Loader.Ready - the QML source has been loaded
+ \li Loader.Loading - the QML source is currently being loaded
+ \li Loader.Error - an error occurred while loading the QML source
\endlist
Use this status to provide an update or respond to the status change in some way.
For example, you could:
\list
- \o Trigger a state change:
+ \li Trigger a state change:
\qml
State { name: 'loaded'; when: loader.status == Loader.Ready }
\endqml
- \o Implement an \c onStatusChanged signal handler:
+ \li Implement an \c onStatusChanged signal handler:
\qml
Loader {
id: loader
@@ -656,7 +657,7 @@ void QQuickLoaderPrivate::_q_sourceLoaded()
}
\endqml
- \o Bind to the status value:
+ \li Bind to the status value:
\qml
Text { text: loader.status == Loader.Ready ? 'Loaded' : 'Not loaded' }
\endqml
@@ -711,7 +712,8 @@ void QQuickLoader::componentComplete()
QQuickItem::componentComplete();
if (active()) {
if (d->loadingFromSource) {
- d->component = new QQmlComponent(qmlEngine(this), d->source, this);
+ QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
+ d->component = new QQmlComponent(qmlEngine(this), d->source, mode, this);
}
d->load();
}
@@ -752,6 +754,9 @@ qreal QQuickLoader::progress() const
This property holds whether the component will be instantiated asynchronously.
+When used in conjunction with the \l source property, loading and compilation
+will also be performed in a background thread.
+
Loading asynchronously creates the objects declared by the component
across multiple frames, and reduces the
likelihood of glitches in animation. When loading asynchronously the status
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index efb804bd18..b8555124eb 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -556,8 +556,8 @@ QQuickMouseArea::~QQuickMouseArea()
If hoverEnabled is true then these properties will be valid when:
\list
- \i no button is pressed, but the mouse is within the MouseArea (containsMouse is true).
- \i a button is pressed and held, even if it has since moved out of the area.
+ \li no button is pressed, but the mouse is within the MouseArea (containsMouse is true).
+ \li a button is pressed and held, even if it has since moved out of the area.
\endlist
The coordinates are relative to the MouseArea.
@@ -671,9 +671,9 @@ void QQuickMouseArea::setPropagateComposedEvents(bool prevent)
It contains a bitwise combination of:
\list
- \o Qt.LeftButton
- \o Qt.RightButton
- \o Qt.MiddleButton
+ \li Qt.LeftButton
+ \li Qt.RightButton
+ \li Qt.MiddleButton
\endlist
The code below displays "right" when the right mouse buttons is pressed:
@@ -1100,9 +1100,9 @@ void QQuickMouseArea::setHovered(bool h)
The available buttons are:
\list
- \o Qt.LeftButton
- \o Qt.RightButton
- \o Qt.MiddleButton
+ \li Qt.LeftButton
+ \li Qt.RightButton
+ \li Qt.MiddleButton
\endlist
To accept more than one button the flags can be combined with the
@@ -1174,10 +1174,10 @@ bool QQuickMouseArea::setPressed(bool p)
\c drag provides a convenient way to make an item draggable.
\list
- \i \c drag.target specifies the id of the item to drag.
- \i \c drag.active specifies if the target item is currently being dragged.
- \i \c drag.axis specifies whether dragging can be done horizontally (\c Drag.XAxis), vertically (\c Drag.YAxis), or both (\c Drag.XandYAxis)
- \i \c drag.minimum and \c drag.maximum limit how far the target can be dragged along the corresponding axes.
+ \li \c drag.target specifies the id of the item to drag.
+ \li \c drag.active specifies if the target item is currently being dragged.
+ \li \c drag.axis specifies whether dragging can be done horizontally (\c Drag.XAxis), vertically (\c Drag.YAxis), or both (\c Drag.XandYAxis)
+ \li \c drag.minimum and \c drag.maximum limit how far the target can be dragged along the corresponding axes.
\endlist
The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 7dd6ec0589..110cc6ad7a 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -108,9 +108,9 @@ void QQuickTouchPoint::setY(qreal y)
These properties hold additional information about the current state of the touch point.
\list
- \i \c pressure is a value in the range of 0.0 to 1.0.
- \i \c velocity is a vector with magnitude reported in pixels per second.
- \i \c area is a rectangle covering the area of the touch point, centered on the current position of the touch point.
+ \li \c pressure is a value in the range of 0.0 to 1.0.
+ \li \c velocity is a vector with magnitude reported in pixels per second.
+ \li \c area is a rectangle covering the area of the touch point, centered on the current position of the touch point.
\endlist
Not all touch devices support velocity. If velocity is not supported, it will be reported
@@ -235,11 +235,11 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
MultiPointTouchArea can be used in two ways:
\list
- \o setting \c touchPoints to provide touch point objects with properties that can be bound to
- \o using the onTouchUpdated or onTouchPointsPressed, onTouchPointsUpdated and onTouchPointsReleased handlers
+ \li setting \c touchPoints to provide touch point objects with properties that can be bound to
+ \li using the onTouchUpdated or onTouchPointsPressed, onTouchPointsUpdated and onTouchPointsReleased handlers
\endlist
- While a MultiPointTouchArea \i can take exclusive ownership of certain touch points, it is also possible to have
+ While a MultiPointTouchArea \e can take exclusive ownership of certain touch points, it is also possible to have
multiple MultiPointTouchAreas active at the same time, each operating on a different set of touch points.
\sa TouchPoint
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 0526187531..1fa0a90b28 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -466,7 +466,7 @@ void QQuickPathViewPrivate::regenerate()
\snippet doc/src/snippets/qml/pathview/pathview.qml 1
- \bold Note that views do not enable \e clip automatically. If the view
+ \b Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
@@ -695,7 +695,7 @@ QQuickItem *QQuickPathView::currentItem() const
Increments the current index.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QQuickPathView::incrementCurrentIndex()
{
@@ -709,7 +709,7 @@ void QQuickPathView::incrementCurrentIndex()
Decrements the current index.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QQuickPathView::decrementCurrentIndex()
{
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 674abdcfd8..6f79385d96 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
\ingroup qml-event-elements
\brief The PinchEvent object provides information about a pinch event.
- \bold {The PinchEvent element was added in QtQuick 1.1}
+ \b {The PinchEvent element was added in QtQuick 1.1}
The \c center, \c startCenter, \c previousCenter properties provide the center position between the two touch points.
@@ -81,9 +81,9 @@ QT_BEGIN_NAMESPACE
These properties hold the position of the center point between the two touch points.
\list
- \o \c center is the current center point
- \o \c previousCenter is the center point of the previous event.
- \o \c startCenter is the center point when the gesture began
+ \li \c center is the current center point
+ \li \c previousCenter is the center point of the previous event.
+ \li \c startCenter is the center point when the gesture began
\endlist
*/
@@ -94,8 +94,8 @@ QT_BEGIN_NAMESPACE
These properties hold the scale factor determined by the change in distance between the two touch points.
\list
- \o \c scale is the current scale factor.
- \o \c previousScale is the scale factor of the previous event.
+ \li \c scale is the current scale factor.
+ \li \c previousScale is the scale factor of the previous event.
\endlist
When a pinch gesture is started, the scale is 1.0.
@@ -109,9 +109,9 @@ QT_BEGIN_NAMESPACE
These properties hold the angle between the two touch points.
\list
- \o \c angle is the current angle between the two points in the range -180 to 180.
- \o \c previousAngle is the angle of the previous event.
- \o \c rotation is the total rotation since the pinch gesture started.
+ \li \c angle is the current angle between the two points in the range -180 to 180.
+ \li \c previousAngle is the angle of the previous event.
+ \li \c rotation is the total rotation since the pinch gesture started.
\endlist
When a pinch gesture is started, the rotation is 0.0.
@@ -126,8 +126,8 @@ QT_BEGIN_NAMESPACE
These properties provide the actual touch points generating the pinch.
\list
- \o \c point1 and \c point2 hold the current positions of the points.
- \o \c startPoint1 and \c startPoint2 hold the positions of the points when the second point was touched.
+ \li \c point1 and \c point2 hold the current positions of the points.
+ \li \c startPoint1 and \c startPoint2 hold the positions of the points when the second point was touched.
\endlist
*/
@@ -166,7 +166,7 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
\brief The PinchArea item enables simple pinch gesture handling.
\inherits Item
- \bold {The PinchArea element was added in QtQuick 1.1}
+ \b {The PinchArea element was added in QtQuick 1.1}
A PinchArea is an invisible item that is typically used in conjunction with
a visible item in order to provide pinch gesture handling for that item.
@@ -178,8 +178,8 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
PinchArea can be used in two ways:
\list
- \o setting a \c pinch.target to provide automatic interaction with an element
- \o using the onPinchStarted, onPinchUpdated and onPinchFinished handlers
+ \li setting a \c pinch.target to provide automatic interaction with an element
+ \li using the onPinchStarted, onPinchUpdated and onPinchFinished handlers
\endlist
\sa PinchEvent
@@ -232,12 +232,12 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
\c pinch provides a convenient way to make an item react to pinch gestures.
\list
- \i \c pinch.target specifies the id of the item to drag.
- \i \c pinch.active specifies if the target item is currently being dragged.
- \i \c pinch.minimumScale and \c pinch.maximumScale limit the range of the Item::scale property.
- \i \c pinch.minimumRotation and \c pinch.maximumRotation limit the range of the Item::rotation property.
- \i \c pinch.dragAxis specifies whether dragging in not allowed (\c Pinch.NoDrag), can be done horizontally (\c Pinch.XAxis), vertically (\c Pinch.YAxis), or both (\c Pinch.XandYAxis)
- \i \c pinch.minimum and \c pinch.maximum limit how far the target can be dragged along the corresponding axes.
+ \li \c pinch.target specifies the id of the item to drag.
+ \li \c pinch.active specifies if the target item is currently being dragged.
+ \li \c pinch.minimumScale and \c pinch.maximumScale limit the range of the Item::scale property.
+ \li \c pinch.minimumRotation and \c pinch.maximumRotation limit the range of the Item::rotation property.
+ \li \c pinch.dragAxis specifies whether dragging in not allowed (\c Pinch.NoDrag), can be done horizontally (\c Pinch.XAxis), vertically (\c Pinch.YAxis), or both (\c Pinch.XandYAxis)
+ \li \c pinch.minimum and \c pinch.maximum limit how far the target can be dragged along the corresponding axes.
\endlist
*/
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index 7c4cd18346..97a74c6765 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -608,8 +608,8 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
positioner. For a positioner, this applies to:
\list
- \o Items that are created or reparented as a child of the positioner
- \o Child items that change their \l visible property from false to true, and thus
+ \li Items that are created or reparented as a child of the positioner
+ \li Child items that change their \l visible property from false to true, and thus
are now visible
\endlist
@@ -626,9 +626,9 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
positioner. For a positioner, this applies to:
\list
- \o Child items that move when they are displaced due to the addition, removal or
+ \li Child items that move when they are displaced due to the addition, removal or
rearrangement of other items in the positioner
- \o Child items that are repositioned due to the resizing of other items in the positioner
+ \li Child items that are repositioned due to the resizing of other items in the positioner
\endlist
The transition can use the \l ViewTransition property to access more details about
@@ -741,8 +741,8 @@ void QQuickColumn::reportConflictingAnchors()
positioner. For a positioner, this applies to:
\list
- \o Items that are created or reparented as a child of the positioner
- \o Child items that change their \l visible property from false to true, and thus
+ \li Items that are created or reparented as a child of the positioner
+ \li Child items that change their \l visible property from false to true, and thus
are now visible
\endlist
@@ -759,9 +759,9 @@ void QQuickColumn::reportConflictingAnchors()
positioner. For a positioner, this applies to:
\list
- \o Child items that move when they are displaced due to the addition, removal or
+ \li Child items that move when they are displaced due to the addition, removal or
rearrangement of other items in the positioner
- \o Child items that are repositioned due to the resizing of other items in the positioner
+ \li Child items that are repositioned due to the resizing of other items in the positioner
\endlist
The transition can use the \l ViewTransition property to access more details about
@@ -795,9 +795,9 @@ QQuickRow::QQuickRow(QQuickItem *parent)
Possible values:
\list
- \o Qt.LeftToRight (default) - Items are laid out from left to right. If the width of the row is explicitly set,
+ \li Qt.LeftToRight (default) - Items are laid out from left to right. If the width of the row is explicitly set,
the left anchor remains to the left of the row.
- \o Qt.RightToLeft - Items are laid out from right to left. If the width of the row is explicitly set,
+ \li Qt.RightToLeft - Items are laid out from right to left. If the width of the row is explicitly set,
the right anchor remains to the right of the row.
\endlist
@@ -953,8 +953,8 @@ void QQuickRow::reportConflictingAnchors()
positioner. For a positioner, this applies to:
\list
- \o Items that are created or reparented as a child of the positioner
- \o Child items that change their \l visible property from false to true, and thus
+ \li Items that are created or reparented as a child of the positioner
+ \li Child items that change their \l visible property from false to true, and thus
are now visible
\endlist
@@ -971,9 +971,9 @@ void QQuickRow::reportConflictingAnchors()
positioner. For a positioner, this applies to:
\list
- \o Child items that move when they are displaced due to the addition, removal or
+ \li Child items that move when they are displaced due to the addition, removal or
rearrangement of other items in the positioner
- \o Child items that are repositioned due to the resizing of other items in the positioner
+ \li Child items that are repositioned due to the resizing of other items in the positioner
\endlist
The transition can use the \l ViewTransition property to access more details about
@@ -1059,9 +1059,9 @@ void QQuickGrid::setRows(const int rows)
Possible values are:
\list
- \o Grid.LeftToRight (default) - Items are positioned next to
+ \li Grid.LeftToRight (default) - Items are positioned next to
each other in the \l layoutDirection, then wrapped to the next line.
- \o Grid.TopToBottom - Items are positioned next to each
+ \li Grid.TopToBottom - Items are positioned next to each
other from top to bottom, then wrapped to the next column.
\endlist
*/
@@ -1131,10 +1131,10 @@ void QQuickGrid::setColumnSpacing(const qreal columnSpacing)
Possible values are:
\list
- \o Qt.LeftToRight (default) - Items are positioned from the top to bottom,
+ \li Qt.LeftToRight (default) - Items are positioned from the top to bottom,
and left to right. The flow direction is dependent on the
\l Grid::flow property.
- \o Qt.RightToLeft - Items are positioned from the top to bottom,
+ \li Qt.RightToLeft - Items are positioned from the top to bottom,
and right to left. The flow direction is dependent on the
\l Grid::flow property.
\endlist
@@ -1366,8 +1366,8 @@ void QQuickGrid::reportConflictingAnchors()
positioner. For a positioner, this applies to:
\list
- \o Items that are created or reparented as a child of the positioner
- \o Child items that change their \l visible property from false to true, and thus
+ \li Items that are created or reparented as a child of the positioner
+ \li Child items that change their \l visible property from false to true, and thus
are now visible
\endlist
@@ -1384,9 +1384,9 @@ void QQuickGrid::reportConflictingAnchors()
positioner. For a positioner, this applies to:
\list
- \o Child items that move when they are displaced due to the addition, removal or
+ \li Child items that move when they are displaced due to the addition, removal or
rearrangement of other items in the positioner
- \o Child items that are repositioned due to the resizing of other items in the positioner
+ \li Child items that are repositioned due to the resizing of other items in the positioner
\endlist
The transition can use the \l ViewTransition property to access more details about
@@ -1435,10 +1435,10 @@ QQuickFlow::QQuickFlow(QQuickItem *parent)
Possible values are:
\list
- \o Flow.LeftToRight (default) - Items are positioned next to
+ \li Flow.LeftToRight (default) - Items are positioned next to
to each other according to the \l layoutDirection until the width of the Flow
is exceeded, then wrapped to the next line.
- \o Flow.TopToBottom - Items are positioned next to each
+ \li Flow.TopToBottom - Items are positioned next to each
other from top to bottom until the height of the Flow is exceeded,
then wrapped to the next column.
\endlist
@@ -1467,10 +1467,10 @@ void QQuickFlow::setFlow(Flow flow)
Possible values are:
\list
- \o Qt.LeftToRight (default) - Items are positioned from the top to bottom,
+ \li Qt.LeftToRight (default) - Items are positioned from the top to bottom,
and left to right. The flow direction is dependent on the
\l Flow::flow property.
- \o Qt.RightToLeft - Items are positioned from the top to bottom,
+ \li Qt.RightToLeft - Items are positioned from the top to bottom,
and right to left. The flow direction is dependent on the
\l Flow::flow property.
\endlist
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 1f7578c583..f83b9f068a 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -162,10 +162,10 @@ QQuickRepeater::~QQuickRepeater()
This property can be set to any of the supported \l {qmlmodels}{data models}:
\list
- \o A number that indicates the number of delegates to be created by the repeater
- \o A model (e.g. a ListModel item, or a QAbstractItemModel subclass)
- \o A string list
- \o An object list
+ \li A number that indicates the number of delegates to be created by the repeater
+ \li A model (e.g. a ListModel item, or a QAbstractItemModel subclass)
+ \li A string list
+ \li An object list
\endlist
The type of model affects the properties that are exposed to the \l delegate.
@@ -243,8 +243,8 @@ void QQuickRepeater::setModel(const QVariant &model)
\table
\row
- \o \snippet doc/src/snippets/qml/repeaters/repeater.qml index
- \o \image repeater-index.png
+ \li \snippet doc/src/snippets/qml/repeaters/repeater.qml index
+ \li \image repeater-index.png
\endtable
If the \l model is a \l{QStringList-based model}{string list} or
@@ -254,8 +254,8 @@ void QQuickRepeater::setModel(const QVariant &model)
\table
\row
- \o \snippet doc/src/snippets/qml/repeaters/repeater.qml modeldata
- \o \image repeater-modeldata.png
+ \li \snippet doc/src/snippets/qml/repeaters/repeater.qml modeldata
+ \li \image repeater-modeldata.png
\endtable
If the \l model is a model object (such as a \l ListModel) the delegate
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index e66e05afb3..d7eedd42b6 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -103,15 +103,15 @@ const char *qtTexCoordAttributeName()
There are two types of input to the \l vertexShader:
uniform variables and attributes. Some are predefined:
\list
- \o uniform mat4 qt_Matrix - combined transformation
+ \li uniform mat4 qt_Matrix - combined transformation
matrix, the product of the matrices from the root item to this
ShaderEffect, and an orthogonal projection.
- \o uniform float qt_Opacity - combined opacity, the product of the
+ \li uniform float qt_Opacity - combined opacity, the product of the
opacities from the root item to this ShaderEffect.
- \o attribute vec4 qt_Vertex - vertex position, the top-left vertex has
+ \li attribute vec4 qt_Vertex - vertex position, the top-left vertex has
position (0, 0), the bottom-right (\l{Item::width}{width},
\l{Item::height}{height}).
- \o attribute vec2 qt_MultiTexCoord0 - texture coordinate, the top-left
+ \li attribute vec2 qt_MultiTexCoord0 - texture coordinate, the top-left
coordinate is (0, 0), the bottom-right (1, 1).
\endlist
@@ -119,17 +119,17 @@ const char *qtTexCoordAttributeName()
(GLSL) type is available as a uniform variable. The following list shows
how properties are mapped to GLSL uniform variables:
\list
- \o bool, int, qreal -> bool, int, float - If the type in the shader is not
+ \li bool, int, qreal -> bool, int, float - If the type in the shader is not
the same as in QML, the value is converted automatically.
- \o QColor -> vec4 - When colors are passed to the shader, they are first
+ \li QColor -> vec4 - When colors are passed to the shader, they are first
premultiplied. Thus Qt.rgba(0.2, 0.6, 1.0, 0.5) becomes
vec4(0.1, 0.3, 0.5, 0.5) in the shader, for example.
- \o QRect, QRectF -> vec4 - Qt.rect(x, y, w, h) becomes vec4(x, y, w, h) in
+ \li QRect, QRectF -> vec4 - Qt.rect(x, y, w, h) becomes vec4(x, y, w, h) in
the shader.
- \o QPoint, QPointF, QSize, QSizeF -> vec2
- \o QVector3D -> vec3
- \o QTransform -> mat4
- \o \l Image, \l ShaderEffectSource -> sampler2D - Origin is in the top-left
+ \li QPoint, QPointF, QSize, QSizeF -> vec2
+ \li QVector3D -> vec3
+ \li QTransform -> mat4
+ \li \l Image, \l ShaderEffectSource -> sampler2D - Origin is in the top-left
corner, and the color values are premultiplied.
\endlist
@@ -138,8 +138,8 @@ const char *qtTexCoordAttributeName()
blending can be achieved by outputting zero in the alpha channel.
\row
- \o \image declarative-shadereffectitem.png
- \o \qml
+ \li \image declarative-shadereffectitem.png
+ \li \qml
import QtQuick 2.0
Rectangle {
@@ -326,9 +326,9 @@ void QQuickShaderEffect::setMesh(const QVariant &mesh)
This property defines which sides of the element should be visible.
\list
- \o ShaderEffect.NoCulling - Both sides are visible
- \o ShaderEffect.BackFaceCulling - only front side is visible
- \o ShaderEffect.FrontFaceCulling - only back side is visible
+ \li ShaderEffect.NoCulling - Both sides are visible
+ \li ShaderEffect.BackFaceCulling - only front side is visible
+ \li ShaderEffect.FrontFaceCulling - only back side is visible
\endlist
The default is NoCulling.
@@ -349,9 +349,9 @@ void QQuickShaderEffect::setCullMode(CullMode face)
This property tells the current status of the OpenGL shader program.
\list
- \o ShaderEffect.Compiled - the shader program was successfully compiled and linked.
- \o ShaderEffect.Uncompiled - the shader program has not yet been compiled.
- \o ShaderEffect.Error - the shader program failed to compile or link.
+ \li ShaderEffect.Compiled - the shader program was successfully compiled and linked.
+ \li ShaderEffect.Uncompiled - the shader program has not yet been compiled.
+ \li ShaderEffect.Error - the shader program failed to compile or link.
\endlist
When setting the fragment or vertex shader source code, the status will become Uncompiled.
diff --git a/src/quick/items/qquickshadereffectmesh.cpp b/src/quick/items/qquickshadereffectmesh.cpp
index eff5910a09..582e1ce92f 100644
--- a/src/quick/items/qquickshadereffectmesh.cpp
+++ b/src/quick/items/qquickshadereffectmesh.cpp
@@ -169,8 +169,8 @@ QSGGeometry *QQuickGridMesh::updateGeometry(QSGGeometry *geometry, const QVector
resolution higher.
\row
- \o \image declarative-gridmesh.png
- \o \qml
+ \li \image declarative-gridmesh.png
+ \li \qml
import QtQuick 2.0
ShaderEffect {
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index 708d75d137..33776be712 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -413,21 +413,21 @@ QImage QQuickShaderEffectTexture::toImage() const
ShaderEffectSource can be used as:
\list
- \o a texture source in a \l ShaderEffect.
+ \li a texture source in a \l ShaderEffect.
This allows you to apply custom shader effects to any QML element.
- \o a cache for a complex element.
+ \li a cache for a complex element.
The complex element can be rendered once into the texture, which can
then be animated freely without the need to render the complex element
again every frame.
- \o an opacity layer.
+ \li an opacity layer.
ShaderEffectSource allows you to apply an opacity to elements as a group
rather than each element individually.
\endlist
\table
\row
- \o \image declarative-shadereffectsource.png
- \o \qml
+ \li \image declarative-shadereffectsource.png
+ \li \qml
import QtQuick 2.0
Rectangle {
@@ -548,10 +548,10 @@ QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const
source texture of a \l ShaderEffect.
\list
- \o ShaderEffectSource.ClampToEdge - GL_CLAMP_TO_EDGE both horizontally and vertically
- \o ShaderEffectSource.RepeatHorizontally - GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically
- \o ShaderEffectSource.RepeatVertically - GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically
- \o ShaderEffectSource.Repeat - GL_REPEAT both horizontally and vertically
+ \li ShaderEffectSource.ClampToEdge - GL_CLAMP_TO_EDGE both horizontally and vertically
+ \li ShaderEffectSource.RepeatHorizontally - GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically
+ \li ShaderEffectSource.RepeatVertically - GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically
+ \li ShaderEffectSource.Repeat - GL_REPEAT both horizontally and vertically
\endlist
\note Some OpenGL ES 2 implementations do not support the GL_REPEAT
@@ -677,9 +677,9 @@ void QQuickShaderEffectSource::setTextureSize(const QSize &size)
implementation, this property might allow you to save some texture memory.
\list
- \o ShaderEffectSource.Alpha - GL_ALPHA
- \o ShaderEffectSource.RGB - GL_RGB
- \o ShaderEffectSource.RGBA - GL_RGBA
+ \li ShaderEffectSource.Alpha - GL_ALPHA
+ \li ShaderEffectSource.RGB - GL_RGB
+ \li ShaderEffectSource.RGBA - GL_RGBA
\endlist
\note Some OpenGL implementations do not support the GL_ALPHA format.
diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp
index 668c7c07d7..a6a4e31aba 100644
--- a/src/quick/items/qquickstateoperations.cpp
+++ b/src/quick/items/qquickstateoperations.cpp
@@ -318,7 +318,7 @@ QQuickStateOperation::ActionList QQuickParentChange::actions()
newBinding->setTarget(property);
QQuickAction xa;
xa.property = property;
- xa.toBinding = newBinding;
+ xa.toBinding = QQmlAbstractBinding::getPointer(newBinding);
xa.fromValue = xa.property.read();
xa.deletableToBinding = true;
actions << xa;
@@ -338,7 +338,7 @@ QQuickStateOperation::ActionList QQuickParentChange::actions()
newBinding->setTarget(property);
QQuickAction ya;
ya.property = property;
- ya.toBinding = newBinding;
+ ya.toBinding = QQmlAbstractBinding::getPointer(newBinding);
ya.fromValue = ya.property.read();
ya.deletableToBinding = true;
actions << ya;
@@ -358,7 +358,7 @@ QQuickStateOperation::ActionList QQuickParentChange::actions()
newBinding->setTarget(property);
QQuickAction sa;
sa.property = property;
- sa.toBinding = newBinding;
+ sa.toBinding = QQmlAbstractBinding::getPointer(newBinding);
sa.fromValue = sa.property.read();
sa.deletableToBinding = true;
actions << sa;
@@ -378,7 +378,7 @@ QQuickStateOperation::ActionList QQuickParentChange::actions()
newBinding->setTarget(property);
QQuickAction ra;
ra.property = property;
- ra.toBinding = newBinding;
+ ra.toBinding = QQmlAbstractBinding::getPointer(newBinding);
ra.fromValue = ra.property.read();
ra.deletableToBinding = true;
actions << ra;
@@ -398,7 +398,7 @@ QQuickStateOperation::ActionList QQuickParentChange::actions()
newBinding->setTarget(property);
QQuickAction wa;
wa.property = property;
- wa.toBinding = newBinding;
+ wa.toBinding = QQmlAbstractBinding::getPointer(newBinding);
wa.fromValue = wa.property.read();
wa.deletableToBinding = true;
actions << wa;
@@ -418,7 +418,7 @@ QQuickStateOperation::ActionList QQuickParentChange::actions()
newBinding->setTarget(property);
QQuickAction ha;
ha.property = property;
- ha.toBinding = newBinding;
+ ha.toBinding = QQmlAbstractBinding::getPointer(newBinding);
ha.fromValue = ha.property.read();
ha.deletableToBinding = true;
actions << ha;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 36b902ff8c..9f22dfdd08 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -1176,11 +1176,11 @@ QQuickText::~QQuickText()
The properties of a line are:
\list
- \o number (read-only)
- \o x
- \o y
- \o width
- \o height
+ \li number (read-only)
+ \li x
+ \li y
+ \li width
+ \li height
\endlist
For example, this will move the first 5 lines of a text element by 100 pixels to the right:
@@ -1233,11 +1233,11 @@ QQuickText::~QQuickText()
The weight can be one of:
\list
- \o Font.Light
- \o Font.Normal - the default
- \o Font.DemiBold
- \o Font.Bold
- \o Font.Black
+ \li Font.Light
+ \li Font.Normal - the default
+ \li Font.DemiBold
+ \li Font.Bold
+ \li Font.Black
\endlist
\qml
@@ -1303,11 +1303,11 @@ QQuickText::~QQuickText()
Sets the capitalization for the text.
\list
- \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
- \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
- \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
- \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
- \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \li Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \li Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \li Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
\endlist
\qml
@@ -1464,10 +1464,10 @@ void QQuickText::setLinkColor(const QColor &color)
Supported text styles are:
\list
- \o Text.Normal - the default
- \o Text.Outline
- \o Text.Raised
- \o Text.Sunken
+ \li Text.Normal - the default
+ \li Text.Outline
+ \li Text.Raised
+ \li Text.Sunken
\endlist
\qml
@@ -1661,10 +1661,10 @@ void QQuickText::setVAlign(VAlignment align)
wrap if an explicit width has been set. wrapMode can be one of:
\list
- \o Text.NoWrap (default) - no wrapping will be performed. If the text contains insufficient newlines, then \l contentWidth will exceed a set width.
- \o Text.WordWrap - wrapping is done on word boundaries only. If a word is too long, \l contentWidth will exceed a set width.
- \o Text.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
- \o Text.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
+ \li Text.NoWrap (default) - no wrapping will be performed. If the text contains insufficient newlines, then \l contentWidth will exceed a set width.
+ \li Text.WordWrap - wrapping is done on word boundaries only. If a word is too long, \l contentWidth will exceed a set width.
+ \li Text.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
+ \li Text.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
\endlist
*/
QQuickText::WrapMode QQuickText::wrapMode() const
@@ -1763,10 +1763,10 @@ void QQuickText::resetMaximumLineCount()
Supported text formats are:
\list
- \o Text.AutoText (default)
- \o Text.PlainText
- \o Text.StyledText
- \o Text.RichText
+ \li Text.AutoText (default)
+ \li Text.PlainText
+ \li Text.StyledText
+ \li Text.RichText
\endlist
If the text format is \c Text.AutoText the text element
@@ -1800,7 +1800,7 @@ void QQuickText::resetMaximumLineCount()
\table
\row
- \o
+ \li
\qml
Column {
Text {
@@ -1819,7 +1819,7 @@ Column {
}
}
\endqml
- \o \image declarative-textformat.png
+ \li \image declarative-textformat.png
\endtable
*/
QQuickText::TextFormat QQuickText::textFormat() const
@@ -1863,10 +1863,10 @@ void QQuickText::setTextFormat(TextFormat format)
Eliding can be:
\list
- \o Text.ElideNone - the default
- \o Text.ElideLeft
- \o Text.ElideMiddle
- \o Text.ElideRight
+ \li Text.ElideNone - the default
+ \li Text.ElideLeft
+ \li Text.ElideMiddle
+ \li Text.ElideRight
\endlist
If this property is set to Text.ElideRight, it can be used with \l {wrapMode}{wrapped}
@@ -1908,14 +1908,14 @@ void QQuickText::setElideMode(QQuickText::TextElideMode mode)
URL meaning any portion of the path after the last '/' will be ignored.
\table
- \header \o Base URL \o Relative URL \o Resolved URL
- \row \o http://qt-project.org/ \o images/logo.png \o http://qt-project.org/images/logo.png
- \row \o http://qt-project.org/index.html \o images/logo.png \o http://qt-project.org/images/logo.png
- \row \o http://qt-project.org/content \o images/logo.png \o http://qt-project.org/content/images/logo.png
- \row \o http://qt-project.org/content/ \o images/logo.png \o http://qt-project.org/content/images/logo.png
- \row \o http://qt-project.org/content/index.html \o images/logo.png \o http://qt-project.org/content/images/logo.png
- \row \o http://qt-project.org/content/index.html \o ../images/logo.png \o http://qt-project.org/images/logo.png
- \row \o http://qt-project.org/content/index.html \o /images/logo.png \o http://qt-project.org/images/logo.png
+ \header \li Base URL \li Relative URL \li Resolved URL
+ \row \li http://qt-project.org/ \li images/logo.png \li http://qt-project.org/images/logo.png
+ \row \li http://qt-project.org/index.html \li images/logo.png \li http://qt-project.org/images/logo.png
+ \row \li http://qt-project.org/content \li images/logo.png \li http://qt-project.org/content/images/logo.png
+ \row \li http://qt-project.org/content/ \li images/logo.png \li http://qt-project.org/content/images/logo.png
+ \row \li http://qt-project.org/content/index.html \li images/logo.png \li http://qt-project.org/content/images/logo.png
+ \row \li http://qt-project.org/content/index.html \li ../images/logo.png \li http://qt-project.org/images/logo.png
+ \row \li http://qt-project.org/content/index.html \li /images/logo.png \li http://qt-project.org/images/logo.png
\endtable
By default is the url of the Text element.
@@ -2169,9 +2169,9 @@ void QQuickText::setLineHeight(qreal lineHeight)
The possible values are:
\list
- \o Text.ProportionalHeight (default) - this sets the spacing proportional to the
+ \li Text.ProportionalHeight (default) - this sets the spacing proportional to the
line (as a multiplier). For example, set to 2 for double spacing.
- \o Text.FixedHeight - this sets the line height to a fixed line height (in pixels).
+ \li Text.FixedHeight - this sets the line height to a fixed line height (in pixels).
\endlist
*/
QQuickText::LineHeightMode QQuickText::lineHeightMode() const
@@ -2199,13 +2199,13 @@ void QQuickText::setLineHeightMode(LineHeightMode mode)
The possible values are:
\list
- \o Text.FixedSize (default) - The size specified by \l font.pixelSize
+ \li Text.FixedSize (default) - The size specified by \l font.pixelSize
or \l font.pointSize is used.
- \o Text.HorizontalFit - The largest size up to the size specified that fits
+ \li Text.HorizontalFit - The largest size up to the size specified that fits
within the width of the item without wrapping is used.
- \o Text.VerticalFit - The largest size up to the size specified that fits
+ \li Text.VerticalFit - The largest size up to the size specified that fits
the height of the item is used.
- \o Text.Fit - The largest size up to the size specified the fits within the
+ \li Text.Fit - The largest size up to the size specified the fits within the
width and height of the item is used.
\endlist
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 3db5f5a7a3..5456d3523a 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -159,11 +159,11 @@ QString QQuickTextEdit::text() const
The weight can be one of:
\list
- \o Font.Light
- \o Font.Normal - the default
- \o Font.DemiBold
- \o Font.Bold
- \o Font.Black
+ \li Font.Light
+ \li Font.Normal - the default
+ \li Font.DemiBold
+ \li Font.Bold
+ \li Font.Black
\endlist
\qml
@@ -230,11 +230,11 @@ QString QQuickTextEdit::text() const
Sets the capitalization for the text.
\list
- \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
- \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
- \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
- \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
- \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \li Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \li Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \li Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
\endlist
\qml
@@ -274,9 +274,9 @@ void QQuickTextEdit::setText(const QString &text)
The way the text property should be displayed.
\list
- \o TextEdit.AutoText
- \o TextEdit.PlainText
- \o TextEdit.RichText
+ \li TextEdit.AutoText
+ \li TextEdit.PlainText
+ \li TextEdit.RichText
\endlist
The default is TextEdit.PlainText. If the text format is TextEdit.AutoText the text edit
@@ -285,7 +285,7 @@ void QQuickTextEdit::setText(const QString &text)
\table
\row
- \o
+ \li
\qml
Column {
TextEdit {
@@ -304,7 +304,7 @@ Column {
}
}
\endqml
- \o \image declarative-textformat.png
+ \li \image declarative-textformat.png
\endtable
*/
QQuickTextEdit::TextFormat QQuickTextEdit::textFormat() const
@@ -459,17 +459,17 @@ void QQuickTextEdit::setSelectedTextColor(const QColor &color)
Valid values for \c horizontalAlignment are:
\list
- \o TextEdit.AlignLeft (default)
- \o TextEdit.AlignRight
- \o TextEdit.AlignHCenter
- \o TextEdit.AlignJustify
+ \li TextEdit.AlignLeft (default)
+ \li TextEdit.AlignRight
+ \li TextEdit.AlignHCenter
+ \li TextEdit.AlignJustify
\endlist
Valid values for \c verticalAlignment are:
\list
- \o TextEdit.AlignTop (default)
- \o TextEdit.AlignBottom
- \o TextEdit.AlignVCenter
+ \li TextEdit.AlignTop (default)
+ \li TextEdit.AlignBottom
+ \li TextEdit.AlignVCenter
\endlist
When using the attached property LayoutMirroring::enabled to mirror application
@@ -591,10 +591,10 @@ void QQuickTextEdit::setVAlign(QQuickTextEdit::VAlignment alignment)
The text will only wrap if an explicit width has been set.
\list
- \o TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.
- \o TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.
- \o TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
- \o TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
+ \li TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.
+ \li TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.
+ \li TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
+ \li TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
\endlist
The default is TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap.
@@ -770,9 +770,9 @@ int QQuickTextEdit::positionAt(qreal x, qreal y) const
basis. If not specified the selection mode will default to TextEdit.SelectCharacters.
\list
- \o TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
+ \li TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
the previous cursor position) to the specified position.
- \o TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all
+ \li TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all
words between the specified position and the previous cursor position. Words partially in the
range are included.
\endlist
@@ -1089,36 +1089,36 @@ void QQuickTextEdit::setTextMargin(qreal margin)
Flags that alter behaviour are:
\list
- \o Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
- \o Qt.ImhSensitiveData - Typed text should not be stored by the active input method
+ \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
+ \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method
in any persistent storage like predictive user dictionary.
- \o Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
+ \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
when a sentence ends.
- \o Qt.ImhPreferNumbers - Numbers are preferred (but not required).
- \o Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).
- \o Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).
- \o Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing.
+ \li Qt.ImhPreferNumbers - Numbers are preferred (but not required).
+ \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).
+ \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).
+ \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing.
- \o Qt.ImhDate - The text editor functions as a date field.
- \o Qt.ImhTime - The text editor functions as a time field.
+ \li Qt.ImhDate - The text editor functions as a date field.
+ \li Qt.ImhTime - The text editor functions as a time field.
\endlist
Flags that restrict input (exclusive flags) are:
\list
- \o Qt.ImhDigitsOnly - Only digits are allowed.
- \o Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
- \o Qt.ImhUppercaseOnly - Only upper case letter input is allowed.
- \o Qt.ImhLowercaseOnly - Only lower case letter input is allowed.
- \o Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
- \o Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
- \o Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
+ \li Qt.ImhDigitsOnly - Only digits are allowed.
+ \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
+ \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed.
+ \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed.
+ \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
+ \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
+ \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
\endlist
Masks:
\list
- \o Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
+ \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
\endlist
*/
@@ -1203,8 +1203,8 @@ void QQuickTextEdit::setSelectByMouse(bool on)
Specifies how text should be selected using a mouse.
\list
- \o TextEdit.SelectCharacters - The selection is updated with individual characters. (Default)
- \o TextEdit.SelectWords - The selection is updated with whole words.
+ \li TextEdit.SelectCharacters - The selection is updated with individual characters. (Default)
+ \li TextEdit.SelectWords - The selection is updated with whole words.
\endlist
This property only applies when \l selectByMouse is true.
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 1a93345aa2..0b21d6b169 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -201,11 +201,11 @@ QString QQuickTextInputPrivate::realText() const
The weight can be one of:
\list
- \o Font.Light
- \o Font.Normal - the default
- \o Font.DemiBold
- \o Font.Bold
- \o Font.Black
+ \li Font.Light
+ \li Font.Normal - the default
+ \li Font.DemiBold
+ \li Font.Bold
+ \li Font.Black
\endlist
\qml
@@ -271,11 +271,11 @@ QString QQuickTextInputPrivate::realText() const
Sets the capitalization for the text.
\list
- \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
- \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
- \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
- \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
- \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \li Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \li Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \li Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
\endlist
\qml
@@ -512,10 +512,10 @@ void QQuickTextInput::setVAlign(QQuickTextInput::VAlignment alignment)
The text will only wrap if an explicit width has been set.
\list
- \o TextInput.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.
- \o TextInput.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.
- \o TextInput.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
- \o TextInput.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
+ \li TextInput.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.
+ \li TextInput.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.
+ \li TextInput.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
+ \li TextInput.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
\endlist
The default is TextInput.NoWrap. If you set a width, consider using TextInput.Wrap.
@@ -958,8 +958,8 @@ void QQuickDoubleValidator::resetLocaleName()
The possible values for this property are:
\list
- \o DoubleValidator.StandardNotation
- \o DoubleValidator.ScientificNotation (default)
+ \li DoubleValidator.StandardNotation
+ \li DoubleValidator.ScientificNotation (default)
\endlist
If this property is set to DoubleValidator.ScientificNotation, the written number may have an exponent part (e.g. 1.5E-2).
@@ -1110,10 +1110,10 @@ Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const
Specifies how the text should be displayed in the TextInput.
\list
- \o TextInput.Normal - Displays the text as it is. (Default)
- \o TextInput.Password - Displays asterisks instead of characters.
- \o TextInput.NoEcho - Displays nothing.
- \o TextInput.PasswordEchoOnEdit - Displays characters as they are entered
+ \li TextInput.Normal - Displays the text as it is. (Default)
+ \li TextInput.Password - Displays asterisks instead of characters.
+ \li TextInput.NoEcho - Displays nothing.
+ \li TextInput.PasswordEchoOnEdit - Displays characters as they are entered
while editing, otherwise displays asterisks.
\endlist
*/
@@ -1149,37 +1149,37 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo)
Flags that alter behaviour are:
\list
- \o Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
+ \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
This is automatically set when setting echoMode to \c TextInput.Password.
- \o Qt.ImhSensitiveData - Typed text should not be stored by the active input method
+ \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method
in any persistent storage like predictive user dictionary.
- \o Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
+ \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
when a sentence ends.
- \o Qt.ImhPreferNumbers - Numbers are preferred (but not required).
- \o Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).
- \o Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).
- \o Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing.
+ \li Qt.ImhPreferNumbers - Numbers are preferred (but not required).
+ \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).
+ \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).
+ \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing.
- \o Qt.ImhDate - The text editor functions as a date field.
- \o Qt.ImhTime - The text editor functions as a time field.
+ \li Qt.ImhDate - The text editor functions as a date field.
+ \li Qt.ImhTime - The text editor functions as a time field.
\endlist
Flags that restrict input (exclusive flags) are:
\list
- \o Qt.ImhDigitsOnly - Only digits are allowed.
- \o Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
- \o Qt.ImhUppercaseOnly - Only upper case letter input is allowed.
- \o Qt.ImhLowercaseOnly - Only lower case letter input is allowed.
- \o Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
- \o Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
- \o Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
+ \li Qt.ImhDigitsOnly - Only digits are allowed.
+ \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
+ \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed.
+ \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed.
+ \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
+ \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
+ \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
\endlist
Masks:
\list
- \o Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
+ \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
\endlist
*/
@@ -1323,8 +1323,8 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const
The cursor position type specifies how the cursor position should be resolved.
\list
- \o TextInput.CursorBetweenCharacters - Returns the position between characters that is nearest x.
- \o TextInput.CursorOnCharacter - Returns the position before the character that is nearest x.
+ \li TextInput.CursorBetweenCharacters - Returns the position between characters that is nearest x.
+ \li TextInput.CursorOnCharacter - Returns the position before the character that is nearest x.
\endlist
*/
@@ -2161,8 +2161,8 @@ void QQuickTextInput::setSelectByMouse(bool on)
Specifies how text should be selected using a mouse.
\list
- \o TextInput.SelectCharacters - The selection is updated with individual characters. (Default)
- \o TextInput.SelectWords - The selection is updated with whole words.
+ \li TextInput.SelectCharacters - The selection is updated with individual characters. (Default)
+ \li TextInput.SelectWords - The selection is updated with whole words.
\endlist
This property only applies when \l selectByMouse is true.
@@ -2295,9 +2295,9 @@ void QQuickTextInput::moveCursorSelection(int position)
basis. If not specified the selection mode will default to TextInput.SelectCharacters.
\list
- \o TextInput.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
+ \li TextInput.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
the previous cursor position) to the specified position.
- \o TextInput.SelectWords - Sets the selectionStart and selectionEnd to include all
+ \li TextInput.SelectWords - Sets the selectionStart and selectionEnd to include all
words between the specified position and the previous cursor position. Words partially in the
range are included.
\endlist
@@ -2930,19 +2930,6 @@ void QQuickTextInputPrivate::setSelection(int start, int length)
/*!
\internal
- Initializes the line control with a starting text value of \a txt.
-*/
-void QQuickTextInputPrivate::init(const QString &txt)
-{
- m_text = txt;
-
- updateDisplayText();
- m_cursor = m_text.length();
-}
-
-/*!
- \internal
-
Sets the password echo editing to \a editing. If password echo editing
is true, then the text of the password is displayed even if the echo
mode is set to QLineEdit::PasswordEchoOnEdit. Password echoing editing
@@ -3274,12 +3261,7 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e
m_textDirty = (oldText != m_text);
bool changed = finishChange(-1, true, edited);
-#ifdef QT_NO_ACCESSIBILITY
Q_UNUSED(changed)
-#else
- if (changed)
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextUpdated, q, 0));
-#endif
}
@@ -3903,10 +3885,6 @@ bool QQuickTextInputPrivate::emitCursorPositionChanged()
}
}
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextCaretMoved, q, 0));
-#endif
-
return true;
}
return false;
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 9a59b44549..bb00600661 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -405,7 +405,6 @@ public:
void updateLayout();
private:
- void init(const QString &txt);
void removeSelectedText();
void internalSetText(const QString &txt, int pos = -1, bool edited = true);
void updateDisplayText(bool forceUpdate = false);
diff --git a/src/quick/items/qquickvisualadaptormodel.cpp b/src/quick/items/qquickvisualadaptormodel.cpp
index fb85810984..622adf4ce9 100644
--- a/src/quick/items/qquickvisualadaptormodel.cpp
+++ b/src/quick/items/qquickvisualadaptormodel.cpp
@@ -173,7 +173,7 @@ public:
VDMDelegateDataType *m_delegateDataType;
CreateModelData createItem;
StringValue stringValue;
- v8::Persistent<v8::Function> m_constructor;
+ v8::Persistent<v8::ObjectTemplate> m_constructor;
int m_ref;
int m_count;
@@ -716,9 +716,9 @@ void QQuickVisualAdaptorModelPrivate::createMetaObject()
v8::HandleScope handleScope;
v8::Context::Scope contextScope(v8Engine->context());
- v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New();
- ft->InstanceTemplate()->SetHasExternalResource(true);
- ft->PrototypeTemplate()->SetAccessor(
+ v8::Local<v8::ObjectTemplate> constructor = v8::ObjectTemplate::New();
+ constructor->SetHasExternalResource(true);
+ constructor->SetAccessor(
v8::String::New("index"), QQuickVisualDataModelItemMetaObject::get_index);
if (m_listAccessor
@@ -726,9 +726,9 @@ void QQuickVisualAdaptorModelPrivate::createMetaObject()
&& m_listAccessor->type() != QQuickListAccessor::Instance) {
createItem = &QQuickVDMListAccessorData::create;
stringValue = &QQuickVDMListAccessorData::stringValue;
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
v8::String::New("modelData"), QQuickVDMListAccessorData::get_modelData);
- m_constructor = qPersistentNew<v8::Function>(ft->GetFunction());
+ m_constructor = qPersistentNew(constructor);
return;
}
@@ -741,7 +741,7 @@ void QQuickVisualAdaptorModelPrivate::createMetaObject()
const QString roleName = m_listModelInterface->toString(role);
const QByteArray propertyName = roleName.toUtf8();
addProperty(role, propertyId, propertyName, "QVariant");
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
v8Engine->toString(roleName),
QQuickVDMListModelInterfaceData::get_property,
QQuickVDMListModelInterfaceData::set_property,
@@ -751,7 +751,7 @@ void QQuickVisualAdaptorModelPrivate::createMetaObject()
m_roleCount = m_propertyData.count();
if (m_propertyData.count() == 1) {
addProperty(roles.first(), 1, "modelData", "QVariant", true);
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
v8::String::New("modelData"),
QQuickVDMListModelInterfaceData::get_property,
QQuickVDMListModelInterfaceData::set_property,
@@ -764,7 +764,7 @@ void QQuickVisualAdaptorModelPrivate::createMetaObject()
for (QHash<int, QByteArray>::const_iterator it = roleNames.begin(); it != roleNames.end(); ++it) {
const int propertyId = m_propertyData.count();
addProperty(it.key(), propertyId, it.value(), "QVariant");
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
v8::String::New(it.value().constData(), it.value().length()),
QQuickVDMAbstractItemModelData::get_property,
QQuickVDMAbstractItemModelData::set_property,
@@ -774,14 +774,14 @@ void QQuickVisualAdaptorModelPrivate::createMetaObject()
m_roleCount = m_propertyData.count();
if (m_propertyData.count() == 1) {
addProperty(roleNames.begin().key(), 1, "modelData", "QVariant", true);
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
v8::String::New("modelData"),
QQuickVDMAbstractItemModelData::get_property,
QQuickVDMAbstractItemModelData::set_property,
v8::Int32::New(0));
m_roleNames.insert("modelData", roleNames.begin().key());
}
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
v8::String::New("hasModelChildren"),
QQuickVDMAbstractItemModelData::get_hasModelChildren);
} else if (m_listAccessor) {
@@ -796,7 +796,7 @@ void QQuickVisualAdaptorModelPrivate::createMetaObject()
if (!m_objectList) {
m_delegateDataType->propertyCache = new QQmlPropertyCache(
m_engine, m_delegateDataType->metaObject);
- m_constructor = qPersistentNew<v8::Function>(ft->GetFunction());
+ m_constructor = qPersistentNew(constructor);
}
}
diff --git a/src/quick/items/qquickvisualdatamodel.cpp b/src/quick/items/qquickvisualdatamodel.cpp
index 70f8897b2d..88d46c60ee 100644
--- a/src/quick/items/qquickvisualdatamodel.cpp
+++ b/src/quick/items/qquickvisualdatamodel.cpp
@@ -1306,11 +1306,13 @@ QQuickVisualDataModelItemMetaType::QQuickVisualDataModelItemMetaType(
v8::HandleScope handleScope;
v8::Context::Scope contextScope(engine->context());
- v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New();
- ft->InstanceTemplate()->SetHasExternalResource(true);
- ft->PrototypeTemplate()->SetAccessor(v8::String::New("model"), get_model);
- ft->PrototypeTemplate()->SetAccessor(v8::String::New("groups"), get_groups, set_groups);
- ft->PrototypeTemplate()->SetAccessor(v8::String::New("isUnresolved"), get_member, 0, v8::Int32::New(30));
+
+ constructor = qPersistentNew(v8::ObjectTemplate::New());
+
+ constructor->SetHasExternalResource(true);
+ constructor->SetAccessor(v8::String::New("model"), get_model);
+ constructor->SetAccessor(v8::String::New("groups"), get_groups, set_groups);
+ constructor->SetAccessor(v8::String::New("isUnresolved"), get_member, 0, v8::Int32::New(30));
int notifierId = 0;
for (int i = 0; i < groupNames.count(); ++i, ++notifierId) {
@@ -1321,7 +1323,7 @@ QQuickVisualDataModelItemMetaType::QQuickVisualDataModelItemMetaType(
propertyName.toUtf8(), "bool", notifierId);
propertyBuilder.setWritable(true);
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
engine->toString(propertyName), get_member, set_member, v8::Int32::New(i + 1));
}
for (int i = 0; i < groupNames.count(); ++i, ++notifierId) {
@@ -1331,13 +1333,11 @@ QQuickVisualDataModelItemMetaType::QQuickVisualDataModelItemMetaType(
propertyName.toUtf8(), "int", notifierId);
propertyBuilder.setWritable(true);
- ft->PrototypeTemplate()->SetAccessor(
+ constructor->SetAccessor(
engine->toString(propertyName), get_index, 0, v8::Int32::New(i + 1));
}
metaObject = builder.toMetaObject();
-
- constructor = qPersistentNew<v8::Function>(ft->GetFunction());
}
QQuickVisualDataModelItemMetaType::~QQuickVisualDataModelItemMetaType()
@@ -1891,16 +1891,16 @@ void QQuickVisualDataGroup::setDefaultInclude(bool include)
VisualDataModel attached as well as the model for that item. It has the properties:
\list
- \o \b model The model data of the item. This is the same as the model context property in
+ \li \b model The model data of the item. This is the same as the model context property in
a delegate
- \o \b groups A list the of names of groups the item is a member of. This property can be
+ \li \b groups A list the of names of groups the item is a member of. This property can be
written to change the item's membership.
- \o \b inItems Whether the item belongs to the \l {QtQuick2::VisualDataModel::items}{items} group.
+ \li \b inItems Whether the item belongs to the \l {QtQuick2::VisualDataModel::items}{items} group.
Writing to this property will add or remove the item from the group.
- \o \b itemsIndex The index of the item within the \l {QtQuick2::VisualDataModel::items}{items} group.
- \o \b {in\i{GroupName}} Whether the item belongs to the dynamic group \i groupName. Writing to
+ \li \b itemsIndex The index of the item within the \l {QtQuick2::VisualDataModel::items}{items} group.
+ \li \b {in\e{GroupName}} Whether the item belongs to the dynamic group \e groupName. Writing to
this property will add or remove the item from the group.
- \o \b {\i{groupName}Index} The index of the item within the dynamic group \i groupName.
+ \li \b {\e{groupName}Index} The index of the item within the dynamic group \e groupName.
\endlist
*/
diff --git a/src/quick/items/qquickvisualdatamodel_p_p.h b/src/quick/items/qquickvisualdatamodel_p_p.h
index c53ed5bdbb..c2db04511d 100644
--- a/src/quick/items/qquickvisualdatamodel_p_p.h
+++ b/src/quick/items/qquickvisualdatamodel_p_p.h
@@ -92,7 +92,7 @@ public:
QV8Engine * const v8Engine;
QMetaObject *metaObject;
const QStringList groupNames;
- v8::Persistent<v8::Function> constructor;
+ v8::Persistent<v8::ObjectTemplate> constructor;
};
class QQuickVisualAdaptorModel;
diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp
index 12c5dbd932..64eb2bf53b 100644
--- a/src/quick/items/qquickwindowmanager.cpp
+++ b/src/quick/items/qquickwindowmanager.cpp
@@ -107,11 +107,6 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_
lock. This variable is an integer to allow for recursive calls to lockInGui()
without using a recursive mutex. See isPostingSyncEvent.
- RenderThread::isPaintComplete: This variable is cleared when rendering starts and
- set once rendering is complete. It is monitored in the paintEvent(),
- resizeEvent() and grab() functions to force them to wait for rendering to
- complete.
-
RenderThread::isPostingSyncEvent: This variable is set in the render thread just
before the sync event is sent to the GUI thread. It is used to avoid deadlocks
in the case where render thread waits while waiting for GUI to pick up the sync
@@ -160,7 +155,6 @@ public:
, allowMainThreadProcessingFlag(false)
, isGuiLocked(0)
, animationRunning(false)
- , isPaintCompleted(false)
, isPostingSyncEvent(false)
, isRenderBlocked(false)
, isExternalUpdatePending(false)
@@ -248,7 +242,6 @@ private:
int isGuiLocked;
uint animationRunning: 1;
- uint isPaintCompleted : 1;
uint isPostingSyncEvent : 1;
uint isRenderBlocked : 1;
uint isExternalUpdatePending : 1;
@@ -723,8 +716,6 @@ void QQuickRenderThreadSingleContextWindowManager::run()
handleRemovedWindows();
- isPaintCompleted = true;
-
// Update sizes...
for (QHash<QQuickCanvas *, CanvasData *>::const_iterator it = m_rendered_windows.constBegin();
it != m_rendered_windows.constEnd(); ++it) {
@@ -1077,8 +1068,7 @@ QImage QQuickRenderThreadSingleContextWindowManager::grab(QQuickCanvas *canvas)
exhaustSyncEvent();
canvasToGrab = canvas;
- isPaintCompleted = false;
- while (isRunning() && !isPaintCompleted) {
+ while (isRunning() && canvasToGrab) {
if (isRenderBlocked)
wake();
wait();
diff --git a/src/quick/particles/qquickimageparticle.cpp b/src/quick/particles/qquickimageparticle.cpp
index ae1688b94d..386892a12a 100644
--- a/src/quick/particles/qquickimageparticle.cpp
+++ b/src/quick/particles/qquickimageparticle.cpp
@@ -591,10 +591,10 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size)
This element renders a logical particle as an image. The image can be
\list
- \o colorized
- \o rotated
- \o deformed
- \o a sprite-based animation
+ \li colorized
+ \li rotated
+ \li deformed
+ \li a sprite-based animation
\endlist
ImageParticles implictly share data on particles if multiple ImageParticles are painting
@@ -770,9 +770,9 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size)
Acceptable values are
\list
- \o ImageParticle.None: Particles just appear and disappear.
- \o ImageParticle.Fade: Particles fade in from 0 opacity at the start of their life, and fade out to 0 at the end.
- \o ImageParticle.Scale: Particles scale in from 0 size at the start of their life, and scale back to 0 at the end.
+ \li ImageParticle.None: Particles just appear and disappear.
+ \li ImageParticle.Fade: Particles fade in from 0 opacity at the start of their life, and fade out to 0 at the end.
+ \li ImageParticle.Scale: Particles scale in from 0 size at the start of their life, and scale back to 0 at the end.
\endlist
Default value is Fade.
diff --git a/src/quick/particles/qquickpointattractor.cpp b/src/quick/particles/qquickpointattractor.cpp
index 7cb8c32671..a54ee41c1e 100644
--- a/src/quick/particles/qquickpointattractor.cpp
+++ b/src/quick/particles/qquickpointattractor.cpp
@@ -85,9 +85,9 @@ QT_BEGIN_NAMESPACE
What attribute of particles is directly affected.
\list
- \o Attractor.Position
- \o Attractor.Velocity
- \o Attractor.Acceleration
+ \li Attractor.Position
+ \li Attractor.Velocity
+ \li Attractor.Acceleration
\endlist
*/
/*!
@@ -96,11 +96,11 @@ QT_BEGIN_NAMESPACE
How the distance from the particle to the point affects the strength of the attraction.
\list
- \o Attractor.Constant
- \o Attractor.Linear
- \o Attractor.InverseLinear
- \o Attractor.Quadratic
- \o Attractor.InverseQuadratic
+ \li Attractor.Constant
+ \li Attractor.Linear
+ \li Attractor.InverseLinear
+ \li Attractor.Quadratic
+ \li Attractor.InverseQuadratic
\endlist
*/
diff --git a/src/quick/particles/qquickwander.cpp b/src/quick/particles/qquickwander.cpp
index 3e7cf33a64..0f9a5f069b 100644
--- a/src/quick/particles/qquickwander.cpp
+++ b/src/quick/particles/qquickwander.cpp
@@ -73,9 +73,9 @@ QT_BEGIN_NAMESPACE
What attribute of particles is directly affected.
\list
- \o PointAttractor.Position
- \o PointAttractor.Velocity
- \o PointAttractor.Acceleration
+ \li PointAttractor.Position
+ \li PointAttractor.Velocity
+ \li PointAttractor.Acceleration
\endlist
*/
diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp
index 621c3ff18e..a97dade106 100644
--- a/src/quick/qtquick2.cpp
+++ b/src/quick/qtquick2.cpp
@@ -63,7 +63,7 @@ class QQmlQtQuick2DebugStatesDelegate : public QQmlDebugStatesDelegate
public:
QQmlQtQuick2DebugStatesDelegate();
virtual ~QQmlQtQuick2DebugStatesDelegate();
- virtual void buildStatesList(QQmlContext *ctxt, bool cleanList);
+ virtual void buildStatesList(bool cleanList, const QList<QPointer<QObject> > &instances);
virtual void updateBinding(QQmlContext *context,
const QQmlProperty &property,
const QVariant &expression, bool isLiteralValue,
@@ -90,20 +90,15 @@ QQmlQtQuick2DebugStatesDelegate::~QQmlQtQuick2DebugStatesDelegate()
{
}
-void QQmlQtQuick2DebugStatesDelegate::buildStatesList(QQmlContext *ctxt, bool cleanList)
+void QQmlQtQuick2DebugStatesDelegate::buildStatesList(bool cleanList,
+ const QList<QPointer<QObject> > &instances)
{
if (cleanList)
m_allStates.clear();
- QQmlContextPrivate *ctxtPriv = QQmlContextPrivate::get(ctxt);
- for (int ii = 0; ii < ctxtPriv->instances.count(); ++ii) {
- buildStatesList(ctxtPriv->instances.at(ii));
- }
-
- QQmlContextData *child = QQmlContextData::get(ctxt)->childContexts;
- while (child) {
- buildStatesList(child->asQQmlContext());
- child = child->nextChild;
+ //only root context has all instances
+ for (int ii = 0; ii < instances.count(); ++ii) {
+ buildStatesList(instances.at(ii));
}
}
@@ -135,10 +130,11 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context,
QQmlBinding *newBinding = 0;
if (!isLiteralValue) {
- newBinding = new QQmlBinding(expression.toString(), object, context);
+ newBinding = new QQmlBinding(expression.toString(), false, object,
+ QQmlContextData::get(context), fileName,
+ line, column);
newBinding->setTarget(property);
newBinding->setNotifyOnValueChanged(true);
- newBinding->setSourceLocation(fileName, line, column);
}
state->changeBindingInRevertList(object, propertyName, newBinding);
diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.cpp b/src/quick/scenegraph/coreapi/qsgrendernode.cpp
index ee9fd9fbbb..8012af9cfc 100644
--- a/src/quick/scenegraph/coreapi/qsgrendernode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrendernode.cpp
@@ -63,14 +63,14 @@ void QSGRenderNode::setInheritedOpacity(qreal opacity)
This function should return a mask where each bit represents OpenGL states changed by
the \l render() function:
\list
- \o DepthState - depth write mask, depth test enabled, depth comparison function
- \o StencilState - stencil write masks, stencil test enabled, stencil operations,
+ \li DepthState - depth write mask, depth test enabled, depth comparison function
+ \li StencilState - stencil write masks, stencil test enabled, stencil operations,
stencil comparison functions
- \o ScissorState - scissor enabled, scissor test enabled
- \o ColorState - clear color, color write mask
- \o BlendState - blend enabled, blend function
- \o CullState - front face, cull face enabled
- \o ViewportState - viewport
+ \li ScissorState - scissor enabled, scissor test enabled
+ \li ColorState - clear color, color write mask
+ \li BlendState - blend enabled, blend function
+ \li CullState - front face, cull face enabled
+ \li ViewportState - viewport
\endlist
The function is called by the renderer so it can reset the OpenGL states after rendering this
@@ -96,17 +96,17 @@ void QSGRenderNode::setInheritedOpacity(qreal opacity)
The following states are set before this function is called:
\list
- \o glDepthMask(false)
- \o glDisable(GL_DEPTH_TEST)
- \o glStencilMask(0)
- \o glEnable(GL_STENCIL_TEST)/glDisable(GL_STENCIL_TEST) depending on clip
- \o glStencilFunc(GL_EQUAL, state.stencilValue, 0xff) depending on clip
- \o glEnable(GL_SCISSOR_TEST)/glDisable(GL_SCISSOR_TEST) depending on clip
- \o glScissor(state.scissorRect.x(), state.scissorRect.y(),
+ \li glDepthMask(false)
+ \li glDisable(GL_DEPTH_TEST)
+ \li glStencilMask(0)
+ \li glEnable(GL_STENCIL_TEST)/glDisable(GL_STENCIL_TEST) depending on clip
+ \li glStencilFunc(GL_EQUAL, state.stencilValue, 0xff) depending on clip
+ \li glEnable(GL_SCISSOR_TEST)/glDisable(GL_SCISSOR_TEST) depending on clip
+ \li glScissor(state.scissorRect.x(), state.scissorRect.y(),
state.scissorRect.width(), state.scissorRect.height()) depending on clip
- \o glEnable(GL_BLEND)
- \o glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
- \o glDisable(GL_CULL_FACE)
+ \li glEnable(GL_BLEND)
+ \li glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
+ \li glDisable(GL_CULL_FACE)
\endlist
States that are not listed above, but are included in \l StateFlags, can have arbitrary
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
index 05d076ec1e..5864f35060 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
@@ -62,6 +62,7 @@ QSGDefaultDistanceFieldGlyphCache::DistanceFieldTextureData *QSGDefaultDistanceF
QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font)
: QSGDistanceFieldGlyphCache(man, c, font)
, m_maxTextureSize(0)
+ , m_maxTextureCount(3)
{
m_textureData = textureData(c);
}
@@ -77,25 +78,32 @@ void QSGDefaultDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyph
if (cacheIsFull() && m_textureData->unusedGlyphs.isEmpty())
continue;
+ if (textureIsFull(m_textureData->currentTexture) && m_textureData->textures.count() < m_maxTextureCount)
+ m_textureData->currentTexture = m_textureData->addTexture();
+
m_textureData->unusedGlyphs.remove(glyphIndex);
+ DistanceFieldTextureData::TextureInfo *tex = m_textureData->currentTexture;
+
GlyphPosition p;
p.glyph = glyphIndex;
- p.position = QPointF(m_textureData->currX, m_textureData->currY);
+ p.position = QPointF(tex->currX, tex->currY);
if (!cacheIsFull()) {
- m_textureData->currX += QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution());
- if (m_textureData->currX >= maxTextureSize()) {
- m_textureData->currX = 0;
- m_textureData->currY += QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution());
+ tex->currX += QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution());
+ if (tex->currX >= maxTextureSize()) {
+ tex->currX = 0;
+ tex->currY += QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution());
}
} else {
// Recycle glyphs
if (!m_textureData->unusedGlyphs.isEmpty()) {
glyph_t unusedGlyph = *m_textureData->unusedGlyphs.constBegin();
TexCoord unusedCoord = glyphTexCoord(unusedGlyph);
+ tex = m_textureData->glyphsTexture.value(unusedGlyph);
p.position = QPointF(unusedCoord.x, unusedCoord.y);
m_textureData->unusedGlyphs.remove(unusedGlyph);
+ m_textureData->glyphsTexture.remove(unusedGlyph);
removeGlyph(unusedGlyph);
}
}
@@ -103,6 +111,7 @@ void QSGDefaultDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyph
if (p.position.y() < maxTextureSize()) {
glyphPositions.append(p);
glyphsToRender.append(glyphIndex);
+ m_textureData->glyphsTexture.insert(glyphIndex, tex);
}
}
@@ -114,41 +123,46 @@ void QSGDefaultDistanceFieldGlyphCache::storeGlyphs(const QHash<glyph_t, QImage>
{
int requiredWidth = maxTextureSize();
int rows = 128 / (requiredWidth / QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution())); // Enough rows to fill the latin1 set by default..
- int requiredHeight = qMin(maxTextureSize(),
- qMax(m_textureData->currY + QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution()),
- QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution()) * rows));
-
- resizeTexture((requiredWidth), (requiredHeight));
- glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
- QVector<glyph_t> glyphTextures;
+ QHash<DistanceFieldTextureData::TextureInfo *, QVector<glyph_t> > glyphTextures;
QHash<glyph_t, QImage>::const_iterator it;
for (it = glyphs.constBegin(); it != glyphs.constEnd(); ++it) {
glyph_t glyphIndex = it.key();
TexCoord c = glyphTexCoord(glyphIndex);
+ DistanceFieldTextureData::TextureInfo *texInfo = m_textureData->glyphsTexture.value(glyphIndex);
- glyphTextures.append(glyphIndex);
+ int requiredHeight = qMin(maxTextureSize(),
+ qMax(texInfo->currY + QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution()),
+ QT_DISTANCEFIELD_TILESIZE(doubleGlyphResolution()) * rows));
+
+ resizeTexture(texInfo, requiredWidth, requiredHeight);
+ glBindTexture(GL_TEXTURE_2D, texInfo->texture);
+
+ glyphTextures[texInfo].append(glyphIndex);
QImage glyph = it.value();
if (useWorkaroundBrokenFBOReadback()) {
uchar *inBits = glyph.scanLine(0);
- uchar *outBits = m_textureData->image.scanLine(int(c.y)) + int(c.x);
+ uchar *outBits = texInfo->image.scanLine(int(c.y)) + int(c.x);
for (int y = 0; y < glyph.height(); ++y) {
qMemCopy(outBits, inBits, glyph.width());
inBits += glyph.bytesPerLine();
- outBits += m_textureData->image.bytesPerLine();
+ outBits += texInfo->image.bytesPerLine();
}
}
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, glyph.width(), glyph.height(), GL_ALPHA, GL_UNSIGNED_BYTE, glyph.constBits());
}
- Texture t;
- t.textureId = m_textureData->texture;
- t.size = m_textureData->size;
- setGlyphsTexture(glyphTextures, t);
+ QHash<DistanceFieldTextureData::TextureInfo *, QVector<glyph_t> >::const_iterator i;
+ for (i = glyphTextures.constBegin(); i != glyphTextures.constEnd(); ++i) {
+ Texture t;
+ t.textureId = i.key()->texture;
+ t.size = i.key()->size;
+ setGlyphsTexture(i.value(), t);
+ }
}
void QSGDefaultDistanceFieldGlyphCache::referenceGlyphs(const QSet<glyph_t> &glyphs)
@@ -161,15 +175,15 @@ void QSGDefaultDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyph
m_textureData->unusedGlyphs += glyphs;
}
-void QSGDefaultDistanceFieldGlyphCache::createTexture(int width, int height)
+void QSGDefaultDistanceFieldGlyphCache::createTexture(DistanceFieldTextureData::TextureInfo *texInfo, int width, int height)
{
- if (useWorkaroundBrokenFBOReadback() && m_textureData->image.isNull())
- m_textureData->image = QImage(width, height, QImage::Format_Indexed8);
+ if (useWorkaroundBrokenFBOReadback() && texInfo->image.isNull())
+ texInfo->image = QImage(width, height, QImage::Format_Indexed8);
while (glGetError() != GL_NO_ERROR) { }
- glGenTextures(1, &m_textureData->texture);
- glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
+ glGenTextures(1, &texInfo->texture);
+ glBindTexture(GL_TEXTURE_2D, texInfo->texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -177,35 +191,35 @@ void QSGDefaultDistanceFieldGlyphCache::createTexture(int width, int height)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- m_textureData->size = QSize(width, height);
+ texInfo->size = QSize(width, height);
GLuint error = glGetError();
if (error != GL_NO_ERROR) {
glBindTexture(GL_TEXTURE_2D, 0);
- glDeleteTextures(1, &m_textureData->texture);
- m_textureData->texture = 0;
+ glDeleteTextures(1, &texInfo->texture);
+ texInfo->texture = 0;
}
}
-void QSGDefaultDistanceFieldGlyphCache::resizeTexture(int width, int height)
+void QSGDefaultDistanceFieldGlyphCache::resizeTexture(DistanceFieldTextureData::TextureInfo *texInfo, int width, int height)
{
- int oldWidth = m_textureData->size.width();
- int oldHeight = m_textureData->size.height();
+ int oldWidth = texInfo->size.width();
+ int oldHeight = texInfo->size.height();
if (width == oldWidth && height == oldHeight)
return;
- GLuint oldTexture = m_textureData->texture;
- createTexture(width, height);
+ GLuint oldTexture = texInfo->texture;
+ createTexture(texInfo, width, height);
if (!oldTexture)
return;
- updateTexture(oldTexture, m_textureData->texture, m_textureData->size);
+ updateTexture(oldTexture, texInfo->texture, texInfo->size);
if (useWorkaroundBrokenFBOReadback()) {
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, m_textureData->image.constBits());
- m_textureData->image = m_textureData->image.copy(0, 0, width, height);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, texInfo->image.constBits());
+ texInfo->image = texInfo->image.copy(0, 0, width, height);
glDeleteTextures(1, &oldTexture);
return;
}
@@ -267,7 +281,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(int width, int height)
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
+ glBindTexture(GL_TEXTURE_2D, texInfo->texture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
index 76e4a64e60..12bbcce060 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
@@ -59,37 +59,55 @@ public:
void referenceGlyphs(const QSet<glyph_t> &glyphs);
void releaseGlyphs(const QSet<glyph_t> &glyphs);
- bool cacheIsFull() const { return m_textureData->currY >= maxTextureSize(); }
+ bool cacheIsFull() const {
+ return m_textureData->textures.count() == m_maxTextureCount
+ && textureIsFull(m_textureData->currentTexture);
+ }
bool useWorkaroundBrokenFBOReadback() const;
int maxTextureSize() const;
-private:
- void createTexture(int width, int height);
- void resizeTexture(int width, int height);
+ void setMaxTextureCount(int max) { m_maxTextureCount = max; }
+ int maxTextureCount() const { return m_maxTextureCount; }
+private:
mutable int m_maxTextureSize;
+ int m_maxTextureCount;
struct DistanceFieldTextureData : public QOpenGLSharedResource {
- GLuint texture;
+ struct TextureInfo {
+ GLuint texture;
+ QSize size;
+ int currX;
+ int currY;
+ QImage image;
+
+ TextureInfo() : texture(0), currX(0), currY(0)
+ { }
+ };
+
+ TextureInfo *currentTexture;
+ QList<TextureInfo> textures;
+ QHash<glyph_t, TextureInfo *> glyphsTexture;
GLuint fbo;
- QSize size;
QSet<glyph_t> unusedGlyphs;
- int currX;
- int currY;
- QImage image;
QOpenGLShaderProgram *blitProgram;
GLfloat blitVertexCoordinateArray[8];
GLfloat blitTextureCoordinateArray[8];
+ TextureInfo *addTexture()
+ {
+ textures.append(TextureInfo());
+ return &textures.last();
+ }
+
DistanceFieldTextureData(QOpenGLContext *ctx)
: QOpenGLSharedResource(ctx->shareGroup())
- , texture(0)
, fbo(0)
- , currX(0)
- , currY(0)
, blitProgram(0)
{
+ currentTexture = addTexture();
+
blitVertexCoordinateArray[0] = -1.0f;
blitVertexCoordinateArray[1] = -1.0f;
blitVertexCoordinateArray[2] = 1.0f;
@@ -111,19 +129,26 @@ private:
void invalidateResource()
{
- texture = 0;
+ glyphsTexture.clear();
+ textures.clear();
fbo = 0;
- size = QSize();
delete blitProgram;
blitProgram = 0;
+
+ currentTexture = addTexture();
}
void freeResource(QOpenGLContext *ctx)
{
- glDeleteTextures(1, &texture);
+ glyphsTexture.clear();
+ for (int i = 0; i < textures.count(); ++i)
+ glDeleteTextures(1, &textures[i].texture);
+ textures.clear();
ctx->functions()->glDeleteFramebuffers(1, &fbo);
delete blitProgram;
blitProgram = 0;
+
+ currentTexture = addTexture();
}
void createBlitProgram()
@@ -155,6 +180,10 @@ private:
}
};
+ void createTexture(DistanceFieldTextureData::TextureInfo * texInfo, int width, int height);
+ void resizeTexture(DistanceFieldTextureData::TextureInfo * texInfo, int width, int height);
+ bool textureIsFull (const DistanceFieldTextureData::TextureInfo *tex) const { return tex->currY >= maxTextureSize(); }
+
DistanceFieldTextureData *textureData(QOpenGLContext *c);
DistanceFieldTextureData *m_textureData;
static QHash<QString, QOpenGLMultiGroupSharedResource> m_textures_data;
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
index 79e5c3b0f4..a86e663755 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -71,11 +71,9 @@ QSGDistanceFieldGlyphNode::~QSGDistanceFieldGlyphNode()
delete m_material;
if (m_glyph_cache) {
- QVector<quint32> glyphIndexes;
- for (int i = 0; i < m_allGlyphs.count(); ++i)
- glyphIndexes.append(m_allGlyphs.at(i).glyphIndex);
- m_glyph_cache->release(glyphIndexes);
+ m_glyph_cache->release(m_glyphs.glyphIndexes());
m_glyph_cache->unregisterGlyphNode(this);
+ m_glyph_cache->unregisterOwnerElement(ownerElement());
}
for (int i = 0; i < m_nodesToDelete.count(); ++i)
@@ -122,15 +120,9 @@ void QSGDistanceFieldGlyphNode::setGlyphs(const QPointF &position, const QGlyphR
}
m_glyph_cache->populate(glyphs.glyphIndexes());
- const QVector<quint32> &glyphIndexes = m_glyphs.glyphIndexes();
- const QVector<QPointF> &glyphPositions = m_glyphs.positions();
- for (int i = 0; i < glyphIndexes.count(); ++i) {
- GlyphInfo gi;
- gi.glyphIndex = glyphIndexes.at(i);
- gi.position = glyphPositions.at(i);
- m_allGlyphs.append(gi);
- m_allGlyphIndexesLookup.insert(gi.glyphIndex);
- }
+ const QVector<quint32> glyphIndexes = m_glyphs.glyphIndexes();
+ for (int i = 0; i < glyphIndexes.count(); ++i)
+ m_allGlyphIndexesLookup.insert(glyphIndexes.at(i));
m_dirtyGeometry = true;
m_dirtyMaterial = true;
@@ -204,34 +196,43 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
Q_ASSERT(g->indexType() == GL_UNSIGNED_SHORT);
- QHash<const QSGDistanceFieldGlyphCache::Texture *, QList<GlyphInfo> > glyphsInOtherTextures;
+ QHash<const QSGDistanceFieldGlyphCache::Texture *, GlyphInfo> glyphsInOtherTextures;
+
+ const QVector<quint32> indexes = m_glyphs.glyphIndexes();
+ const QVector<QPointF> positions = m_glyphs.positions();
QVector<QSGGeometry::TexturedPoint2D> vp;
- vp.reserve(m_allGlyphs.size() * 4);
+ vp.reserve(indexes.size() * 4);
QVector<ushort> ip;
- ip.reserve(m_allGlyphs.size() * 6);
+ ip.reserve(indexes.size() * 6);
QPointF margins(2, 2);
QPointF texMargins = margins / m_glyph_cache->fontScale();
- for (int i = 0; i < m_allGlyphs.size(); ++i) {
- GlyphInfo glyphInfo = m_allGlyphs.at(i);
- QSGDistanceFieldGlyphCache::TexCoord c = m_glyph_cache->glyphTexCoord(glyphInfo.glyphIndex);
+
+ for (int i = 0; i < indexes.size(); ++i) {
+ const int glyphIndex = indexes.at(i);
+ QSGDistanceFieldGlyphCache::TexCoord c = m_glyph_cache->glyphTexCoord(glyphIndex);
if (c.isNull())
continue;
- const QSGDistanceFieldGlyphCache::Texture *texture = m_glyph_cache->glyphTexture(glyphInfo.glyphIndex);
+ const QPointF position = positions.at(i);
+
+ const QSGDistanceFieldGlyphCache::Texture *texture = m_glyph_cache->glyphTexture(glyphIndex);
if (texture->textureId && !m_texture)
m_texture = texture;
if (m_texture != texture) {
- if (texture->textureId)
- glyphsInOtherTextures[texture].append(glyphInfo);
+ if (texture->textureId) {
+ GlyphInfo &glyphInfo = glyphsInOtherTextures[texture];
+ glyphInfo.indexes.append(glyphIndex);
+ glyphInfo.positions.append(position);
+ }
continue;
}
- QSGDistanceFieldGlyphCache::Metrics metrics = m_glyph_cache->glyphMetrics(glyphInfo.glyphIndex);
+ QSGDistanceFieldGlyphCache::Metrics metrics = m_glyph_cache->glyphMetrics(glyphIndex);
if (!metrics.isNull() && !c.isNull()) {
metrics.width += margins.x() * 2;
@@ -244,8 +245,8 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
c.height += texMargins.y() * 2;
}
- qreal x = glyphInfo.position.x() + metrics.baselineX + m_position.x();
- qreal y = glyphInfo.position.y() - metrics.baselineY + m_position.y();
+ qreal x = position.x() + metrics.baselineX + m_position.x();
+ qreal y = position.y() - metrics.baselineY + m_position.y();
m_boundingRect |= QRectF(x, y, metrics.width, metrics.height);
@@ -260,7 +261,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
float ty2 = ty1 + c.height;
if (m_baseLine.isNull())
- m_baseLine = glyphInfo.position;
+ m_baseLine = position;
int o = vp.size();
@@ -285,7 +286,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
ip.append(o + 0);
}
- QHash<const QSGDistanceFieldGlyphCache::Texture *, QList<GlyphInfo> >::const_iterator ite = glyphsInOtherTextures.constBegin();
+ QHash<const QSGDistanceFieldGlyphCache::Texture *, GlyphInfo>::const_iterator ite = glyphsInOtherTextures.constBegin();
while (ite != glyphsInOtherTextures.constEnd()) {
QHash<const QSGDistanceFieldGlyphCache::Texture *, QSGDistanceFieldGlyphNode *>::iterator subIt = m_subNodes.find(ite.key());
if (subIt == m_subNodes.end()) {
@@ -299,17 +300,9 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
subIt = m_subNodes.insert(ite.key(), subNode);
}
- QVector<quint32> glyphIndexes;
- QVector<QPointF> positions;
- const QList<GlyphInfo> &subNodeGlyphs = ite.value();
- for (int i = 0; i < subNodeGlyphs.count(); ++i) {
- const GlyphInfo &info = subNodeGlyphs.at(i);
- glyphIndexes.append(info.glyphIndex);
- positions.append(info.position);
- }
QGlyphRun subNodeGlyphRun(m_glyphs);
- subNodeGlyphRun.setGlyphIndexes(glyphIndexes);
- subNodeGlyphRun.setPositions(positions);
+ subNodeGlyphRun.setGlyphIndexes(ite->indexes);
+ subNodeGlyphRun.setPositions(ite->positions);
subIt.value()->setGlyphs(m_originalPosition, subNodeGlyphRun);
subIt.value()->update();
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
index 65ac2d499c..9406ee1bc8 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
@@ -96,11 +96,10 @@ private:
QList<QSGDistanceFieldGlyphNode *> m_nodesToDelete;
struct GlyphInfo {
- quint32 glyphIndex;
- QPointF position;
+ QVector<quint32> indexes;
+ QVector<QPointF> positions;
};
QSet<quint32> m_allGlyphIndexesLookup;
- QList<GlyphInfo> m_allGlyphs;
uint m_dirtyGeometry: 1;
uint m_dirtyMaterial: 1;
diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
index 76fb9036f4..cd5aaaedd7 100644
--- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
@@ -234,14 +234,25 @@ void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs
void QSGSharedDistanceFieldGlyphCache::registerOwnerElement(QQuickItem *ownerElement)
{
- bool ok = connect(this, SIGNAL(glyphsPending()), ownerElement, SLOT(triggerPreprocess()));
- Q_ASSERT_X(ok, Q_FUNC_INFO, "QML element that owns a glyph node must have triggerPreprocess() slot");
- Q_UNUSED(ok);
+ Owner &owner = m_registeredOwners[ownerElement];
+ if (owner.ref == 0) {
+ owner.item = ownerElement;
+
+ bool ok = connect(this, SIGNAL(glyphsPending()), ownerElement, SLOT(triggerPreprocess()));
+ Q_ASSERT_X(ok, Q_FUNC_INFO, "QML element that owns a glyph node must have triggerPreprocess() slot");
+ Q_UNUSED(ok);
+ }
+ ++owner.ref;
}
void QSGSharedDistanceFieldGlyphCache::unregisterOwnerElement(QQuickItem *ownerElement)
{
- disconnect(this, SIGNAL(glyphsPending()), ownerElement, SLOT(triggerPreprocess()));
+ QHash<QQuickItem *, Owner>::iterator it = m_registeredOwners.find(ownerElement);
+ if (it != m_registeredOwners.end() && --it->ref <= 0) {
+ if (it->item)
+ disconnect(this, SIGNAL(glyphsPending()), ownerElement, SLOT(triggerPreprocess()));
+ m_registeredOwners.erase(it);
+ }
}
#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG_)
diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h
index 4a91b4473a..19844bbda4 100644
--- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h
@@ -44,6 +44,7 @@
#include <QtCore/qwaitcondition.h>
#include <private/qsgadaptationlayer_p.h>
+#include <private/qqmlguard_p.h>
QT_BEGIN_HEADER
@@ -105,8 +106,19 @@ private:
QPoint position;
};
+ struct Owner
+ {
+ Owner() : ref(0) {}
+ Owner(const Owner &o) : item(o.item), ref(o.ref) {}
+ Owner &operator =(const Owner &o) { item = o.item; ref = o.ref; return *this; }
+
+ QQmlGuard<QQuickItem> item;
+ int ref;
+ };
+
QHash<quint32, PendingGlyph> m_pendingReadyGlyphs;
QHash<glyph_t, void *> m_bufferForGlyph;
+ QHash<QQuickItem *, Owner> m_registeredOwners;
};
QT_END_NAMESPACE
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index 51b598b28d..33a5d0a438 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -1536,11 +1536,11 @@ void QQuickRotationAnimation::setTo(qreal t)
Possible values are:
\list
- \o RotationAnimation.Numerical (default) - Rotate by linearly interpolating between the two numbers.
+ \li RotationAnimation.Numerical (default) - Rotate by linearly interpolating between the two numbers.
A rotation from 10 to 350 will rotate 340 degrees clockwise.
- \o RotationAnimation.Clockwise - Rotate clockwise between the two values
- \o RotationAnimation.Counterclockwise - Rotate counterclockwise between the two values
- \o RotationAnimation.Shortest - Rotate in the direction that produces the shortest animation path.
+ \li RotationAnimation.Clockwise - Rotate clockwise between the two values
+ \li RotationAnimation.Counterclockwise - Rotate counterclockwise between the two values
+ \li RotationAnimation.Shortest - Rotate in the direction that produces the shortest animation path.
A rotation from 10 to 350 will rotate 20 degrees counterclockwise.
\endlist
*/
@@ -1846,7 +1846,7 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged()
It can be used to define animations in a number of ways:
\list
- \o In a \l Transition
+ \li In a \l Transition
For example, to animate any objects that have changed their \c x or \c y properties
as a result of a state change, using an \c InOutQuad easing curve:
@@ -1854,21 +1854,21 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged()
\snippet doc/src/snippets/qml/propertyanimation.qml transition
- \o In a \l Behavior
+ \li In a \l Behavior
For example, to animate all changes to a rectangle's \c x property:
\snippet doc/src/snippets/qml/propertyanimation.qml behavior
- \o As a property value source
+ \li As a property value source
For example, to repeatedly animate the rectangle's \c x property:
\snippet doc/src/snippets/qml/propertyanimation.qml propertyvaluesource
- \o In a signal handler
+ \li In a signal handler
For example, to fade out \c theObject when clicked:
\qml
@@ -1878,7 +1878,7 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged()
}
\endqml
- \o Standalone
+ \li Standalone
For example, to animate \c rect's \c width property over 500ms, from its current width to 30:
@@ -2010,175 +2010,175 @@ void QQuickPropertyAnimation::setTo(const QVariant &t)
\table
\row
- \o \c Easing.Linear
- \o Easing curve for a linear (t) function: velocity is constant.
- \o \inlineimage qeasingcurve-linear.png
+ \li \c Easing.Linear
+ \li Easing curve for a linear (t) function: velocity is constant.
+ \li \inlineimage qeasingcurve-linear.png
\row
- \o \c Easing.InQuad
- \o Easing curve for a quadratic (t^2) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-inquad.png
+ \li \c Easing.InQuad
+ \li Easing curve for a quadratic (t^2) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-inquad.png
\row
- \o \c Easing.OutQuad
- \o Easing curve for a quadratic (t^2) function: decelerating to zero velocity.
- \o \inlineimage qeasingcurve-outquad.png
+ \li \c Easing.OutQuad
+ \li Easing curve for a quadratic (t^2) function: decelerating to zero velocity.
+ \li \inlineimage qeasingcurve-outquad.png
\row
- \o \c Easing.InOutQuad
- \o Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutquad.png
+ \li \c Easing.InOutQuad
+ \li Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutquad.png
\row
- \o \c Easing.OutInQuad
- \o Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinquad.png
+ \li \c Easing.OutInQuad
+ \li Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinquad.png
\row
- \o \c Easing.InCubic
- \o Easing curve for a cubic (t^3) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-incubic.png
+ \li \c Easing.InCubic
+ \li Easing curve for a cubic (t^3) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-incubic.png
\row
- \o \c Easing.OutCubic
- \o Easing curve for a cubic (t^3) function: decelerating from zero velocity.
- \o \inlineimage qeasingcurve-outcubic.png
+ \li \c Easing.OutCubic
+ \li Easing curve for a cubic (t^3) function: decelerating from zero velocity.
+ \li \inlineimage qeasingcurve-outcubic.png
\row
- \o \c Easing.InOutCubic
- \o Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutcubic.png
+ \li \c Easing.InOutCubic
+ \li Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutcubic.png
\row
- \o \c Easing.OutInCubic
- \o Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outincubic.png
+ \li \c Easing.OutInCubic
+ \li Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outincubic.png
\row
- \o \c Easing.InQuart
- \o Easing curve for a quartic (t^4) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-inquart.png
+ \li \c Easing.InQuart
+ \li Easing curve for a quartic (t^4) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-inquart.png
\row
- \o \c Easing.OutQuart
- \o Easing curve for a quartic (t^4) function: decelerating from zero velocity.
- \o \inlineimage qeasingcurve-outquart.png
+ \li \c Easing.OutQuart
+ \li Easing curve for a quartic (t^4) function: decelerating from zero velocity.
+ \li \inlineimage qeasingcurve-outquart.png
\row
- \o \c Easing.InOutQuart
- \o Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutquart.png
+ \li \c Easing.InOutQuart
+ \li Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutquart.png
\row
- \o \c Easing.OutInQuart
- \o Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinquart.png
+ \li \c Easing.OutInQuart
+ \li Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinquart.png
\row
- \o \c Easing.InQuint
- \o Easing curve for a quintic (t^5) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-inquint.png
+ \li \c Easing.InQuint
+ \li Easing curve for a quintic (t^5) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-inquint.png
\row
- \o \c Easing.OutQuint
- \o Easing curve for a quintic (t^5) function: decelerating from zero velocity.
- \o \inlineimage qeasingcurve-outquint.png
+ \li \c Easing.OutQuint
+ \li Easing curve for a quintic (t^5) function: decelerating from zero velocity.
+ \li \inlineimage qeasingcurve-outquint.png
\row
- \o \c Easing.InOutQuint
- \o Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutquint.png
+ \li \c Easing.InOutQuint
+ \li Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutquint.png
\row
- \o \c Easing.OutInQuint
- \o Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinquint.png
+ \li \c Easing.OutInQuint
+ \li Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinquint.png
\row
- \o \c Easing.InSine
- \o Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-insine.png
+ \li \c Easing.InSine
+ \li Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-insine.png
\row
- \o \c Easing.OutSine
- \o Easing curve for a sinusoidal (sin(t)) function: decelerating from zero velocity.
- \o \inlineimage qeasingcurve-outsine.png
+ \li \c Easing.OutSine
+ \li Easing curve for a sinusoidal (sin(t)) function: decelerating from zero velocity.
+ \li \inlineimage qeasingcurve-outsine.png
\row
- \o \c Easing.InOutSine
- \o Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutsine.png
+ \li \c Easing.InOutSine
+ \li Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutsine.png
\row
- \o \c Easing.OutInSine
- \o Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinsine.png
+ \li \c Easing.OutInSine
+ \li Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinsine.png
\row
- \o \c Easing.InExpo
- \o Easing curve for an exponential (2^t) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-inexpo.png
+ \li \c Easing.InExpo
+ \li Easing curve for an exponential (2^t) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-inexpo.png
\row
- \o \c Easing.OutExpo
- \o Easing curve for an exponential (2^t) function: decelerating from zero velocity.
- \o \inlineimage qeasingcurve-outexpo.png
+ \li \c Easing.OutExpo
+ \li Easing curve for an exponential (2^t) function: decelerating from zero velocity.
+ \li \inlineimage qeasingcurve-outexpo.png
\row
- \o \c Easing.InOutExpo
- \o Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutexpo.png
+ \li \c Easing.InOutExpo
+ \li Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutexpo.png
\row
- \o \c Easing.OutInExpo
- \o Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinexpo.png
+ \li \c Easing.OutInExpo
+ \li Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinexpo.png
\row
- \o \c Easing.InCirc
- \o Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-incirc.png
+ \li \c Easing.InCirc
+ \li Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-incirc.png
\row
- \o \c Easing.OutCirc
- \o Easing curve for a circular (sqrt(1-t^2)) function: decelerating from zero velocity.
- \o \inlineimage qeasingcurve-outcirc.png
+ \li \c Easing.OutCirc
+ \li Easing curve for a circular (sqrt(1-t^2)) function: decelerating from zero velocity.
+ \li \inlineimage qeasingcurve-outcirc.png
\row
- \o \c Easing.InOutCirc
- \o Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutcirc.png
+ \li \c Easing.InOutCirc
+ \li Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutcirc.png
\row
- \o \c Easing.OutInCirc
- \o Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outincirc.png
+ \li \c Easing.OutInCirc
+ \li Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outincirc.png
\row
- \o \c Easing.InElastic
- \o Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity.
+ \li \c Easing.InElastic
+ \li Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
- \o \inlineimage qeasingcurve-inelastic.png
+ \li \inlineimage qeasingcurve-inelastic.png
\row
- \o \c Easing.OutElastic
- \o Easing curve for an elastic (exponentially decaying sine wave) function: decelerating from zero velocity.
+ \li \c Easing.OutElastic
+ \li Easing curve for an elastic (exponentially decaying sine wave) function: decelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
- \o \inlineimage qeasingcurve-outelastic.png
+ \li \inlineimage qeasingcurve-outelastic.png
\row
- \o \c Easing.InOutElastic
- \o Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutelastic.png
+ \li \c Easing.InOutElastic
+ \li Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutelastic.png
\row
- \o \c Easing.OutInElastic
- \o Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinelastic.png
+ \li \c Easing.OutInElastic
+ \li Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinelastic.png
\row
- \o \c Easing.InBack
- \o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-inback.png
+ \li \c Easing.InBack
+ \li Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-inback.png
\row
- \o \c Easing.OutBack
- \o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity.
- \o \inlineimage qeasingcurve-outback.png
+ \li \c Easing.OutBack
+ \li Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity.
+ \li \inlineimage qeasingcurve-outback.png
\row
- \o \c Easing.InOutBack
- \o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutback.png
+ \li \c Easing.InOutBack
+ \li Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutback.png
\row
- \o \c Easing.OutInBack
- \o Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinback.png
+ \li \c Easing.OutInBack
+ \li Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinback.png
\row
- \o \c Easing.InBounce
- \o Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity.
- \o \inlineimage qeasingcurve-inbounce.png
+ \li \c Easing.InBounce
+ \li Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity.
+ \li \inlineimage qeasingcurve-inbounce.png
\row
- \o \c Easing.OutBounce
- \o Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity.
- \o \inlineimage qeasingcurve-outbounce.png
+ \li \c Easing.OutBounce
+ \li Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity.
+ \li \inlineimage qeasingcurve-outbounce.png
\row
- \o \c Easing.InOutBounce
- \o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration.
- \o \inlineimage qeasingcurve-inoutbounce.png
+ \li \c Easing.InOutBounce
+ \li Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration.
+ \li \inlineimage qeasingcurve-inoutbounce.png
\row
- \o \c Easing.OutInBounce
- \o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration.
- \o \inlineimage qeasingcurve-outinbounce.png
+ \li \c Easing.OutInBounce
+ \li Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration.
+ \li \inlineimage qeasingcurve-outinbounce.png
\row
- \o \c Easing.Bezier
- \o Custom easing curve defined by the easing.bezierCurve property.
- \o
+ \li \c Easing.Bezier
+ \li Custom easing curve defined by the easing.bezierCurve property.
+ \li
\endtable
\c easing.amplitude is only applicable for bounce and elastic curves (curves of type
@@ -2290,8 +2290,8 @@ void QQuickPropertyAnimation::setProperties(const QString &prop)
\table 80%
\row
- \o Value Source / Behavior
- \o When an animation is used as a value source or in a Behavior, the default target and property
+ \li Value Source / Behavior
+ \li When an animation is used as a value source or in a Behavior, the default target and property
name to be animated can both be inferred.
\qml
Rectangle {
@@ -2303,8 +2303,8 @@ void QQuickPropertyAnimation::setProperties(const QString &prop)
}
\endqml
\row
- \o Transition
- \o When used in a transition, a property animation is assumed to match \e all targets
+ \li Transition
+ \li When used in a transition, a property animation is assumed to match \e all targets
but \e no properties. In practice, that means you need to specify at least the properties
in order for the animation to do anything.
\qml
@@ -2328,8 +2328,8 @@ void QQuickPropertyAnimation::setProperties(const QString &prop)
}
\endqml
\row
- \o Standalone
- \o When an animation is used standalone, both the target and property need to be
+ \li Standalone
+ \li When an animation is used standalone, both the target and property need to be
explicitly specified.
\qml
Rectangle {
diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp
index a3e343f26d..2b5d174caa 100644
--- a/src/quick/util/qquickanimationcontroller.cpp
+++ b/src/quick/util/qquickanimationcontroller.cpp
@@ -174,6 +174,7 @@ void QQuickAnimationController::reload()
if (oldInstance && oldInstance != d->animationInstance)
delete oldInstance;
d->animationInstance->setLoopCount(1);
+ d->animationInstance->setDisableUserControl();
d->animationInstance->start();
d->animationInstance->pause();
updateProgress();
@@ -186,6 +187,7 @@ void QQuickAnimationController::updateProgress()
if (!d->animationInstance)
return;
+ d->animationInstance->setDisableUserControl();
d->animationInstance->start();
QQmlAnimationTimer::unregisterAnimation(d->animationInstance);
d->animationInstance->setCurrentTime(d->progress * d->animationInstance->duration());
diff --git a/src/quick/util/qquickconnections.cpp b/src/quick/util/qquickconnections.cpp
index 6e176fde3d..533c7013ef 100644
--- a/src/quick/util/qquickconnections.cpp
+++ b/src/quick/util/qquickconnections.cpp
@@ -91,9 +91,9 @@ public:
cases, such as when:
\list
- \i Multiple connections to the same signal are required
- \i Creating connections outside the scope of the signal sender
- \i Connecting to targets not defined in QML
+ \li Multiple connections to the same signal are required
+ \li Creating connections outside the scope of the signal sender
+ \li Connecting to targets not defined in QML
\endlist
When any of these are needed, the Connections element can be used instead.
diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp
index 438d00bd1b..55830f0cc8 100644
--- a/src/quick/util/qquickfontloader.cpp
+++ b/src/quick/util/qquickfontloader.cpp
@@ -295,22 +295,22 @@ void QQuickFontLoader::setName(const QString &name)
This property holds the status of font loading. It can be one of:
\list
- \o FontLoader.Null - no font has been set
- \o FontLoader.Ready - the font has been loaded
- \o FontLoader.Loading - the font is currently being loaded
- \o FontLoader.Error - an error occurred while loading the font
+ \li FontLoader.Null - no font has been set
+ \li FontLoader.Ready - the font has been loaded
+ \li FontLoader.Loading - the font is currently being loaded
+ \li FontLoader.Error - an error occurred while loading the font
\endlist
Use this status to provide an update or respond to the status change in some way.
For example, you could:
\list
- \o Trigger a state change:
+ \li Trigger a state change:
\qml
State { name: 'loaded'; when: loader.status == FontLoader.Ready }
\endqml
- \o Implement an \c onStatusChanged signal handler:
+ \li Implement an \c onStatusChanged signal handler:
\qml
FontLoader {
id: loader
@@ -318,7 +318,7 @@ void QQuickFontLoader::setName(const QString &name)
}
\endqml
- \o Bind to the status value:
+ \li Bind to the status value:
\qml
Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' }
\endqml
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index dc85230943..a5d2720cea 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -117,12 +117,12 @@ QImage QQuickTextureFactory::image() const
in QML applications. It allows images in QML to be:
\list
- \o Loaded using QPixmaps rather than actual image files
- \o Loaded asynchronously in a separate thread, if imageType() is \l{QQuickImageProvider::ImageType}{ImageType::Image}
+ \li Loaded using QPixmaps rather than actual image files
+ \li Loaded asynchronously in a separate thread, if imageType() is \l{QQmlImageProvider::ImageType}{ImageType::Image}
\endlist
To specify that an image should be loaded by an image provider, use the
- \bold {"image:"} scheme for the URL source of the image, followed by the
+ \b {"image:"} scheme for the URL source of the image, followed by the
identifiers of the image provider and the requested image. For example:
\qml
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index b6a01bfe3e..adf4242cdc 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -171,14 +171,14 @@ bool QQuickPath::hasEnd() const
A path can contain the following path objects:
\list
- \i \l PathLine - a straight line to a given position.
- \i \l PathQuad - a quadratic Bezier curve to a given position with a control point.
- \i \l PathCubic - a cubic Bezier curve to a given position with two control points.
- \i \l PathArc - an arc to a given position with a radius.
- \i \l PathSvg - a path specified as an SVG path data string.
- \i \l PathCurve - a point on a Catmull-Rom curve.
- \i \l PathAttribute - an attribute at a given position in the path.
- \i \l PathPercent - a way to spread out items along various segments of the path.
+ \li \l PathLine - a straight line to a given position.
+ \li \l PathQuad - a quadratic Bezier curve to a given position with a control point.
+ \li \l PathCubic - a cubic Bezier curve to a given position with two control points.
+ \li \l PathArc - an arc to a given position with a radius.
+ \li \l PathSvg - a path specified as an SVG path data string.
+ \li \l PathCurve - a point on a Catmull-Rom curve.
+ \li \l PathAttribute - an attribute at a given position in the path.
+ \li \l PathPercent - a way to spread out items along various segments of the path.
\endlist
\snippet doc/src/snippets/qml/pathview/pathattributes.qml 2
@@ -808,8 +808,8 @@ bool QQuickCurve::hasRelativeY()
\table
\row
- \o \image declarative-pathattribute.png
- \o
+ \li \image declarative-pathattribute.png
+ \li
\snippet doc/src/snippets/qml/pathview/pathattributes.qml 0
(see the PathView documentation for the specification of ContactModel.qml
used for ContactModel above.)
@@ -970,8 +970,8 @@ void QQuickPathLine::addToPath(QPainterPath &path, const QQuickPathData &data)
The following QML produces the path shown below:
\table
\row
- \o \image declarative-pathquad.png
- \o
+ \li \image declarative-pathquad.png
+ \li
\qml
Path {
startX: 0; startY: 0
@@ -1121,8 +1121,8 @@ void QQuickPathQuad::addToPath(QPainterPath &path, const QQuickPathData &data)
The following QML produces the path shown below:
\table
\row
- \o \image declarative-pathcubic.png
- \o
+ \li \image declarative-pathcubic.png
+ \li
\qml
Path {
startX: 20; startY: 0
@@ -1492,8 +1492,8 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa
The following QML produces the path shown below:
\table
\row
- \o \image declarative-patharc.png
- \o \snippet doc/src/snippets/qml/path/basicarc.qml 0
+ \li \image declarative-patharc.png
+ \li \snippet doc/src/snippets/qml/path/basicarc.qml 0
\endtable
Note that a single PathArc cannot be used to specify a circle. Instead, you can
@@ -1536,8 +1536,8 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa
the shape of the arc:
\table
\row
- \o \image declarative-arcradius.png
- \o \snippet doc/src/snippets/qml/path/arcradius.qml 0
+ \li \image declarative-arcradius.png
+ \li \snippet doc/src/snippets/qml/path/arcradius.qml 0
\endtable
*/
@@ -1581,8 +1581,8 @@ void QQuickPathArc::setRadiusY(qreal radius)
\table
\row
- \o \image declarative-largearc.png
- \o \snippet doc/src/snippets/qml/path/largearc.qml 0
+ \li \image declarative-largearc.png
+ \li \snippet doc/src/snippets/qml/path/largearc.qml 0
\endtable
The default value is false.
@@ -1612,8 +1612,8 @@ void QQuickPathArc::setUseLargeArc(bool largeArc)
by changing the value of direction.
\table
\row
- \o \image declarative-arcdirection.png
- \o \snippet doc/src/snippets/qml/path/arcdirection.qml 0
+ \li \image declarative-arcdirection.png
+ \li \snippet doc/src/snippets/qml/path/arcdirection.qml 0
\endtable
\sa useLargeArc
@@ -1659,8 +1659,8 @@ void QQuickPathArc::addToPath(QPainterPath &path, const QQuickPathData &data)
The following QML produces the path shown below:
\table
\row
- \o \image declarative-pathsvg.png
- \o
+ \li \image declarative-pathsvg.png
+ \li
\qml
Path {
startX: 50; startY: 50
@@ -1717,8 +1717,8 @@ void QQuickPathSvg::addToPath(QPainterPath &path, const QQuickPathData &)
PathLine section of the path.
\table
\row
- \o \image declarative-nopercent.png
- \o
+ \li \image declarative-nopercent.png
+ \li
\qml
PathView {
// ...
@@ -1731,8 +1731,8 @@ void QQuickPathSvg::addToPath(QPainterPath &path, const QQuickPathData &)
}
\endqml
\row
- \o \image declarative-percent.png
- \o
+ \li \image declarative-percent.png
+ \li
\qml
PathView {
// ...
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 5c73e519e1..801b007cdd 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -1001,7 +1001,6 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
struct QQuickPixmapNull {
QUrl url;
- QImage image;
QSize size;
};
Q_GLOBAL_STATIC(QQuickPixmapNull, nullPixmap);
@@ -1104,8 +1103,7 @@ QImage QQuickPixmap::image() const
{
if (d && d->textureFactory)
return d->textureFactory->image();
- else
- return nullPixmap()->image;
+ return QImage();
}
void QQuickPixmap::setImage(const QImage &p)
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 83ddb2530e..8b0818c96c 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -478,12 +478,11 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions()
QQmlBinding::Identifier id = d->expressions.at(ii).id;
QQmlBinding *newBinding = id != QQmlBinding::Invalid ? QQmlBinding::createBinding(id, object(), qmlContext(this), e->sourceFile(), e->lineNumber()) : 0;
- if (!newBinding) {
- newBinding = new QQmlBinding(e->expression(), object(), qmlContext(this));
- newBinding->setSourceLocation(e->sourceFile(), e->lineNumber(), e->columnNumber());
- }
+ if (!newBinding)
+ newBinding = new QQmlBinding(e->expression(), false, object(), QQmlContextData::get(qmlContext(this)),
+ e->sourceFile(), e->lineNumber(), e->columnNumber());
newBinding->setTarget(prop);
- a.toBinding = newBinding;
+ a.toBinding = QQmlAbstractBinding::getPointer(newBinding);
a.deletableToBinding = true;
}
@@ -682,7 +681,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString
} else {
QQmlBinding *newBinding = new QQmlBinding(newExpression->expression(), object(), qmlContext(this));
newBinding->setTarget(d->property(name));
- action.toBinding = newBinding;
+ action.toBinding = QQmlAbstractBinding::getPointer(newBinding);
action.deletableToBinding = true;
state()->addEntryToRevertList(action);
diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp
index 024728f1f5..1ad9372917 100644
--- a/src/quick/util/qquicksmoothedanimation.cpp
+++ b/src/quick/util/qquicksmoothedanimation.cpp
@@ -450,9 +450,9 @@ QAbstractAnimationJob* QQuickSmoothedAnimation::transition(QQuickStateActions &a
Possible values are:
\list
- \o SmoothedAnimation.Eased (default) - the animation will smoothly decelerate, and then reverse direction
- \o SmoothedAnimation.Immediate - the animation will immediately begin accelerating in the reverse direction, beginning with a velocity of 0
- \o SmoothedAnimation.Sync - the property is immediately set to the target value
+ \li SmoothedAnimation.Eased (default) - the animation will smoothly decelerate, and then reverse direction
+ \li SmoothedAnimation.Immediate - the animation will immediately begin accelerating in the reverse direction, beginning with a velocity of 0
+ \li SmoothedAnimation.Sync - the property is immediately set to the target value
\endlist
*/
QQuickSmoothedAnimation::ReversingMode QQuickSmoothedAnimation::reversingMode() const
diff --git a/src/quick/util/qquicksystempalette.cpp b/src/quick/util/qquicksystempalette.cpp
index 735d18abf5..2417d573c4 100644
--- a/src/quick/util/qquicksystempalette.cpp
+++ b/src/quick/util/qquicksystempalette.cpp
@@ -267,9 +267,9 @@ QColor QQuickSystemPalette::highlightedText() const
The color group of the palette. This can be one of:
\list
- \o SystemPalette.Active (default)
- \o SystemPalette.Inactive
- \o SystemPalette.Disabled
+ \li SystemPalette.Active (default)
+ \li SystemPalette.Inactive
+ \li SystemPalette.Disabled
\endlist
\sa QPalette::ColorGroup
diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp
index 3e8b36714a..61aefaf0a3 100644
--- a/src/quick/util/qquicktimeline.cpp
+++ b/src/quick/util/qquicktimeline.cpp
@@ -259,7 +259,7 @@ qreal QQuickTimeLinePrivate::value(const Op &op, int time, qreal base, bool *cha
QQuickTimeLine is similar to QTimeLine except:
\list
- \i It updates QQuickTimeLineValue instances directly, rather than maintaining a single
+ \li It updates QQuickTimeLineValue instances directly, rather than maintaining a single
current value.
For example, the following animates a simple value over 200 milliseconds:
@@ -274,7 +274,7 @@ qreal QQuickTimeLinePrivate::value(const Op &op, int time, qreal base, bool *cha
connect to the QQuickTimeLine's updated() signal, or inherit from QQuickTimeLineValue
and reimplement the QQuickTimeLineValue::setValue() method.
- \i Supports multiple QQuickTimeLineValue, arbitrary start and end values and allows
+ \li Supports multiple QQuickTimeLineValue, arbitrary start and end values and allows
animations to be strung together for more complex effects.
For example, the following animation moves the x and y coordinates of
@@ -294,7 +294,7 @@ qreal QQuickTimeLinePrivate::value(const Op &op, int time, qreal base, bool *cha
tl.move(y, 200., 50);
\endcode
- \i All QQuickTimeLine instances share a single, synchronized clock.
+ \li All QQuickTimeLine instances share a single, synchronized clock.
Actions scheduled within the same event loop tick are scheduled
synchronously against each other, regardless of the wall time between the
@@ -585,10 +585,10 @@ void QQuickTimeLine::sync(QQuickTimeLineValue &timeLineValue)
will result in:
\table
- \header \o \o 0ms \o 50ms \o 100ms \o 150ms \o 200ms \o 250ms \o 300ms
- \row \o value1 \o 0 \o 2.5 \o 5.0 \o 7.5 \o 10 \o 10 \o 10
- \row \o value2 \o 0 \o 5.0 \o 10.0 \o 10.0 \o 10.0 \o 15.0 \o 20.0
- \row \o value2 \o 0 \o 0 \o 0 \o 0 \o 0 \o 10.0 \o 20.0
+ \header \li \li 0ms \li 50ms \li 100ms \li 150ms \li 200ms \li 250ms \li 300ms
+ \row \li value1 \li 0 \li 2.5 \li 5.0 \li 7.5 \li 10 \li 10 \li 10
+ \row \li value2 \li 0 \li 5.0 \li 10.0 \li 10.0 \li 10.0 \li 15.0 \li 20.0
+ \row \li value2 \li 0 \li 0 \li 0 \li 0 \li 0 \li 10.0 \li 20.0
\endtable
*/