aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/designer/designersupport.cpp23
-rw-r--r--src/quick/designer/designersupport.h4
-rw-r--r--src/quick/designer/designerwindowmanager_p.h2
-rw-r--r--src/quick/doc/images/particles/fuzzydot.pngbin0 -> 1799 bytes
-rw-r--r--src/quick/doc/images/particles/glowdot.pngbin0 -> 861 bytes
-rw-r--r--src/quick/doc/images/particles/star.pngbin0 -> 1550 bytes
-rw-r--r--src/quick/doc/images/qml-extending-types.pngbin738 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-animation.pngbin474 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-integratingjs.pngbin679 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-layouts-anchors.pngbin946 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-layouts-direct.pngbin344 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-layouts-positioners.pngbin471 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-styling-text.pngbin29158 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-styling.pngbin6330 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-text.pngbin41485 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-userinput.pngbin6713 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-visual-opacity.pngbin211 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-visual-rectangles.pngbin770 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-visual-transforms.pngbin671 -> 0 bytes
-rw-r--r--src/quick/doc/qtquick.qdocconf7
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/dotproperties.qml68
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml47
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/lists.qml62
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/myscript.js9
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/photo.qml85
-rw-r--r--src/quick/doc/snippets/qml/colors.qml (renamed from src/quick/doc/snippets/qml/visualdatagroup.qml)98
-rw-r--r--src/quick/doc/snippets/qml/text/onLinkActivated.qml2
-rw-r--r--src/quick/doc/snippets/qml/usecases/Button.qml86
-rw-r--r--src/quick/doc/snippets/qml/usecases/MyText.qml48
-rw-r--r--src/quick/doc/snippets/qml/usecases/animations.qml187
-rw-r--r--src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml79
-rw-r--r--src/quick/doc/snippets/qml/usecases/integratingjs.qml71
-rw-r--r--src/quick/doc/snippets/qml/usecases/layouts.qml142
-rw-r--r--src/quick/doc/snippets/qml/usecases/myscript.js46
-rw-r--r--src/quick/doc/snippets/qml/usecases/styling-text.qml73
-rw-r--r--src/quick/doc/snippets/qml/usecases/styling.qml65
-rw-r--r--src/quick/doc/snippets/qml/usecases/text.qml105
-rw-r--r--src/quick/doc/snippets/qml/usecases/userinput-keys.qml71
-rw-r--r--src/quick/doc/snippets/qml/usecases/userinput.qml70
-rw-r--r--src/quick/doc/snippets/qml/usecases/visual-opacity.qml83
-rw-r--r--src/quick/doc/snippets/qml/usecases/visual-rects.qml78
-rw-r--r--src/quick/doc/snippets/qml/usecases/visual-transforms.qml72
-rw-r--r--src/quick/doc/snippets/qml/usecases/visual.qml66
-rw-r--r--src/quick/doc/snippets/qml/visualdatamodel.qml64
-rw-r--r--src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp62
-rw-r--r--src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml65
-rw-r--r--src/quick/doc/snippets/qml/xmlrole.qml (renamed from src/quick/doc/snippets/qml/codingconventions/javascript.qml)46
-rw-r--r--src/quick/doc/src/advtutorial.qdoc63
-rw-r--r--src/quick/doc/src/appdevguide/applicationdevelopers.qdoc145
-rw-r--r--src/quick/doc/src/appdevguide/codingconventions.qdoc106
-rw-r--r--src/quick/doc/src/appdevguide/debugging.qdoc158
-rw-r--r--src/quick/doc/src/appdevguide/deployment.qdoc211
-rw-r--r--src/quick/doc/src/appdevguide/glossary.qdoc193
-rw-r--r--src/quick/doc/src/appdevguide/internationalization.qdoc280
-rw-r--r--src/quick/doc/src/appdevguide/performance.qdoc1143
-rw-r--r--src/quick/doc/src/appdevguide/porting.qdoc255
-rw-r--r--src/quick/doc/src/appdevguide/qmlscene.qdoc146
-rw-r--r--src/quick/doc/src/appdevguide/qtquicktest.qdoc132
-rw-r--r--src/quick/doc/src/appdevguide/quickstart/basics.qdoc118
-rw-r--r--src/quick/doc/src/appdevguide/quickstart/essentials.qdoc184
-rw-r--r--src/quick/doc/src/appdevguide/usecases/animations.qdoc73
-rw-r--r--src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc70
-rw-r--r--src/quick/doc/src/appdevguide/usecases/layouts.qdoc79
-rw-r--r--src/quick/doc/src/appdevguide/usecases/styling.qdoc63
-rw-r--r--src/quick/doc/src/appdevguide/usecases/text.qdoc58
-rw-r--r--src/quick/doc/src/appdevguide/usecases/userinput.qdoc83
-rw-r--r--src/quick/doc/src/appdevguide/usecases/visual.qdoc85
-rw-r--r--src/quick/doc/src/concepts/convenience/topic.qdoc2
-rw-r--r--src/quick/doc/src/concepts/effects/particles.qdoc2
-rw-r--r--src/quick/doc/src/concepts/effects/sprites.qdoc3
-rw-r--r--src/quick/doc/src/concepts/input/focus.qdoc22
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc26
-rw-r--r--src/quick/doc/src/concepts/positioning/layouts.qdoc9
-rw-r--r--src/quick/doc/src/concepts/positioning/righttoleft.qdoc3
-rw-r--r--src/quick/doc/src/concepts/positioning/topic.qdoc25
-rw-r--r--src/quick/doc/src/dynamicview-tutorial.qdoc53
-rw-r--r--src/quick/doc/src/examples.qdoc8
-rw-r--r--src/quick/doc/src/qmltypereference.qdoc69
-rw-r--r--src/quick/doc/src/qtquick.qdoc17
-rw-r--r--src/quick/doc/src/tutorial.qdoc36
-rw-r--r--src/quick/doc/src/whatsnew.qdoc64
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp38
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp146
-rw-r--r--src/quick/items/context2d/qquickcontext2d_p.h3
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp206
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture.cpp1
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp3
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h4
-rw-r--r--src/quick/items/qquickdrag.cpp10
-rw-r--r--src/quick/items/qquickdroparea.cpp2
-rw-r--r--src/quick/items/qquickevents_p_p.h2
-rw-r--r--src/quick/items/qquickflickable.cpp22
-rw-r--r--src/quick/items/qquickflickable_p_p.h2
-rw-r--r--src/quick/items/qquickgridview.cpp16
-rw-r--r--src/quick/items/qquickimage.cpp6
-rw-r--r--src/quick/items/qquickitem.cpp209
-rw-r--r--src/quick/items/qquickitem.h4
-rw-r--r--src/quick/items/qquickitem_p.h12
-rw-r--r--src/quick/items/qquickitemsmodule.cpp7
-rw-r--r--src/quick/items/qquickitemview.cpp21
-rw-r--r--src/quick/items/qquickitemview_p.h1
-rw-r--r--src/quick/items/qquicklistview.cpp19
-rw-r--r--src/quick/items/qquickloader.cpp8
-rw-r--r--src/quick/items/qquickmousearea.cpp9
-rw-r--r--src/quick/items/qquickmousearea_p.h2
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp28
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h4
-rw-r--r--src/quick/items/qquickpathview.cpp2
-rw-r--r--src/quick/items/qquickpincharea.cpp28
-rw-r--r--src/quick/items/qquickpincharea_p.h4
-rw-r--r--src/quick/items/qquickpositioners.cpp106
-rw-r--r--src/quick/items/qquickrectangle.cpp2
-rw-r--r--src/quick/items/qquickrepeater.cpp17
-rw-r--r--src/quick/items/qquickrepeater_p_p.h2
-rw-r--r--src/quick/items/qquickscreen.cpp86
-rw-r--r--src/quick/items/qquickscreen_p.h11
-rw-r--r--src/quick/items/qquickshadereffect.cpp4
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp6
-rw-r--r--src/quick/items/qquicktext.cpp98
-rw-r--r--src/quick/items/qquicktext_p.h8
-rw-r--r--src/quick/items/qquicktext_p_p.h4
-rw-r--r--src/quick/items/qquicktextcontrol.cpp50
-rw-r--r--src/quick/items/qquicktextcontrol_p.h2
-rw-r--r--src/quick/items/qquicktextcontrol_p_p.h3
-rw-r--r--src/quick/items/qquicktextdocument.h2
-rw-r--r--src/quick/items/qquicktextedit.cpp224
-rw-r--r--src/quick/items/qquicktextedit_p.h9
-rw-r--r--src/quick/items/qquicktextedit_p_p.h4
-rw-r--r--src/quick/items/qquicktextinput.cpp27
-rw-r--r--src/quick/items/qquicktextinput_p_p.h2
-rw-r--r--src/quick/items/qquicktextnode.cpp6
-rw-r--r--src/quick/items/qquicktextnode_p.h5
-rw-r--r--src/quick/items/qquickview.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp320
-rw-r--r--src/quick/items/qquickwindow.h7
-rw-r--r--src/quick/items/qquickwindow_p.h29
-rw-r--r--src/quick/items/qquickwindowmodule.cpp24
-rw-r--r--src/quick/quick.pro7
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp18
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp1
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.h1
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp52
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.h11
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode_p.h76
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp52
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp21
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp66
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h1
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp7
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode.cpp8
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode_p.h8
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode.cpp8
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode_p.h8
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp39
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h12
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp122
-rw-r--r--src/quick/scenegraph/qsgrenderloop_p.h9
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp98
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop_p.h6
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp469
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop_p.h116
-rw-r--r--src/quick/scenegraph/scenegraph.pri17
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.cpp10
-rw-r--r--src/quick/scenegraph/util/qsgpainternode.cpp31
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.cpp81
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.h16
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp60
-rw-r--r--src/quick/scenegraph/util/qsgtexture_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.cpp6
-rw-r--r--src/quick/util/qquickanimation.cpp6
-rw-r--r--src/quick/util/qquickbehavior.cpp2
-rw-r--r--src/quick/util/qquickimageprovider.cpp8
-rw-r--r--src/quick/util/qquickpath.cpp109
-rw-r--r--src/quick/util/qquickpath_p.h9
-rw-r--r--src/quick/util/qquickpath_p_p.h3
-rw-r--r--src/quick/util/qquickpixmapcache.cpp24
-rw-r--r--src/quick/util/qquickpropertychanges.cpp2
-rw-r--r--src/quick/util/qquickstate.cpp2
-rw-r--r--src/quick/util/qquickstategroup.cpp2
-rw-r--r--src/quick/util/qquicksvgparser.cpp2
-rw-r--r--src/quick/util/qquicktransition.cpp2
181 files changed, 3132 insertions, 6327 deletions
diff --git a/src/quick/designer/designersupport.cpp b/src/quick/designer/designersupport.cpp
index 7f75857fe4..2dd041b968 100644
--- a/src/quick/designer/designersupport.cpp
+++ b/src/quick/designer/designersupport.cpp
@@ -51,6 +51,8 @@
#include <QtQuick/private/qquickstategroup_p.h>
#include <QtGui/QImage>
#include <private/qqmlvme_p.h>
+#include <private/qqmlcomponentattached_p.h>
+#include <private/qqmldata_p.h>
#include "designerwindowmanager_p.h"
@@ -375,6 +377,17 @@ void DesignerSupport::resetAnchor(QQuickItem *item, const QString &name)
}
}
+void DesignerSupport::emitComponentCompleteSignalForAttachedProperty(QQuickItem *item)
+{
+ QQmlData *data = QQmlData::get(item);
+ if (data && data->context) {
+ QQmlComponentAttached *componentAttached = data->context->componentAttached;
+ if (componentAttached) {
+ emit componentAttached->completed();
+ }
+ }
+}
+
QList<QObject*> DesignerSupport::statesForItem(QQuickItem *item)
{
QList<QObject*> objectList;
@@ -437,6 +450,16 @@ void DesignerSupport::activateDesignerMode()
QQmlEnginePrivate::activateDesignerMode();
}
+void DesignerSupport::disableComponentComplete()
+{
+ QQmlVME::disableComponentComplete();
+}
+
+void DesignerSupport::enableComponentComplete()
+{
+ QQmlVME::enableComponentComplete();
+}
+
void DesignerSupport::createOpenGLContext(QQuickWindow *window)
{
DesignerWindowManager::createOpenGLContext(window);
diff --git a/src/quick/designer/designersupport.h b/src/quick/designer/designersupport.h
index c93cffa7fa..5139a65645 100644
--- a/src/quick/designer/designersupport.h
+++ b/src/quick/designer/designersupport.h
@@ -125,6 +125,7 @@ public:
static QQuickItem *anchorCenterInTargetItem(QQuickItem *item);
static QPair<QString, QObject*> anchorLineTarget(QQuickItem *item, const QString &name, QQmlContext *context);
static void resetAnchor(QQuickItem *item, const QString &name);
+ static void emitComponentCompleteSignalForAttachedProperty(QQuickItem *item);
static QList<QObject*> statesForItem(QQuickItem *item);
@@ -145,6 +146,9 @@ public:
static void activateDesignerWindowManager();
static void activateDesignerMode();
+ static void disableComponentComplete();
+ static void enableComponentComplete();
+
static void createOpenGLContext(QQuickWindow *window);
static void polishItems(QQuickWindow *window);
diff --git a/src/quick/designer/designerwindowmanager_p.h b/src/quick/designer/designerwindowmanager_p.h
index 02aacf06bd..3bbd0c2825 100644
--- a/src/quick/designer/designerwindowmanager_p.h
+++ b/src/quick/designer/designerwindowmanager_p.h
@@ -67,7 +67,7 @@ class QSGContext;
class QAnimationDriver;
class QOpenGLContext;
-class DesignerWindowManager : public QObject, public QSGRenderLoop
+class DesignerWindowManager : public QSGRenderLoop
{
Q_OBJECT
public:
diff --git a/src/quick/doc/images/particles/fuzzydot.png b/src/quick/doc/images/particles/fuzzydot.png
new file mode 100644
index 0000000000..bc95b703c1
--- /dev/null
+++ b/src/quick/doc/images/particles/fuzzydot.png
Binary files differ
diff --git a/src/quick/doc/images/particles/glowdot.png b/src/quick/doc/images/particles/glowdot.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/src/quick/doc/images/particles/glowdot.png
Binary files differ
diff --git a/src/quick/doc/images/particles/star.png b/src/quick/doc/images/particles/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/src/quick/doc/images/particles/star.png
Binary files differ
diff --git a/src/quick/doc/images/qml-extending-types.png b/src/quick/doc/images/qml-extending-types.png
deleted file mode 100644
index 6990d7c190..0000000000
--- a/src/quick/doc/images/qml-extending-types.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-animation.png b/src/quick/doc/images/qml-uses-animation.png
deleted file mode 100644
index b54361260c..0000000000
--- a/src/quick/doc/images/qml-uses-animation.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-integratingjs.png b/src/quick/doc/images/qml-uses-integratingjs.png
deleted file mode 100644
index 3bb0d8aadf..0000000000
--- a/src/quick/doc/images/qml-uses-integratingjs.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-layouts-anchors.png b/src/quick/doc/images/qml-uses-layouts-anchors.png
deleted file mode 100644
index 769597cf52..0000000000
--- a/src/quick/doc/images/qml-uses-layouts-anchors.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-layouts-direct.png b/src/quick/doc/images/qml-uses-layouts-direct.png
deleted file mode 100644
index 0682da36f8..0000000000
--- a/src/quick/doc/images/qml-uses-layouts-direct.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-layouts-positioners.png b/src/quick/doc/images/qml-uses-layouts-positioners.png
deleted file mode 100644
index ebdd9c58dd..0000000000
--- a/src/quick/doc/images/qml-uses-layouts-positioners.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-styling-text.png b/src/quick/doc/images/qml-uses-styling-text.png
deleted file mode 100644
index af2518a9e8..0000000000
--- a/src/quick/doc/images/qml-uses-styling-text.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-styling.png b/src/quick/doc/images/qml-uses-styling.png
deleted file mode 100644
index a6bf68e783..0000000000
--- a/src/quick/doc/images/qml-uses-styling.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-text.png b/src/quick/doc/images/qml-uses-text.png
deleted file mode 100644
index 6b3d88cb3f..0000000000
--- a/src/quick/doc/images/qml-uses-text.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-userinput.png b/src/quick/doc/images/qml-uses-userinput.png
deleted file mode 100644
index 2793e8d1d7..0000000000
--- a/src/quick/doc/images/qml-uses-userinput.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-visual-opacity.png b/src/quick/doc/images/qml-uses-visual-opacity.png
deleted file mode 100644
index ab238deb54..0000000000
--- a/src/quick/doc/images/qml-uses-visual-opacity.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-visual-rectangles.png b/src/quick/doc/images/qml-uses-visual-rectangles.png
deleted file mode 100644
index acf7cb160a..0000000000
--- a/src/quick/doc/images/qml-uses-visual-rectangles.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-visual-transforms.png b/src/quick/doc/images/qml-uses-visual-transforms.png
deleted file mode 100644
index d89fc75256..0000000000
--- a/src/quick/doc/images/qml-uses-visual-transforms.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index d9b4e03818..30861d9b2e 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -34,7 +34,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtquick/qtquick.tags
-depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist
+depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs
headerdirs += ..
@@ -58,3 +58,8 @@ sourcedirs += ../../imports
#add plugins directory because of dependencies
headerdirs += ../../plugins
sourcedirs += ../../plugins
+
+#exclude certain directories
+excludedirs += ../../imports/dialogs \
+ ../../imports/models \
+ ../../../examples/quick/dialogs
diff --git a/src/quick/doc/snippets/qml/codingconventions/dotproperties.qml b/src/quick/doc/snippets/qml/codingconventions/dotproperties.qml
deleted file mode 100644
index bbb40a77ee..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/dotproperties.qml
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Item {
-
-//! [0]
-Rectangle {
- anchors.left: parent.left; anchors.top: parent.top; anchors.right: parent.right; anchors.leftMargin: 20
-}
-
-Text {
- text: "hello"
- font.bold: true; font.italic: true; font.pixelSize: 20; font.capitalization: Font.AllUppercase
-}
-
-//! [0]
-
-//! [1]
-Rectangle {
- anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: 20 }
-}
-
-Text {
- text: "hello"
- font { bold: true; italic: true; pixelSize: 20; capitalization: Font.AllUppercase }
-}
-//! [1]
-
-}
diff --git a/src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml b/src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml
deleted file mode 100644
index fd8301cebe..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//![0]
-import "myscript.js" as Script
-
-Rectangle { color: "blue"; width: Script.calculateWidth(parent) }
-//![0]
diff --git a/src/quick/doc/snippets/qml/codingconventions/lists.qml b/src/quick/doc/snippets/qml/codingconventions/lists.qml
deleted file mode 100644
index c45129187e..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/lists.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Item {
- Item {
-//! [0]
-states: [
- State {
- name: "open"
- PropertyChanges { target: container; width: 200 }
- }
-]
-//! [0]
- }
- Item {
-//! [1]
-states: State {
- name: "open"
- PropertyChanges { target: container; width: 200 }
-}
-//! [1]
- }
-}
diff --git a/src/quick/doc/snippets/qml/codingconventions/myscript.js b/src/quick/doc/snippets/qml/codingconventions/myscript.js
deleted file mode 100644
index cfa646250b..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/myscript.js
+++ /dev/null
@@ -1,9 +0,0 @@
-function calculateWidth(parent)
-{
- var w = parent.width / 3
- // ...
- // more javascript code
- // ...
- console.debug(w)
- return w
-}
diff --git a/src/quick/doc/snippets/qml/codingconventions/photo.qml b/src/quick/doc/snippets/qml/codingconventions/photo.qml
deleted file mode 100644
index 5260f87127..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/photo.qml
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//! [0]
-Rectangle {
- id: photo // id on the first line makes it easy to find an object
-
- property bool thumbnail: false // property declarations
- property alias image: photoImage.source
-
- signal clicked // signal declarations
-
- function doSomething(x) // javascript functions
- {
- return x + photoImage.width
- }
-
- color: "gray" // object properties
- x: 20; y: 20; height: 150 // try to group related properties together
- width: { // large bindings
- if (photoImage.width > 200) {
- photoImage.width;
- } else {
- 200;
- }
- }
-
- Rectangle { // child objects
- id: border
- anchors.centerIn: parent; color: "white"
-
- Image { id: photoImage; anchors.centerIn: parent }
- }
-
- states: State { // states
- name: "selected"
- PropertyChanges { target: border; color: "red" }
- }
-
- transitions: Transition { // transitions
- from: ""; to: "selected"
- ColorAnimation { target: border; duration: 200 }
- }
-}
-//! [0]
-
diff --git a/src/quick/doc/snippets/qml/visualdatagroup.qml b/src/quick/doc/snippets/qml/colors.qml
index 4254b50e63..473df711bd 100644
--- a/src/quick/doc/snippets/qml/visualdatagroup.qml
+++ b/src/quick/doc/snippets/qml/colors.qml
@@ -37,45 +37,89 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
+
import QtQuick 2.0
Rectangle {
- width: 200; height: 100
+ width: 160; height: 250
+
+ Image {
+ width: 160; height: 200
+ source: "pics/checker.svg"
+ fillMode: Image.Tile
- VisualDataModel {
- id: visualModel
- model: ListModel {
- ListElement { name: "Apple" }
- ListElement { name: "Orange" }
+ //! [colors]
+ Rectangle {
+ color: "steelblue"
+ width: 40; height: 40
+ }
+ Rectangle {
+ color: "transparent"
+ y: 40; width: 40; height: 40
+ }
+ Rectangle {
+ color: "#FF0000"
+ y: 80; width: 40; height: 40
}
+ Rectangle {
+ color: "#800000FF"
+ y: 120; width: 40; height: 40
+ }
+ Rectangle {
+ color: "#00000000" // ARGB fully transparent
+ y: 160
+ width: 40; height: 40
+ }
+ //! [colors]
- groups: [
- VisualDataGroup { name: "selected" }
- ]
+ Rectangle {
+ x: 40
+ width: 120; height: 200
- delegate: Rectangle {
- id: item
- height: 25
- width: 200
Text {
- text: {
- var text = "Name: " + name
- if (item.VisualDataModel.inSelected)
- text += " (" + item.VisualDataModel.selectedIndex + ")"
- return text;
- }
+ font.pixelSize: 16
+ text: "steelblue"
+ x: 10; height: 40
+ verticalAlignment: Text.AlignVCenter
}
- MouseArea {
- anchors.fill: parent
- onClicked: item.VisualDataModel.inSelected = !item.VisualDataModel.inSelected
+ Text {
+ font.pixelSize: 16
+ text: "transparent"
+ x: 10; y: 40; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ Text {
+ font.pixelSize: 16
+ text: "FF0000"
+ x: 10; y: 80; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ Text {
+ font.pixelSize: 16
+ text: "800000FF"
+ x: 10; y: 120; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ Text {
+ font.pixelSize: 16
+ text: "00000000"
+ x: 10; y: 160; height: 40
+ verticalAlignment: Text.AlignVCenter
}
}
}
- ListView {
- anchors.fill: parent
- model: visualModel
+ Image {
+ y: 210
+ width: 40; height: 40
+ source: "pics/checker.svg"
+ fillMode: Image.Tile
+ }
+
+ Text {
+ font.pixelSize: 16
+ text: "(background)"
+ x: 50; y: 210; height: 40
+ verticalAlignment: Text.AlignVCenter
}
}
-//![0]
diff --git a/src/quick/doc/snippets/qml/text/onLinkActivated.qml b/src/quick/doc/snippets/qml/text/onLinkActivated.qml
index 9bb4d3a0bb..7a44dcc557 100644
--- a/src/quick/doc/snippets/qml/text/onLinkActivated.qml
+++ b/src/quick/doc/snippets/qml/text/onLinkActivated.qml
@@ -45,7 +45,7 @@ Rectangle {
//![0]
Text {
textFormat: Text.RichText
- text: "The main website is at <a href=\"http://qt.nokia.com\">Nokia Qt DF</a>."
+ text: "See the <a href=\"http://qt-project.org\">Qt Project website</a>."
onLinkActivated: console.log(link + " link activated")
}
//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/Button.qml b/src/quick/doc/snippets/qml/usecases/Button.qml
deleted file mode 100644
index 6c4c0f7cd3..0000000000
--- a/src/quick/doc/snippets/qml/usecases/Button.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Rectangle {
- id: container
- // The caption property is an alias to the text of the Text element, so Button users can set the text
- property alias caption: txt.text
- // The clicked signal is emitted whenever the button is clicked, so Button users can respond
- signal clicked
-
- // The button is set to have rounded corners and a thin black border
- radius: 4
- border.width: 1
- // This button has a fixed size, but it could resize based on the text
- width: 160
- height: 40
-
- // A SystemPalette is used to get colors from the system settings for the background
- SystemPalette { id: sysPalette }
-
- gradient: Gradient {
-
- // The top gradient is darker when 'pressed', all colors come from the system palette
- GradientStop { position: 0.0; color: ma.pressed ? sysPalette.dark : sysPalette.light }
-
- GradientStop { position: 1.0; color: sysPalette.button }
- }
-
- Text {
- id: txt
- // This is the default value of the text, but most Button users will set their own with the caption property
- text: "Button"
- font.bold: true
- font.pixelSize: 16
- anchors.centerIn: parent
- }
-
- MouseArea {
- id: ma
- anchors.fill: parent
- // This re-emits the clicked signal on the root item, so that Button users can respond to it
- onClicked: container.clicked()
- }
-}
-
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/MyText.qml b/src/quick/doc/snippets/qml/usecases/MyText.qml
deleted file mode 100644
index d58a4036bb..0000000000
--- a/src/quick/doc/snippets/qml/usecases/MyText.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Text {
- color: "lightsteelblue"
- font { family: 'Courier'; pixelSize: 20; bold: true; capitalization: Font.SmallCaps }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/animations.qml b/src/quick/doc/snippets/qml/usecases/animations.qml
deleted file mode 100644
index 1887acf901..0000000000
--- a/src/quick/doc/snippets/qml/usecases/animations.qml
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Column {
- //![states]
-
- Item {
- id: container
- width: 320
- height: 120
-
- Rectangle {
- id: rect
- color: "red"
- width: 120
- height: 120
-
- MouseArea {
- anchors.fill: parent
- onClicked: container.state == 'other' ? container.state = '' : container.state = 'other'
- }
- }
- states: [
- // This adds a second state to the container where the rectangle is farther to the right
-
- State { name: "other"
-
- PropertyChanges {
- target: rect
- x: 200
- }
- }
- ]
- transitions: [
- // This adds a transition that defaults to applying to all state changes
-
- Transition {
-
- // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- NumberAnimation { properties: "x,y" }
- }
- ]
- }
- //![states]
- //![behave]
- Item {
- width: 320
- height: 120
-
- Rectangle {
- color: "green"
- width: 120
- height: 120
-
- // This is the behavior, and it applies a NumberAnimation to any attempt to set the x property
- Behavior on x {
-
- NumberAnimation {
- //This specifies how long the animation takes
- duration: 600
- //This selects an easing curve to interpolate with, the default is Easing.Linear
- easing.type: Easing.OutBounce
- }
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: parent.x == 0 ? parent.x = 200 : parent.x = 0
- }
- }
- }
- //![behave]
- //![constant]
- Item {
- width: 320
- height: 120
-
- Rectangle {
- color: "blue"
- width: 120
- height: 120
-
- // By setting this SequentialAnimation on x, it and animations within it will automatically animate
- // the x property of this element
- SequentialAnimation on x {
- id: xAnim
- // Animations on properties start running by default
- running: false
- loops: Animation.Infinite // The animation is set to loop indefinitely
- NumberAnimation { from: 0; to: 200; duration: 500; easing.type: Easing.InOutQuad }
- NumberAnimation { from: 200; to: 0; duration: 500; easing.type: Easing.InOutQuad }
- PauseAnimation { duration: 250 } // This puts a bit of time between the loop
- }
-
- MouseArea {
- anchors.fill: parent
- // The animation starts running when you click within the rectangle
- onClicked: xAnim.running = true
- }
- }
- }
- //![constant]
-
- //![scripted]
- Item {
- width: 320
- height: 120
-
- Rectangle {
- id: rectangle
- color: "yellow"
- width: 120
- height: 120
-
- MouseArea {
- anchors.fill: parent
- // The animation starts running when you click within the rectange
- onClicked: anim.running = true;
- }
- }
-
- // This animation specifically targets the Rectangle's properties to animate
- SequentialAnimation {
- id: anim
- // Animations on their own are not running by default
- // The default number of loops is one, restart the animation to see it again
-
- NumberAnimation { target: rectangle; property: "x"; from: 0; to: 200; duration: 500 }
-
- NumberAnimation { target: rectangle; property: "x"; from: 200; to: 0; duration: 500 }
- }
- }
- //![scripted]
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml b/src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml
deleted file mode 100644
index 24758d4e09..0000000000
--- a/src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
- id: container
- width: 320
- height: 480
-
- function randomNumber() {
- return Math.random() * 360;
- }
-
- function getNumber() {
- return container.randomNumber();
- }
-
- MouseArea {
- anchors.fill: parent
- // This line uses the JS function from the item
- onClicked: rectangle.rotation = container.getNumber();
- }
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Rectangle {
- id: rectangle
- anchors.centerIn: parent
- width: 160
- height: 160
- color: "green"
- Behavior on rotation { RotationAnimation { direction: RotationAnimation.Clockwise } }
- }
-
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/integratingjs.qml b/src/quick/doc/snippets/qml/usecases/integratingjs.qml
deleted file mode 100644
index 9e7ed2a35b..0000000000
--- a/src/quick/doc/snippets/qml/usecases/integratingjs.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-import "myscript.js" as Logic
-
-Item {
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- MouseArea {
- anchors.fill: parent
- // This line uses the JS function from the separate JS file
- onClicked: rectangle.rotation = Logic.getRandom(rectangle.rotation);
- }
-
- Rectangle {
- id: rectangle
- anchors.centerIn: parent
- width: 160
- height: 160
- color: "green"
- Behavior on rotation { RotationAnimation { direction: RotationAnimation.Clockwise } }
- }
-
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/layouts.qml b/src/quick/doc/snippets/qml/usecases/layouts.qml
deleted file mode 100644
index e9483d2b9b..0000000000
--- a/src/quick/doc/snippets/qml/usecases/layouts.qml
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![import]
-import QtQuick 2.0
-
-//![import]
-
-Column {
-
-//![direct]
-Item {
- width: 100; height: 100
-
- Rectangle {
- // Manually positioned at 20,20
- x: 20
- y: 20
- width: 80
- height: 80
- color: "red"
- }
-}
-//![direct]
-
-//![anchors]
-Item {
- width: 200; height: 200
-
- Rectangle {
- // Anchored to 20px off the top right corner of the parent
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.margins: 20 // Sets all margins at once
-
- width: 80
- height: 80
- color: "orange"
- }
-
- Rectangle {
- // Anchored to 20px off the top center corner of the parent.
- // Notice the different group property syntax for 'anchors' compared to
- // the previous Rectangle. Both are valid.
- anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 20 }
-
- width: 80
- height: 80
- color: "green"
- }
-}
-//![anchors]
-
-//![positioners]
-Item {
- width: 300; height: 100
-
- Row { // The "Row" type lays out its child items in a horizontal line
- spacing: 20 // Places 20px of space between items
-
- Rectangle { width: 80; height: 80; color: "red" }
- Rectangle { width: 80; height: 80; color: "green" }
- Rectangle { width: 80; height: 80; color: "blue" }
- }
-}
-//![positioners]
-
-Item {
- width: 300; height: 400
-
- Rectangle {
- id: middleRect
- //This Rectangle has its y animated, for the others to follow
- x: 120
- y: 220
- SequentialAnimation on y {
- loops: -1
- NumberAnimation { from: 220; to: 380; easing.type: Easing.InOutQuad; duration: 1200 }
- NumberAnimation { from: 380; to: 220; easing.type: Easing.InOutQuad; duration: 1200 }
- }
- width: 80
- height: 80
- color: "green"
- }
- Rectangle {
- // x,y bound to the position of middleRect
- x: middleRect.x - 100
- y: middleRect.y
- width: 80
- height: 80
- color: "red"
- }
-
- Rectangle {
- // Anchored to the position of middleRect
- anchors.left: middleRect.right
- anchors.leftMargin: 20
- anchors.verticalCenter: middleRect.verticalCenter
- width: 80
- height: 80
- color: "blue"
- }
-}
-
-}
diff --git a/src/quick/doc/snippets/qml/usecases/myscript.js b/src/quick/doc/snippets/qml/usecases/myscript.js
deleted file mode 100644
index 84b0c801a2..0000000000
--- a/src/quick/doc/snippets/qml/usecases/myscript.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-// myscript.js
-function getRandom(previousValue) {
- return Math.floor(previousValue + Math.random() * 90) % 360;
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/styling-text.qml b/src/quick/doc/snippets/qml/usecases/styling-text.qml
deleted file mode 100644
index 0c68a11ad6..0000000000
--- a/src/quick/doc/snippets/qml/usecases/styling-text.qml
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
- id: root
- width: 480
- height: 320
-
- Rectangle {
- color: "#272822"
- width: 480
- height: 320
- }
-
-//![texts]
- Column {
- spacing: 20
-
- MyText { text: 'I am the very model of a modern major general!' }
-
- MyText { text: 'I\'ve information vegetable, animal and mineral.' }
-
- MyText {
- width: root.width
- wrapMode: Text.WordWrap
- text: 'I know the kings of England and I quote the fights historical:'
- }
-
- MyText { text: 'From Marathon to Waterloo in order categorical.' }
- }
-//![texts]
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/styling.qml b/src/quick/doc/snippets/qml/usecases/styling.qml
deleted file mode 100644
index b46b9e3d55..0000000000
--- a/src/quick/doc/snippets/qml/usecases/styling.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Column {
- width: childrenRect.width
- anchors.centerIn: parent
- spacing: 8
- // Each of these is a Button as styled in Button.qml
- Button { caption: "Eeny"; onClicked: console.log("Eeny");}
- Button { caption: "Meeny"; onClicked: console.log("Meeny");}
- Button { caption: "Miny"; onClicked: console.log("Miny");}
- Button { caption: "Mo"; onClicked: console.log("Mo");}
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/text.qml b/src/quick/doc/snippets/qml/usecases/text.qml
deleted file mode 100644
index c7adc12763..0000000000
--- a/src/quick/doc/snippets/qml/usecases/text.qml
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
- id: root
- width: 480
- height: 320
-
- Rectangle {
- color: "#272822"
- width: 480
- height: 320
- }
-
- Column {
- spacing: 20
-
- Text {
- text: 'I am the very model of a modern major general!'
-
- // color can be set on the entire element with this property
- color: "yellow"
-
- }
-
- Text {
- // For text to wrap, a width has to be explicitly provided
- width: root.width
-
- // This setting makes the text wrap at word boundaries when it goes past the width of the Text object
- wrapMode: Text.WordWrap
-
- // You can use \ to escape quotation marks, or to add new lines (\n). Use \\ to get a \ in the string
- text: 'I am the very model of a modern major general. I\'ve information vegetable, animal and mineral. I know the kings of england and I quote the fights historical; from Marathon to Waterloo in order categorical.'
-
- // color can be set on the entire element with this property
- color: "white"
-
- }
-
- Text {
- text: 'I am the very model of a modern major general!'
-
- // color can be set on the entire element with this property
- color: "yellow"
-
- // font properties can be set effciently on the whole string at once
- font { family: 'Courier'; pixelSize: 20; italic: true; capitalization: Font.SmallCaps }
-
- }
-
- Text {
- // HTML like markup can also be used
- text: '<font color="white">I am the <b>very</b> model of a modern <i>major general</i>!</font>'
-
- // This could also be written font { pointSize: 14 }. Both syntaxes are valid.
- font.pointSize: 14
-
- // StyledText format supports fewer tags, but is more efficient than RichText
- textFormat: Text.StyledText
-
- }
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/userinput-keys.qml b/src/quick/doc/snippets/qml/usecases/userinput-keys.qml
deleted file mode 100644
index 73b42b2f59..0000000000
--- a/src/quick/doc/snippets/qml/usecases/userinput-keys.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
- id: root
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Rectangle {
- id: rectangle
- x: 40
- y: 20
- width: 120
- height: 120
- color: "red"
-
- focus: true
- Keys.onUpPressed: rectangle.y -= 10
- Keys.onDownPressed: rectangle.y += 10
- Keys.onLeftPressed: rectangle.x += 10
- Keys.onRightPressed: rectangle.x -= 10
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/userinput.qml b/src/quick/doc/snippets/qml/usecases/userinput.qml
deleted file mode 100644
index 5aabcde18e..0000000000
--- a/src/quick/doc/snippets/qml/usecases/userinput.qml
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
- id: root
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Rectangle {
- id: rectangle
- x: 40
- y: 20
- width: 120
- height: 120
- color: "red"
-
- MouseArea {
- anchors.fill: parent
- onClicked: rectangle.width += 10
- }
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/visual-opacity.qml b/src/quick/doc/snippets/qml/usecases/visual-opacity.qml
deleted file mode 100644
index d5a1e6f91f..0000000000
--- a/src/quick/doc/snippets/qml/usecases/visual-opacity.qml
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Item {
- x: 20
- y: 270
- width: 200
- height: 200
- MouseArea {
- anchors.fill: parent
- onClicked: topRect.visible = !topRect.visible
- }
- Rectangle {
- x: 20
- y: 20
- width: 100
- height: 100
- color: "red"
- }
- Rectangle {
- id: topRect
- opacity: 0.5
-
- x: 100
- y: 100
- width: 100
- height: 100
- color: "blue"
- }
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/visual-rects.qml b/src/quick/doc/snippets/qml/usecases/visual-rects.qml
deleted file mode 100644
index 16cfd7bae5..0000000000
--- a/src/quick/doc/snippets/qml/usecases/visual-rects.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- // This element displays a rectangle with a gradient and a border
- Rectangle {
- x: 160
- y: 20
- width: 100
- height: 100
- radius: 8 // This gives rounded corners to the Rectangle
- gradient: Gradient { // This sets a vertical gradient fill
- GradientStop { position: 0.0; color: "aqua" }
- GradientStop { position: 1.0; color: "teal" }
- }
- border { width: 3; color: "white" } // This sets a 3px wide black border to be drawn
- }
-
- // This rectangle is a plain color with no border
- Rectangle {
- x: 40
- y: 20
- width: 100
- height: 100
- color: "red"
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/visual-transforms.qml b/src/quick/doc/snippets/qml/usecases/visual-transforms.qml
deleted file mode 100644
index 924f4b79ff..0000000000
--- a/src/quick/doc/snippets/qml/usecases/visual-transforms.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Rectangle {
- rotation: 45 // This rotates the Rectangle by 45 degrees
- x: 20
- y: 160
- width: 100
- height: 100
- color: "blue"
- }
- Rectangle {
- scale: 0.8 // This scales the Rectangle down to 80% size
- x: 160
- y: 160
- width: 100
- height: 100
- color: "green"
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/visual.qml b/src/quick/doc/snippets/qml/usecases/visual.qml
deleted file mode 100644
index fe381136cb..0000000000
--- a/src/quick/doc/snippets/qml/usecases/visual.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![0]
-import QtQuick 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- //![image]
- // This element displays an image. Because the source is online, it may take some time to fetch
- Image {
- x: 40
- y: 20
- width: 61
- height: 73
- source: "http://codereview.qt-project.org/static/logo_qt.png"
- }
- //![image]
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/visualdatamodel.qml b/src/quick/doc/snippets/qml/visualdatamodel.qml
deleted file mode 100644
index 0513c5b5f2..0000000000
--- a/src/quick/doc/snippets/qml/visualdatamodel.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//![0]
-import QtQuick 2.0
-
-Rectangle {
- width: 200; height: 100
-
- VisualDataModel {
- id: visualModel
- model: ListModel {
- ListElement { name: "Apple" }
- ListElement { name: "Orange" }
- }
- delegate: Rectangle {
- height: 25
- width: 100
- Text { text: "Name: " + name}
- }
- }
-
- ListView {
- anchors.fill: parent
- model: visualModel
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp b/src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp
deleted file mode 100644
index da1086146c..0000000000
--- a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QQuickView>
-#include <QQmlContext>
-
-#include <QApplication>
-#include <QDirModel>
-
-//![0]
-int main(int argc, char ** argv)
-{
- QApplication app(argc, argv);
-
- QQuickView view;
-
- QDirModel model;
- view.rootContext()->setContextProperty("dirModel", &model);
-
- view.setSource(QUrl::fromLocalFile("view.qml"));
- view.show();
-
- return app.exec();
-}
-//![0]
-
diff --git a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml b/src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml
deleted file mode 100644
index 1e8cfade96..0000000000
--- a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//![0]
-import QtQuick 2.0
-
-ListView {
- id: view
- width: 300
- height: 400
-
- model: VisualDataModel {
- model: dirModel
-
- delegate: Rectangle {
- width: 200; height: 25
- Text { text: filePath }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (model.hasModelChildren)
- view.model.rootIndex = view.model.modelIndex(index)
- }
- }
- }
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/codingconventions/javascript.qml b/src/quick/doc/snippets/qml/xmlrole.qml
index 72c954f699..0f75135da2 100644
--- a/src/quick/doc/snippets/qml/codingconventions/javascript.qml
+++ b/src/quick/doc/snippets/qml/xmlrole.qml
@@ -39,35 +39,43 @@
****************************************************************************/
import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
Rectangle {
+ width: 300; height: 200
//![0]
-Rectangle { color: "blue"; width: parent.width / 3 }
+XmlListModel {
+ id: model
//![0]
+ source: "xmlrole.xml"
//![1]
-Rectangle {
- color: "blue"
- width: {
- var w = parent.width / 3
- console.debug(w)
- return w
- }
+ // XmlRole queries will be made on <book> elements
+ query: "/catalogue/book"
+
+ // query the book title
+ XmlRole { name: "title"; query: "title/string()" }
+
+ // query the book's year
+ XmlRole { name: "year"; query: "year/number()" }
+
+ // query the book's type (the '@' indicates 'type' is an attribute, not an element)
+ XmlRole { name: "type"; query: "@type/string()" }
+
+ // query the book's first listed author (note in XPath the first index is 1, not 0)
+ XmlRole { name: "first_author"; query: "author[1]/string()" }
}
//![1]
-//![2]
-function calculateWidth(object)
-{
- var w = object.width / 3
- // ...
- // more javascript code
- // ...
- console.debug(w)
- return w
+ListView {
+ width: 300; height: 200
+ model: model
+ delegate: Column {
+ Text { text: title + " (" + type + ")"; font.bold: true }
+ Text { text: first_author }
+ Text { text: year }
+ }
}
-Rectangle { color: "blue"; width: calculateWidth(parent) }
-//![2]
}
diff --git a/src/quick/doc/src/advtutorial.qdoc b/src/quick/doc/src/advtutorial.qdoc
index 966233c371..80a0173f32 100644
--- a/src/quick/doc/src/advtutorial.qdoc
+++ b/src/quick/doc/src/advtutorial.qdoc
@@ -27,7 +27,6 @@
/*!
\page qml-advtutorial.html tutorial
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial
\brief A more advanced tutorial, showing how to use QML to create a game.
\nextpage QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
@@ -65,7 +64,6 @@ directory.
/*!
\page qml-advtutorial1.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial
@@ -83,7 +81,7 @@ To begin with, we create our Same Game application with a main screen like this:
This is defined by the main application file, \c samegame.qml, which looks like this:
-\snippet quick/tutorials/samegame/samegame1/samegame.qml 0
+\snippet tutorials/samegame/samegame1/samegame.qml 0
This gives you a basic game window that includes the main canvas for the
blocks, a "New Game" button and a score display.
@@ -101,7 +99,7 @@ The \c Button item in the code above is defined in a separate component file nam
To create a functional button, we use the QML types \l Text and \l MouseArea inside a \l Rectangle.
Here is the \c Button.qml code:
-\snippet quick/tutorials/samegame/samegame1/Button.qml 0
+\snippet tutorials/samegame/samegame1/Button.qml 0
This essentially defines a rectangle that contains text and can be clicked. The \l MouseArea
has an \c onClicked() handler that is implemented to emit the \c clicked() signal of the
@@ -111,7 +109,7 @@ In Same Game, the screen is filled with small blocks when the game begins.
Each block is just an item that contains an image. The block
code is defined in a separate \c Block.qml file:
-\snippet quick/tutorials/samegame/samegame1/Block.qml 0
+\snippet tutorials/samegame/samegame1/Block.qml 0
At the moment, the block doesn't do anything; it is just an image. As the
tutorial progresses we will animate and give behaviors to the blocks.
@@ -135,7 +133,6 @@ types to get started. Next, we will populate the game canvas with some blocks.
/*!
\page qml-advtutorial2.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 2 - Populating the Game Canvas
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
@@ -156,7 +153,7 @@ create the blocks in JavaScript.
Here is the JavaScript code for generating the blocks, contained in a new
file, \c samegame.js. The code is explained below.
-\snippet quick/tutorials/samegame/samegame2/samegame.js 0
+\snippet tutorials/samegame/samegame2/samegame.js 0
The \c startNewGame() function deletes the blocks created in the previous game and
calculates the number of rows and columns of blocks required to fill the game window for the new game.
@@ -168,7 +165,7 @@ and moves the new block to its position on the game canvas. This involves severa
\list
-\li \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to
+\li \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} is called to
generate a type from \c Block.qml. If the component is ready,
we can call \c createObject() to create an instance of the \c Block
item.
@@ -192,14 +189,14 @@ Now we need to call the JavaScript code in \c samegame.js from our QML files.
To do this, we add this line to \c samegame.qml which imports
the JavaScript file as a \l{QML Modules}{module}:
-\snippet quick/tutorials/samegame/samegame2/samegame.qml 2
+\snippet tutorials/samegame/samegame2/samegame.qml 2
This allows us to refer to any functions within \c samegame.js using "SameGame"
as a prefix: for example, \c SameGame.startNewGame() or \c SameGame.createBlock().
This means we can now connect the New Game button's \c onClicked handler to the \c startNewGame()
function, like this:
-\snippet quick/tutorials/samegame/samegame2/samegame.qml 1
+\snippet tutorials/samegame/samegame2/samegame.qml 1
So, when you click the New Game button, \c startNewGame() is called and generates a field of blocks, like this:
@@ -211,7 +208,6 @@ Now, we have a screen of blocks, and we can begin to add the game mechanics.
/*!
\page qml-advtutorial3.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 3 - Implementing the Game Logic
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial 2 - Populating the Game Canvas
@@ -241,7 +237,7 @@ As this is a tutorial about QML, not game design, we will only discuss \c handle
To make it easier for the JavaScript code to interface with the QML types, we have added an Item called \c gameCanvas to \c samegame.qml. It replaces the background as the item which contains the blocks. It also accepts mouse input from the user. Here is the item code:
-\snippet quick/tutorials/samegame/samegame3/samegame.qml 1
+\snippet tutorials/samegame/samegame3/samegame.qml 1
The \c gameCanvas item is the exact size of the board, and has a \c score property and a \l MouseArea to handle mouse clicks.
The blocks are now created as its children, and its dimensions are used to determine the board size so that
@@ -251,7 +247,7 @@ Note that it can still be accessed from the script.
When clicked, the \l MouseArea calls \c{handleClick()} in \c samegame.js, which determines whether the player's click should cause any blocks to be removed, and updates \c gameCanvas.score with the current score if necessary. Here is the \c handleClick() function:
-\snippet quick/tutorials/samegame/samegame3/samegame.js 1
+\snippet tutorials/samegame/samegame3/samegame.js 1
Note that if \c score was a global variable in the \c{samegame.js} file you would not be able to bind to it. You can only bind to QML properties.
@@ -259,17 +255,17 @@ Note that if \c score was a global variable in the \c{samegame.js} file you woul
When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls \c victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code:
-\snippet quick/tutorials/samegame/samegame3/samegame.js 2
+\snippet tutorials/samegame/samegame3/samegame.js 2
This updates the \c gameCanvas.score value and displays a "Game Over" dialog if the game is finished.
The Game Over dialog is created using a \c Dialog type that is defined in \c Dialog.qml. Here is the \c Dialog.qml code. Notice how it is designed to be usable imperatively from the script file, via the functions and signals:
-\snippet quick/tutorials/samegame/samegame3/Dialog.qml 0
+\snippet tutorials/samegame/samegame3/Dialog.qml 0
And this is how it is used in the main \c samegame.qml file:
-\snippet quick/tutorials/samegame/samegame3/samegame.qml 2
+\snippet tutorials/samegame/samegame3/samegame.qml 2
We give the dialog a \l {Item::z}{z} value of 100 to ensure it is displayed on top of our other components. The default \c z value for an item is 0.
@@ -278,7 +274,7 @@ We give the dialog a \l {Item::z}{z} value of 100 to ensure it is displayed on t
It's not much fun to play Same Game if all the blocks are the same color, so we've modified the \c createBlock() function in \c samegame.js to randomly create a different type of block (for either red, green or blue) each time it is called. \c Block.qml has also changed so that each block contains a different image depending on its type:
-\snippet quick/tutorials/samegame/samegame3/Block.qml 0
+\snippet tutorials/samegame/samegame3/Block.qml 0
\section2 A working game
@@ -290,7 +286,7 @@ Here is a screenshot of what has been accomplished so far:
This is what \c samegame.qml looks like now:
-\snippet quick/tutorials/samegame/samegame3/samegame.qml 0
+\snippet tutorials/samegame/samegame3/samegame.qml 0
The game works, but it's a little boring right now. Where are the smooth animated transitions? Where are the high scores?
If you were a QML expert you could have written these in the first iteration, but in this tutorial they've been saved
@@ -300,7 +296,6 @@ until the next chapter - where your application becomes alive!
/*!
\page qml-advtutorial4.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 4 - Finishing Touches
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial 3 - Implementing the Game Logic
@@ -324,7 +319,7 @@ In \c BoomBlock.qml, we apply a \l SpringAnimation behavior to the \c x and \c y
block will follow and animate its movement in a spring-like fashion towards the specified position (whose
values will be set by \c samegame.js).Here is the code added to \c BoomBlock.qml:
-\snippet quick/tutorials/samegame/samegame4/content/BoomBlock.qml 1
+\snippet tutorials/samegame/samegame4/content/BoomBlock.qml 1
The \c spring and \c damping values can be changed to modify the spring-like effect of the animation.
@@ -341,7 +336,7 @@ animate the opacity value so that it gradually fades in and out, instead of abru
visible and invisible. To do this, we'll apply a \l Behavior on the \c opacity property of the \c Image
type in \c BoomBlock.qml:
-\snippet quick/tutorials/samegame/samegame4/content/BoomBlock.qml 2
+\snippet tutorials/samegame/samegame4/content/BoomBlock.qml 2
Note the \c{opacity: 0} which means the block is transparent when it is first created. We could set the opacity
in \c samegame.js when we create and destroy the blocks,
@@ -367,14 +362,14 @@ To fade out, we set \c dying to true instead of setting opacity to 0 when a bloc
Finally, we'll add a cool-looking particle effect to the blocks when they are destroyed. To do this, we first add a \l ParticleSystem in
\c BoomBlock.qml, like so:
-\snippet quick/tutorials/samegame/samegame4/content/BoomBlock.qml 3
+\snippet tutorials/samegame/samegame4/content/BoomBlock.qml 3
To fully understand this you should read the \l Particles documentation, but it's important to note that \c emitRate is set
to zero so that particles are not emitted normally.
Also, we extend the \c dying State, which creates a burst of particles by calling the \c burst() method on the particles type. The code for the states now look
like this:
-\snippet quick/tutorials/samegame/samegame4/content/BoomBlock.qml 4
+\snippet tutorials/samegame/samegame4/content/BoomBlock.qml 4
Now the game is beautifully animated, with subtle (or not-so-subtle) animations added for all of the
player's actions. The end result is shown below, with a different set of images to demonstrate basic theming:
@@ -391,32 +386,32 @@ To do this, we will show a dialog when the game is over to request the player's
This requires a few changes to \c Dialog.qml. In addition to a \c Text type, it now has a
\c TextInput child item for receiving keyboard text input:
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 0
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 0
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 2
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 2
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 3
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 3
We'll also add a \c showWithInput() function. The text input will only be visible if this function
is called instead of \c show(). When the dialog is closed, it emits a \c closed() signal, and
other types can retrieve the text entered by the user through an \c inputText property:
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 0
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 1
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 0
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 1
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 3
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 3
Now the dialog can be used in \c samegame.qml:
-\snippet quick/tutorials/samegame/samegame4/samegame.qml 0
+\snippet tutorials/samegame/samegame4/samegame.qml 0
When the dialog emits the \c closed signal, we call the new \c saveHighScore() function in \c samegame.js, which stores the high score locally in an SQL database and also send the score to an online database if possible.
The \c nameInputDialog is activated in the \c victoryCheck() function in \c samegame.js:
-\snippet quick/tutorials/samegame/samegame4/content/samegame.js 3
+\snippet tutorials/samegame/samegame4/content/samegame.js 3
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/samegame.js 4
+\snippet tutorials/samegame/samegame4/content/samegame.js 4
\section3 Storing high scores offline
@@ -424,7 +419,7 @@ Now we need to implement the functionality to actually save the High Scores tabl
Here is the \c saveHighScore() function in \c samegame.js:
-\snippet quick/tutorials/samegame/samegame4/content/samegame.js 2
+\snippet tutorials/samegame/samegame4/content/samegame.js 2
First we call \c sendHighScore() (explained in the section below) if it is possible to send the high scores to an online database.
@@ -443,7 +438,7 @@ If the player entered their name we can send the data to the web service us
If the player enters a name, we send the data to the service using this code in \c samegame.js:
-\snippet quick/tutorials/samegame/samegame4/content/samegame.js 1
+\snippet tutorials/samegame/samegame4/content/samegame.js 1
The \l XMLHttpRequest in this code is the same as the \c XMLHttpRequest() as you'll find in standard browser JavaScript, and can be used in the same way to dynamically get XML
or QML from the web service to display the high scores. We don't worry about the response in this case - we just post the high
diff --git a/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc b/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc
deleted file mode 100644
index c1b5a937a0..0000000000
--- a/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-applicationdevelopers.html
-\title QML Application Developer Resources
-\brief Essential documentation for QML application developers
-
-QML is a declarative language that allows user interfaces to be described in
-terms of their visual components and how they interact and relate with one
-another. It is a highly readable language that was designed to enable
-components to be interconnected in a dynamic manner, and it allows components
-to be easily reused and customized within a user interface. Using the
-\c QtQuick module, designers and developers can easily build fluid animated
-user interfaces in QML, and have the option of connecting these user
-interfaces to any back-end C++ libraries.
-
-This page links to all the information you need to start developing
-applications with \l{Qt QML}{QML} and \l{Qt Quick}.
-
-\section2 Other QML modules
-
-Qt Quick only provides basic visual types, much of Qt's functionality is exposed to QML
-through other modules. If you require the functionality of those modules, you should browse
-their QML documentation. Qt Essentials modules exposing QML types include:
-
-\list
-\li \l QtMultimedia for playing and managing multimedia content and cameras.
-\li \l QtWebkit for rendering web content.
-\endlist
-
-\section1 Quick Start
-
-\list
-\li \l{qtquick-quickstart-basics.html}{QML Basics}
- \list
- \li \l{qtquick-quickstart-basics.html#creating-a-qml-document}{Creating a QML Document}
- \li \l{qtquick-quickstart-basics.html#loading-and-displaying-the-qml-document}{Loading and Displaying the QML Document}
- \endlist
-\li \l{qtquick-quickstart-essentials.html}{QML Essentials}
- \list
- \li \l{qtquick-quickstart-essentials.html#handling-user-input}{Handling User Input}
- \li \l{qtquick-quickstart-essentials.html#property-bindings}{Property Bindings}
- \li \l{qtquick-quickstart-essentials.html#animations}{Animations}
- \li \l{qtquick-quickstart-essentials.html#defining-custom-qml-types-for-re-use}{Defining Custom QML Types for Re-use}
- \endlist
-\endlist
-
-\section1 Code Samples and Demos
-
-To learn more about uses of QML code, there are several code samples which show
-how QML types are used. In addition, there are several demos which show how
-QML code is used in applications.
-
-\list
-\li \l{Qt Quick Code Samples}
-\li \l{QML Demos}
-\endlist
-\section1 Features And Use-Case Solutions
-
-\list
-\li \l{qtquick-usecase-visual.html}{Visual types in QML}
-\li \l{qtquick-usecase-userinput.html}{Responding to User Input in QML}
-\li \l{qtquick-usecase-animations.html}{Animations in QML}
-\li \l{qtquick-usecase-text.html}{Displaying Text in QML}
-\li \l{qtquick-usecase-layouts.html}{Layouts in QML}
-\li \l{qtquick-usecase-styling.html}{Style and Theme Support}
-\li \l{qtquick-usecase-integratingjs.html}{Integrating JavaScript in QML}
-\endlist
-
-
-\section1 In-Depth Documentation
-
-\section2 What is QML?
-
-QML is a user interface specification and programming language.
-It allows developers and designers alike to create highly performant, fluidly
-animated and visually appealing applications. QML offers a highly readable,
-declarative, JSON-like syntax with support for imperative JavaScript
-expressions combined with dynamic property bindings.
-
-The QML language and engine infrastructure is provided by the \l {Qt QML} module.
-For in-depth information about the QML language, please see the
-\l{Qt QML} module documentation.
-
-\section2 What is Qt Quick?
-
-Qt Quick is the standard library of types and functionality for QML. It
-includes visual types, interactive types, animations, models and views,
-particle effects and shader effects. A QML application developer can get
-access to all of that functionality with a single import statement.
-
-The \c QtQuick QML library is provided by the \l{Qt Quick} module.
-For in-depth information about the various QML types and other functionality
-provided by Qt Quick, please see the \l{Qt Quick} module documentation.
-
-\section1 Advanced Application Development Topics
-
-\list
-\li \l{qtquick-deployment.html}{Deploying QML Applications}
-\li \l{qtquick-performance.html}{Performance Considerations and Suggestions}
-\li \l{qtquick-internationalization.html}{Internationalization and Localization}
-\li Testing and Debugging
- \list
- \li \l{qtquick-qmlscene.html}{Prototyping with qmlscene}
- \li \l{qtquick-debugging.html}{Debugging QML Applications}
- \li \l{qtquick-qtquicktest.html}{Qt Quick Test: QML Unit Testing Framework}
- \endlist
-\li \l{qml-codingconventions.html}{QML Coding Conventions}
-\li \l{qtquick-glossary.html}{Glossary of Terms}
-\endlist
-
-\section1 Release Notes and Porting Guides
-
-\list
-\li \l{Qt QML Release Notes}
-\li \l{Qt Quick Release Notes}
-\li \l{Porting QML Applications to Qt 5}
-\endlist
-
-*/
diff --git a/src/quick/doc/src/appdevguide/codingconventions.qdoc b/src/quick/doc/src/appdevguide/codingconventions.qdoc
deleted file mode 100644
index 385c00d2a6..0000000000
--- a/src/quick/doc/src/appdevguide/codingconventions.qdoc
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qml-codingconventions.html
-\title QML Coding Conventions
-\brief code style convention
-
-This document contains the QML coding conventions that we follow in our documentation and examples and recommend that others follow.
-
-\section1 QML Object Declarations
-
-Throughout our documentation and examples, \l{QML Object Attributes}{QML object attributes} are always structured in the following order:
-
-\list
-\li id
-\li property declarations
-\li signal declarations
-\li JavaScript functions
-\li object properties
-\li child objects
-\li states
-\li transitions
-\endlist
-
-For better readability, we separate these different parts with an empty line.
-
-
-For example, a hypothetical \e photo QML object would look like this:
-
-\snippet qml/codingconventions/photo.qml 0
-
-
-\section1 Grouped Properties
-
-If using multiple properties from a group of properties,
-consider using \e {group notation} instead of \e {dot notation} if it
-improves readability.
-
-For example, this:
-
-\snippet qml/codingconventions/dotproperties.qml 0
-
-could be written like this:
-
-\snippet qml/codingconventions/dotproperties.qml 1
-
-
-\section1 Lists
-
-If a list contains only one element, we generally omit the square brackets.
-
-For example, it is very common for a component to only have one state.
-
-In this case, instead of:
-
-\snippet qml/codingconventions/lists.qml 0
-
-we will write this:
-
-\snippet qml/codingconventions/lists.qml 1
-
-
-\section1 JavaScript Code
-
-If the script is a single expression, we recommend writing it inline:
-
-\snippet qml/codingconventions/javascript.qml 0
-
-If the script is only a couple of lines long, we generally use a block:
-
-\snippet qml/codingconventions/javascript.qml 1
-
-If the script is more than a couple of lines long or can be used by different objects, we recommend creating a function and calling it like this:
-
-\snippet qml/codingconventions/javascript.qml 2
-
-For long scripts, we will put the functions in their own JavaScript file and import it like this:
-
-\snippet qml/codingconventions/javascript-imports.qml 0
-
-*/
diff --git a/src/quick/doc/src/appdevguide/debugging.qdoc b/src/quick/doc/src/appdevguide/debugging.qdoc
deleted file mode 100644
index 94ce13459c..0000000000
--- a/src/quick/doc/src/appdevguide/debugging.qdoc
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-debugging.html
-\ingroup qtquick-tools
-\title Debugging QML Applications
-\brief debugging tools in QML
-
-\section1 Console API
-
-\section2 Log
-
-\c console.log, console.debug, console.info, console.warn and console.error can be used to print
-debugging information to the console. For example:
-
-\code
-function f(a, b) {
- console.log("a is ", a, "b is ", b);
-}
-\endcode
-
-The output is generated using the qDebug, qWarning, qCritical methods in C++
-(see also http://doc.qt.nokia.com/latest/debug.html#warning-and-debugging-messages).
-
-Setting the environment variable QML_CONSOLE_EXTENDED also prints the source
-code location of the call.
-
-\section2 Assert
-
-\c console.assert tests that an expression is true. If not, it will write an optional message
-to the console and print the stack trace.
-
-\code
-function f() {
- var x = 12
- console.assert(x == 12, "This will pass");
- console.assert(x > 12, "This will fail");
-}
-\endcode
-
-\section2 Timer
-
-\c console.time and console.timeEnd log the time (in milliseconds) that was spent between
-the calls. Both take a string argument that identifies the measurement. For example:
-
-\code
-function f() {
- console.time("wholeFunction");
- console.time("firstPart");
- // first part
- console.timeEnd("firstPart");
- // second part
- console.timeEnd("wholeFunction");
-}
-\endcode
-
-\section2 Trace
-
-\c console.trace prints the stack trace of JavaScript execution at the point where
-it was called. The stack trace info contains function name, file name, line number
-and column number. The stack trace is limited to last 10 stack frames.
-
-\section2 Count
-
-\c console.count prints the current number of times a particular piece of code has been executed,
-along with a message. That is,
-
-\code
-function f() {
- console.count("f called");
-}
-\endcode
-
-will print \c{f called: 1}, \c{f called: 2} ... whenever \c{f()} is executed.
-
-\section2 Profile
-
-\c console.profile turns on the QML and JavaScript profilers. Nested calls are not
-supported and a warning will be printed to the console.
-
-\c console.profileEnd turns off the QML and JavaScript profilers. Calling this function
-without a previous call to console.profile will print a warning to the console. A
-profiling client should have been attached before this call to receive and store the
-profiling data. For example:
-
-\code
-function f() {
- console.profile();
- //Call some function that needs to be profiled.
- //Ensure that a client is attached before ending
- //the profiling session.
- console.profileEnd();
-}
-\endcode
-
-\section2 Exception
-
-\c console.exception prints an error message together with the stack trace of JavaScript
-execution at the point where it is called.
-
-\section1 Debugging module imports
-
-The \c QML_IMPORT_TRACE environment variable can be set to enable debug output
-from QML's import loading mechanisms.
-
-For example, for a simple QML file like this:
-
-\qml
-import QtQuick 2.0
-
-Rectangle { width: 100; height: 100 }
-\endqml
-
-If you set \c {QML_IMPORT_TRACE=1} before running the \l{qtquick-qmlscene.html}
-{QML Scene} (or your QML C++ application), you will see output similar to this:
-
-\code
-QQmlImportDatabase::addImportPath "/qt-sdk/imports"
-QQmlImportDatabase::addImportPath "/qt-sdk/bin/QMLViewer.app/Contents/MacOS"
-QQmlImportDatabase::addToImport 0x106237370 "." -1.-1 File as ""
-QQmlImportDatabase::addToImport 0x106237370 "Qt" 4.7 Library as ""
-QQmlImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle"
-\endcode
-
-
-\section1 Debugging with Qt Creator
-
-\l{http://qt.nokia.com/products/developer-tools}{Qt Creator} provides built-in
-support for QML debugging. QML projects and standalone C++ applications that
-utilize QML can be debugged on desktops as well as on remote devices.
-For more information, see the Qt Creator Manual.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/deployment.qdoc b/src/quick/doc/src/appdevguide/deployment.qdoc
deleted file mode 100644
index 1c8bd20c4d..0000000000
--- a/src/quick/doc/src/appdevguide/deployment.qdoc
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-deployment.html
-\title Deploying QML Applications
-\brief process of deploying QML applications
-
-
-
-QML documents are loaded and executed by the QML runtime. This includes the
-Declarative UI engine along with the built-in QML types and plugin modules,
-and it also provides access to third-party QML types and modules.
-
-Applications that use QML need to invoke the QML runtime in order to
-execute QML documents. This can be done by creating a QQuickView
-or a QQmlEngine, as described below. In addition, the Declarative UI
-package includes the qmlscene tool, which loads \c .qml files. This tool is
-useful for developing and testing QML code without the need to write
-a C++ application to load the QML runtime.
-
-
-
-\section1 Deploying QML-based applications
-
-To deploy an application that uses QML, the QML runtime must be invoked by
-the application. This is done by writing a Qt C++ application that loads the
-QQmlEngine by either:
-
-\list
-\li Loading the QML file through a QQuickView instance, or
-\li Creating a QQmlEngine instance and loading QML files with QQmlComponent
-\endlist
-
-
-\section2 Deploying with QQuickView
-
-QQuickView is a QWindow-based class that is able to load QML files.
-For example, if there is a QML file, \c application.qml, like this:
-
-\qml
- import QtQuick 2.0
-
- Rectangle { width: 100; height: 100; color: "red" }
-\endqml
-
-It can be loaded in a Qt application's \c main.cpp file like this:
-
-\code
- #include <QGuiApplication>
- #include <QQuickView>
-
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
-
- QQuickView view;
- view.setSource(QUrl::fromLocalFile("application.qml"));
- view.show();
-
- return app.exec();
- }
-\endcode
-
-This creates a QWindow-based view that displays the contents of
-\c application.qml.
-
-The application's \c .pro \l{qmake Project Files}{project file} must specify
-the \c declarative module for the \c QT variable. For example:
-
-\code
- TEMPLATE += app
- QT += quick
- SOURCES += main.cpp
-\endcode
-
-
-\section2 Creating a QQmlEngine directly
-
-If \c application.qml does not have any graphical components, or if it is
-preferred to avoid QQuickView for other reasons, the QQmlEngine
-can be constructed directly instead. In this case, \c application.qml is
-loaded as a QQmlComponent instance rather than placed into a view:
-
-\code
- #include <QGuiApplication>
- #include <QQmlEngine>
- #include <QQmlContext>
- #include <QQmlComponent>
-
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
-
- QQmlEngine engine;
- QQmlContext *objectContext = new QQmlContext(engine.rootContext());
-
- QQmlComponent component(&engine, "application.qml");
- QObject *object = component.create(objectContext);
-
- // ... delete object and objectContext when necessary
-
- return app.exec();
- }
-\endcode
-
-QGuiApplication can be replaced by a QCoreApplication in the code above in case you are not
-using any graphical items from Qt Quick. This allows using QML as a language without any
-dependencies to the Qt Gui module.
-
-See \l{qtqml-cppintegration-data.html}{qtqml-cppintegration-exposecppattributes.html}{Exposing Attributes of C++ Types to QML}
-for more information about using QQmlEngine, QQmlContext and QQmlComponent, as well
-as details on including QML files through \l{The Qt Resource System}{Qt's Resource system}.
-
-
-
-\section1 Developing and Prototyping with QML Scene
-
-The Declarative UI package includes a QML runtime tool,
-\l{qtquick-qmlscene.html}{qmlscene}, which loads and displays QML documents.
-This is useful during the application development phase for prototyping
-QML-based applications without writing your own C++ applications to invoke
-the QML runtime.
-
-
-
-\section1 Managing resource files with the Qt resource system
-
-The \l {The Qt Resource System}{Qt resource system} allows resource files to be stored as
-binary files in an application executable. This can be useful when building a mixed
-QML/C++ application as it enables QML files (as well as other resources such as images
-and sound files) to be referred to through the resource system URI scheme rather than
-relative or absolute paths to filesystem resources. Note, however, that if you use the resource
-system, the application executable must be re-compiled whenever a QML source file is changed
-in order to update the resources in the package.
-
-To use the resource system in a mixed QML/C++ application:
-
-\list
-\li Create a \c .qrc \l {The Qt Resource System}{resource collection file} that lists resource
- files in XML format
-\li From C++, load the main QML file as a resource using the \c :/ prefix or as a URL with the
- \c qrc scheme
-\endlist
-
-Once this is done, all files specified by relative paths in QML will be loaded from
-the resource system instead. Use of the resource system is completely transparent to
-the QML layer; this means all QML code should refer to resource files using relative
-paths and should \e not use the \c qrc scheme. This scheme should only be used from
-C++ code for referring to resource files.
-
-Here is a application packaged using the \l {The Qt Resource System}{Qt resource system}.
-The directory structure looks like this:
-
-\code
-project
- |- example.qrc
- |- main.qml
- |- images
- |- background.png
- |- main.cpp
- |- project.pro
-\endcode
-
-The \c main.qml and \c background.png files will be packaged as resource files. This is
-done in the \c example.qrc resource collection file:
-
-\quotefile ../src/qml/doc/snippets/qml/qtbinding/resources/example.qrc
-
-Since \c background.png is a resource file, \c main.qml can refer to it using the relative
-path specified in \c example.qrc:
-
-\snippet ../src/qml/doc/snippets/qml/qtbinding/resources/main.qml 0
-
-To allow QML to locate resource files correctly, the \c main.cpp loads the main QML
-file, \c main.qml, as a resource file using the \c qrc scheme:
-
-\snippet ../src/qml/doc/snippets/qml/qtbinding/resources/main.cpp 0
-
-Finally \c project.pro uses the RESOURCES variable to indicate that \c example.qrc should
-be used to build the application resources:
-
-\quotefile ../src/qml/doc/snippets/qml/qtbinding/resources/resources.pro
-
-See \l {The Qt Resource System} for more information.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/glossary.qdoc b/src/quick/doc/src/appdevguide/glossary.qdoc
deleted file mode 100644
index 2ece38256f..0000000000
--- a/src/quick/doc/src/appdevguide/glossary.qdoc
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-glossary.html
-\title Qt Quick Glossary Of Terms
-\brief Glossary of terms used in the documentation for QML and QtQuick
-
-\section1 Common Terms
-
-\table
- \header
- \li Term
- \li Definition
-
- \row
- \li QML
- \li The language in which QML applications are written. The language
- architecture and engine are implemented by the Qt QML module.
-
- \row
- \li Qt Quick
- \li The standard library of types and functionality for the
- QML language, which is provided by the Qt Quick module,
- and may be accessed with "import QtQuick 2.0"
-
- \row
- \li Type
- \li In QML, a \e type may refer to either a
- \l{qtqml-typesystem-topic.html}{Basic Type} or a
- \l{qtqml-typesystem-topic.html#qml-object-types}{QML Object Type}.
-
- The QML language provides a number of built in
- (\l{qtqml-typesystem-basictypes.html}{basic types}), and the
- QtQuick module provides various \l{qtquick-qmltypereference.html}
- {Qt Quick types} for building QML applications. Types can also be
- provided by third-party developers through
- (\l{qtqml-modules-topic.html}{modules}) or by the application
- developer in the application itself through
- \l{qtqml-documents-definetypes.html}{QML Documents}.
-
- See \l{qtqml-typesystem-topic.html}{The QML Type System}
- for more details.
-
- \row
- \li Basic Type
- \li A \l{qtqml-typesystem-topic.html}{basic type} is a simple type
- such as \c int, \c string and \c bool. Unlike
- \l{qtqml-typesystem-topic.html#qml-object-types}{object types},
- an object cannot be instantiated from a basic type; for example,
- it is not possible to create an \c int object with properties,
- methods, signals and so on.
-
- Basic types are built into the QML language, whereas object types
- cannot be used unless the appropriate
- \l{qtqml-modules-topic.html}{module} is imported.
-
- See \l{qtqml-typesystem-topic.html}{The QML Type System}
- for more details.
-
- \row
- \li Object Type
- \li A \l{qtqml-typesystem-topic.html#qml-object-types}{QML Object Type}
- is a type that can be instantiated by the QML engine.
-
- A QML type can be defined either by a document in a .qml file
- beginning with a capital letter, or by a QObject-based C++ class.
-
- See \l{qtqml-typesystem-topic.html}{The QML Type System}
- for more details.
-
- \row
- \li Object
- \li A QML object is an instance of a
- \l{qtqml-typesystem-topic.html#qml-object-types}{QML Object Type}.
-
- Such objects are created by the engine when it processes
- \l{qtqml-syntax-basics.html#object-declarations}{object declarations},
- which specify the objects to be created and the attributes that are to
- be defined for each object.
-
- Additionally, objects can be dynamically created at runtime through
- Component.createObject() and Qt.createQmlObject().
-
- See also \l{#lazy-instantiation}{Lazy Instantiation}.
-
- \row
- \li Component
- \li A component is a template from which a QML object or object
- tree is created. It is produced when a document is loaded by
- the QML engine. Once it has been loaded, it can be used to
- instantiate the object or object tree that it represents.
-
- Additionally, the \l Component type is a special type that can
- can be used to declare a component inline within a document.
- Component objects can also be dynamically created through
- Qt.createComponent() to dynamically create QML objects.
-
- \row
- \li Document
- \li A \l{qtqml-documents-topic.html}{QML Document} is a self
- contained piece of QML source code that begins with one or more
- import statements and contains a single top-level object
- declaration. A document may reside in a .qml file or a text string.
-
- If it is placed in a .qml file whose name begins with a capital
- letter, the file is recognized by the engine as a definition of
- a QML type. The top-level object declaration encapsulates the
- object tree that will be instantiated by the type.
-
- \row
- \li Property
- \li A property is an attribute of an object type that has a name and
- an associated value; this value can be read (and in most cases, also
- written to) externally.
-
- An object can have one or more properties. Some properties
- are associated with the canvas (e.g., x, y, width, height,
- and opacity) while others may be data specific to that type
- (e.g., the "text" property of the \l Text type).
-
- See \l{qtqml-syntax-objectattributes.html}{QML Object Attributes}
- for more details.
-
- \row
- \li Binding
- \li A binding is a JavaScript expression which is "bound" to a
- property. The value of the property at any point in time
- will be the value returned by evaluating that expression.
-
- See \l{qtqml-syntax-propertybinding.html}{Property Binding}
- for more details.
-
- \row
- \li Signal
- \li A signal is a notification from a QML object. When an object emits
- a signal, other objects can receive and process this signal through
- a \l{Signal Attributes}{signal handler}.
-
- Most properties of QML objects
- have a change signal, and also an associated change signal handler
- which may be defined by clients to implement functionality. For
- example, the "onClicked()" handler of an instance of the MouseArea
- type might be defined in an application to cause a sound to be
- played.
-
- See \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
- for more details.
-
- \row
- \li Signal Handler
- \li A signal handler is the expression (or function) which is triggered
- by a signal. It is also known as a "slot" in C++.
-
- See \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
- for more details.
-
- \row
- \target lazy-instantiation
- \li Lazy Instantiation
- \li Object instances can be instantiated "lazily" at run-time,
- to avoid performing unnecessary work until needed. Qt Quick
- provides the \l Loader type to make lazy instantiation more
- convenient.
-\endtable
-
-\section1 Indexed Alphabetically
-
-*/
diff --git a/src/quick/doc/src/appdevguide/internationalization.qdoc b/src/quick/doc/src/appdevguide/internationalization.qdoc
deleted file mode 100644
index 9c3e9d9cfb..0000000000
--- a/src/quick/doc/src/appdevguide/internationalization.qdoc
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-internationalization.html howto
-\ingroup qml-features
-\title Internationalization and Localization with Qt Quick
-\brief Following these steps, you can write your Qt Quick application so it can be localized for multiple languages
-
-\section1 Internationalizing your Application
-
-The following sections describe various aspects of internationalizing your QML
-source code. If you follow these guides for all the user interface components in
-your application, it becomes possible to localize every aspect of your
-application for different languages and local cultural conventions such as the
-way dates and numbers are formatted.
-
-\section2 1. Use qsTr() for all Literal User Interface Strings
-
-Strings in QML can be marked for translation using the qsTr(), qsTranslate(),
-qsTrId(), QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRID_NOOP() functions. The
-most common way of marking strings is with the qsTr() function. For example:
-
-\code
-Text {
- id: txt1;
- text: qsTr("Back");
-}
-\endcode
-
-This code makes "Back" a key entry in the translation files. At runtime, the
-translation system looks up the keyword "Back" and then gets the corresponding
-translation value for the current system locale. The result is returned to the
-\c text property and the user interface will show the appropriate translation of
-"Back" for the current locale.
-
-
-\section2 2. Add Context for the Translator
-
-User interface strings are often short so you need to help the person
-translating the text understand the context of the text. You can add context
-information in the source code as extra descriptive text before the string to be
-translated. These extra descriptions are included in the .ts translation files
-delivered to the translator.
-
-\note The .ts files are XML files with the source texts and a place for the
-translated text. The updated .ts files are converted into binary translation
-files and included as part of the final application.
-
-In the following code snippet, the text on the \c {//:} line is the main comment
-for the translator.
-
-The text on the \c{//~} line is optional extra information. The first word of
-the text is used as an additional identifier in the XML element in the .ts file
-so make sure the first word is not part of the sentence. For example, the
-comment "Context Not related to that" is converted to "<extra-Context>Not
-related to that" in the .ts file.
-
-\code
-Text {
- id: txt1;
- // This user interface string is only used here
- //: The back of the object, not the front
- //~ Context Not related to back-stepping
- text: qsTr("Back");
-}
-\endcode
-
-\section2 3. Disambiguate Identical Texts
-
-The translation system consolidates the user interface text strings into unique
-items. This consolidation saves the person doing the translation work having to
-translate the same text multiple times. However, in some cases, the text is
-identical but has a different meaning. For example, in English, "back" means
-take a step backward and also means the part of an object opposite to the front.
-You need to tell the translation system about these two separate meanings so the
-translator can create two separate translations.
-
-Differentiate between identical texts by adding some id text as the second
-parameter of the qsTr() function.
-
-In the following code snippet, the \c {not front} text is an id to differentiate
-this "Back" text from the backstepping "Back" text:
-
-\code
-Text {
- id: txt1;
- // This user interface string is used only here
- //: The back of the object, not the front
- //~ Context Not related to back-stepping
- text: qsTr("Back", "not front");
-}
-\endcode
-
-\section2 4. Use \c %x to Insert Parameters into a String
-
-Different languages put words together in different orders so it is not a good
-idea to create sentences by concatenating words and data. Instead, use \c % to
-insert parameters into strings. For example, the following snippet has a string
-with two number parameters \c %1 and \c %2. These parameters are inserted with
-the \c .arg() functions.
-
-\code
-Text {
- text: qsTr("File %1 of %2").arg(counter).arg(total)
-}
-\endcode
-
-%1 refers to the first parameter and \c %2 refers to the second parameter so this
-code produces output like: "File 2 of 3".
-
-\section2 5. Use %Lx so Numbers are Localized
-
-If you include the \c %L modifier when you specify a parameter, the number is
-localized according to the current regional settings. For example, in the
-following code snippet, \c %L1 means to format the first parameters according to
-the number formatting conventions of the currently selected locale (geographical
-region):
-
-\code
-Text {
- text: qsTr("%L1").arg(total)
-}
-\endcode
-
-Then, with the above code, if \c total is the number "4321.56" (four thousand
-three hundred and twenty one point fifty six); with English regional settings,
-(locale) the output is "4,321.56"; with German regional settings, the output is
-"4.321,56".
-
-\section2 6. Internationalize Dates, Times and Currencies
-
-There are no special in-string modifiers for formatting dates and times.
-Instead, you need to query the current locale (geographical region) and use the
-methods of \l {QtQuick2::Date}{Date} to format the string.
-
-\c Qt.locale() returns a \l {QtQuick2::Locale}{Locale} object which contains all
-kinds of information about the locale. In particular, the \l
-{QtQuick2::Locale::name}{Locale.name} property contains the language and country
-information for the current locale. You can use the value as is, or you can
-parse it to determine the appropriate content for the current locale.
-
-The following snippet gets the current date and time with Date(), then converts
-that to a string for the current locale. Then it inserts the date string into
-the %1 parameter for the appropriate translation.
-
-\code
-Text {
- text: qsTr("Date %1").arg(Date().toLocaleString(Qt.locale()))
-}
-\endcode
-
-To make sure currency numbers are localized, use the \l
-{QtQuick2::Number}{Number} type. This type has similar functions as the Date
-type for converting numbers into localized currency strings.
-
-\section2 7. Use QT_TR_NOOP() for Translatable Data Text Strings
-
-If the user changes the system language without a reboot, depending on the
-system, the strings in arrays and list models and other data structures might
-not be refreshed automatically. To force the texts to be refreshed when they are
-displayed in the user interface, you need declare the strings with the
-QT_TR_NOOP() macro. Then, when you populate the objects for display, you need to
-explicitly retrieve the translation for each text. For example:
-
-\code
-ListModel {
- id: myListModel;
- ListElement {
- //: Capital city of Finland
- name: QT_TR_NOOP("Helsinki");
- }
- }
-
-...
-
-Text {
- text: qsTr(myListModel.get(0).name); // get the translation of the name property in element 0
- }
-\endcode
-
-
-\section2 8. Use Locale to Extend Localization Features
-
-If you want different graphics or audio for different geographical regions, you
-can use Qt.locale() to get the current locale. Then you choose appropriate
-graphics or audio for that locale.
-
-The following code snippet shows how you could select an appropriate icon
-that represents the language of the current locale.
-
-\code
-Component.onCompleted: {
- switch (Qt.locale().name.substring(0,2)) {
- case "en": // show the English-language icon
- languageIcon = "../images/language-icon_en.png";
- break;
- case "fi": // show the Finnish language icon
- languageIcon = "../images/language-icon_fi.png";
- break;
- default: // show a default language icon
- languageIcon = "../images/language-icon_default.png";
- }
-}
-\endcode
-
-\section1 Localizing your Application
-
-Qt Quick applications use the same underlying localization system as Qt C++
-applications (lupdate, lrelease and .ts files). You use the same tools as
-described in the \l {Qt Linguist Manual: Release Manager}{Qt Linguist Manual}.
-You can even have user interface strings in C++ and QML source in the same
-application. The system will create a single combined translation file and the
-strings are accessible from QML and C++.
-
-\section2 Use a Conditional to Hide QML Source From the Compiler
-
-The \c lupdate tool extracts user interface strings from your application.
-lupdate reads your application's .pro file to identify which source files
-contain texts to be translated. This means your source files must be listed in
-the \c SOURCES or \c HEADERS entry in the .pro file. If your files are not
-listed the texts in them will not be found.
-
-However, the SOURCES variable is intended for C++ source files. If you list QML
-or JavaScript source files there, the compiler tries to build them as though
-they are C++ files. As a workaround, you can use an \c lupdate_only{...}
-conditional statement so the \c lupdate tool sees the .qml files but the C++
-compiler ignores them.
-
-For example, the following .pro file snippet specifies two .qml files in
-the application.
-
-\code
-lupdate_only{
-SOURCES = main.qml \
- MainPage.qml
-}
-\endcode
-
-
-You can also specify the .qml source files with a wildcard match. The
-search is not recursive so you need to specify each directory where there are
-user interface strings in the source code:
-
-\code
-lupdate_only{
-SOURCES = *.qml \
- *.js \
- content/*.qml \
- content/*.js
-}
-\endcode
-
-See the \l {Qt Linguist Manual} for more details about Qt localization.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/performance.qdoc b/src/quick/doc/src/appdevguide/performance.qdoc
deleted file mode 100644
index 28217e06d6..0000000000
--- a/src/quick/doc/src/appdevguide/performance.qdoc
+++ /dev/null
@@ -1,1143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-performance.html
-\title Performance Considerations And Suggestions
-\brief Discussion of performance-related tradeoffs and best-practices
-
-\section1 Timing Considerations
-
-As an application developer, you must strive to allow the rendering engine
-to achieve a consistent 60 frames-per-second refresh rate. 60 FPS means
-that there is approximately 16 milliseconds between each frame in which
-processing can be done, which includes the processing required to upload
-the draw primitives to the graphics hardware.
-
-In practice, this means that the application developer should use asynchronous,
-event driven programming wherever possible, should use worker threads to do
-significant processing, should never manually spin the event loop, and should
-never spend more than a couple of milliseconds per frame within blocking functions.
-Failure to do so will result in skipped frames, which has a drastic effect on the
-user experience.
-
-\note A pattern which is tempting, but should \e never be used, is creating your
-own QEventLoop or calling QCoreApplication::processEvents() in order to avoid
-blocking within a C++ code block invoked from QML. This is dangerous because
-when an event loop is entered in a signal handler or binding, the QML engine
-continues to run other bindings, animations, transitions, etc. Those bindings
-can then cause side effects which, for example, destroy the hierarchy containing
-your event loop.
-
-\section1 Profiling
-
-The most important tip is: use the QML profiler included with Qt Creator. Knowing
-where time is spent in an application will allow you to focus on problem areas which
-actually exist, rather than problem areas which potentially exist. See the Qt Creator
-manual for more information on how to use the QML profiling tool.
-
-Determining which bindings are being run the most often, or which functions your
-application is spending the most time in, will allow you to decide whether you need
-to optimize the problem areas, or redesign some implementation details of your
-application so that the performance is improved. Attempting to optimize code without
-profiling is likely to result in very minor rather than significant performance
-improvements.
-
-\section1 JavaScript Code
-
-Most QML applications will have a large amount of JavaScript code in them, in the
-form of dynamic functions, signal handlers, and property binding expressions.
-This is not generally a problem (in fact, due to some optimizations in the QML engine
-(bindings compiler, etc) it can for some use-cases be faster than calling a C++ function)
-however care must be taken to ensure that unnecessary processing isn't triggered
-accidentally.
-
-\section2 Bindings
-
-There are two types of bindings in QML: optimized and non-optimized bindings.
-It is a good idea to keep binding expressions as simple as possible, since the
-QML engine makes use of an optimized binding expression evaluator which can
-evaluate simple binding expressions without needing to switch into a full
-JavaScript execution environment. These optimized bindings are evaluated far
-more efficiently than more complex (non-optimized) bindings. The basic
-requirement for optimization of bindings is that the type information of every
-symbol accessed must be known at compile time.
-
-Things to avoid in binding expressions to maximize optimizability:
-\list
- \li declaring intermediate JavaScript variables
- \li accessing "var" properties
- \li calling JavaScript functions
- \li constructing closures or defining functions within the binding expression
- \li accessing properties outside of the immediate evaluation scope
- \li writing to other properties as side effects
-\endlist
-
-The QML_COMPILER_STATS environment variable may be set when running a QML application
-to print statistics about how many bindings were able to be optimized.
-
-Bindings are quickest when they know the type of objects and properties they are working
-with. This means that non-final property lookup in a binding expression can be slower
-in some cases, where it is possible that the type of the property being looked up has
-been changed (for example, by a derived type).
-
-The immediate evaluation scope can be summarized by saying that it contains:
-\list
- \li the properties of the expression scope object (for binding expressions, this is
- the object to which the property binding belongs)
- \li ids of any objects in the component
- \li the properties of the root item in the component
-\endlist
-
-Ids of objects from other components and properties of any such objects, as
-well as symbols defined in or included from a JavaScript import, are not in the
-immediate evaluation scope, and thus bindings which access any of those things
-will not be optimized.
-
-Note that if a binding cannot be optimized by the QML engine's optimized binding
-expression evaluator, and thus must be evaluated by the full JavaScript environment,
-some of the tips listed above will no longer apply. For example, it can sometimes be
-beneficial to cache the result of property resolution in an intermediate JavaScript
-variable, in a very complex binding. Upcoming sections have more information on these
-sorts of optimizations.
-
-\section2 Type-Conversion
-
-One major cost of using JavaScript is that in most cases when a property from a QML
-type is accessed, a JavaScript object with an external resource containing the
-underlying C++ data (or a reference to it) is created. In most cases, this is fairly
-inexpensive, but in others it can be quite expensive. One example of where it is
-expensive is assigning a C++ QVariantMap Q_PROPERTY to a QML "variant" property.
-Lists can also be expensive, although sequences of specific types (QList of int,
-qreal, bool, QString, and QUrl) should be inexpensive; other list types involve an
-expensive conversion cost (creating a new JavaScript Array, and adding new types
-one by one, with per-type conversion from C++ type instance to JavaScript value).
-
-Converting between some basic property types (such as "string" and "url" properties)
-can also be expensive. Using the closest matching property type will avoid unnecessary
-conversion.
-
-If you must expose a QVariantMap to QML, use a "var" property rather than a "variant"
-property. In general, "property var" should be considered to be superior to
-"property variant" for every use-case in QtQuick 2.0 (note that "property variant"
-is marked as obsolete in the QtQuick 2.0 documentation), as it allows a true JavaScript
-reference to be stored (which can reduce the number of conversions required in certain
-expressions).
-
-\section2 Resolving Properties
-
-Property resolution takes time. While in some cases the result of a lookup can be
-cached and reused, it is always best to avoid doing unnecessary work altogether, if
-possible.
-
-In the following example, we have a block of code which is run often (in this case, it
-is the contents of an explicit loop; but it could be a commonly-evaluated binding expression,
-for example) and in it, we resolve the object with the "rect" id and its "color" property
-multiple times:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 200
- Rectangle {
- id: rect
- anchors.fill: parent
- color: "blue"
- }
-
- function printValue(which, value) {
- console.log(which + " = " + value);
- }
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- printValue("red", rect.color.r);
- printValue("green", rect.color.g);
- printValue("blue", rect.color.b);
- printValue("alpha", rect.color.a);
- }
- var t1 = new Date();
- console.log("Took: " + (t1.valueOf() - t0.valueOf()) + " milliseconds for 1000 iterations");
- }
-}
-\endqml
-
-We could instead resolve the common base just once in the block:
-
-\qml
-// good.qml
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 200
- Rectangle {
- id: rect
- anchors.fill: parent
- color: "blue"
- }
-
- function printValue(which, value) {
- console.log(which + " = " + value);
- }
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- var rectColor = rect.color; // resolve the common base.
- printValue("red", rectColor.r);
- printValue("green", rectColor.g);
- printValue("blue", rectColor.b);
- printValue("alpha", rectColor.a);
- }
- var t1 = new Date();
- console.log("Took: " + (t1.valueOf() - t0.valueOf()) + " milliseconds for 1000 iterations");
- }
-}
-\endqml
-
-Just this simple change results in a significant performance improvement.
-Note that the code above can be improved even further (since the property
-being looked up never changes during the loop processing), by hoisting the
-property resolution out of the loop, as follows:
-
-\qml
-// better.qml
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 200
- Rectangle {
- id: rect
- anchors.fill: parent
- color: "blue"
- }
-
- function printValue(which, value) {
- console.log(which + " = " + value);
- }
-
- Component.onCompleted: {
- var t0 = new Date();
- var rectColor = rect.color; // resolve the common base outside the tight loop.
- for (var i = 0; i < 1000; ++i) {
- printValue("red", rectColor.r);
- printValue("green", rectColor.g);
- printValue("blue", rectColor.b);
- printValue("alpha", rectColor.a);
- }
- var t1 = new Date();
- console.log("Took: " + (t1.valueOf() - t0.valueOf()) + " milliseconds for 1000 iterations");
- }
-}
-\endqml
-
-\section2 Property Bindings
-
-A property binding expression will be re-evaluated if any of the properties
-it references are changed. As such, binding expressions should be kept as
-simple as possible.
-
-If you have a loop where you do some processing, but only the final result
-of the processing is important, it is often better to update a temporary
-accumulator which you afterwards assign to the property you need to update,
-rather than incrementally updating the property itself, in order to avoid
-triggering re-evaluation of binding expressions during the intermediate
-stages of accumulation.
-
-The following contrived example illustrates this point:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-
-Item {
- id: root
- width: 200
- height: 200
- property int accumulatedValue: 0
-
- Text {
- anchors.fill: parent
- text: root.accumulatedValue.toString()
- onTextChanged: console.log("text binding re-evaluated")
- }
-
- Component.onCompleted: {
- var someData = [ 1, 2, 3, 4, 5, 20 ];
- for (var i = 0; i < someData.length; ++i) {
- accumulatedValue = accumulatedValue + someData[i];
- }
- }
-}
-\endqml
-
-The loop in the onCompleted handler causes the "text" property binding to
-be re-evaluated six times (which then results in any other property bindings
-which rely on the text value, as well as the onTextChanged signal handler,
-to be re-evaluated each time, and lays out the text for display each time).
-This is clearly unnecessary in this case, since we really only care about
-the final value of the accumulation.
-
-It could be rewritten as follows:
-
-\qml
-// good.qml
-import QtQuick 2.0
-
-Item {
- id: root
- width: 200
- height: 200
- property int accumulatedValue: 0
-
- Text {
- anchors.fill: parent
- text: root.accumulatedValue.toString()
- onTextChanged: console.log("text binding re-evaluated")
- }
-
- Component.onCompleted: {
- var someData = [ 1, 2, 3, 4, 5, 20 ];
- var temp = accumulatedValue;
- for (var i = 0; i < someData.length; ++i) {
- temp = temp + someData[i];
- }
- accumulatedValue = temp;
- }
-}
-\endqml
-
-\section2 Sequence tips
-
-As mentioned earlier, some sequence types are fast (eg, QList<int>, QList<qreal>,
-QList<bool>, QList<QString>, QStringList and QList<QUrl>) while others will be
-much slower. Aside from using these types wherever possible instead of slower types,
-there are some other performance-related semantics you need to be aware of to achieve
-the best performance.
-
-Firstly, there are two different implementations for sequence types: one for where
-the sequence is a Q_PROPERTY of a QObject (we'll call this a reference sequence),
-and another for where the sequence is returned from a Q_INVOKABLE function of a
-QObject (we'll call this a copy sequence).
-
-A reference sequence is read and written via QMetaObject::property() and thus is read
-and written as a QVariant. This means that changing the value of any element in the
-sequence from JavaScript will result in three steps occurring: the complete sequence
-will be read from the QObject (as a QVariant, but then cast to a sequence of the correct
-type); the element at the specified index will be changed in that sequence; and the
-complete sequence will be written back to the QObject (as a QVariant).
-
-A copy sequence is far simpler as the actual sequence is stored in the JavaScript
-object's resource data, so no read/modify/write cycle occurs (instead, the resource
-data is modified directly).
-
-Therefore, writes to elements of a reference sequence will be much slower than writes
-to elements of a copy sequence. In fact, writing to a single element of an N-element
-reference sequence is equivalent in cost to assigning a N-element copy sequence to that
-reference sequence, so you're usually better off modifying a temporary copy sequence
-and then assigning the result to a reference sequence, during computation.
-
-Assume the existence (and prior registration into the "Qt.example 1.0" namespace) of the
-following C++ type:
-
-\code
-class SequenceTypeExample : public QQuickItem
-{
- Q_OBJECT
- Q_PROPERTY (QList<qreal> qrealListProperty READ qrealListProperty WRITE setQrealListProperty NOTIFY qrealListPropertyChanged)
-
-public:
- SequenceTypeExample() : QQuickItem() { m_list << 1.1 << 2.2 << 3.3; }
- ~SequenceTypeExample() {}
-
- QList<qreal> qrealListProperty() const { return m_list; }
- void setQrealListProperty(const QList<qreal> &list) { m_list = list; emit qrealListPropertyChanged(); }
-
-signals:
- void qrealListPropertyChanged();
-
-private:
- QList<qreal> m_list;
-};
-\endcode
-
-The following example writes to elements of a reference sequence in a
-tight loop, resulting in bad performance:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
- width: 200
- height: 200
-
- Component.onCompleted: {
- var t0 = new Date();
- qrealListProperty.length = 100;
- for (var i = 0; i < 500; ++i) {
- for (var j = 0; j < 100; ++j) {
- qrealListProperty[j] = j;
- }
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-The QObject property read and write in the inner loop caused by the
-\c{"qrealListProperty[j] = j"} expression makes this code very suboptimal. Instead,
-something functionally equivalent but much faster would be:
-
-\qml
-// good.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
- width: 200
- height: 200
-
- Component.onCompleted: {
- var t0 = new Date();
- var someData = [1.1, 2.2, 3.3]
- someData.length = 100;
- for (var i = 0; i < 500; ++i) {
- for (var j = 0; j < 100; ++j) {
- someData[j] = j;
- }
- qrealListProperty = someData;
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-Secondly, a change signal for the property is emitted if any element in it changes.
-If you have many bindings to a particular element in a sequence property, it is better
-to create a dynamic property which is bound to that element, and use that dynamic
-property as the symbol in the binding expressions instead of the sequence element,
-as it will only cause re-evaluation of bindings if its value changes.
-
-This is an unusual use-case which most clients should never hit, but is worth being
-aware of, in case you find yourself doing something like this:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
-
- property int firstBinding: qrealListProperty[1] + 10;
- property int secondBinding: qrealListProperty[1] + 20;
- property int thirdBinding: qrealListProperty[1] + 30;
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- qrealListProperty[2] = i;
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-Note that even though only the element at index 2 is modified in the loop, the three
-bindings will all be re-evaluated since the granularity of the change signal is that
-the entire property has changed. As such, adding an intermediate binding can
-sometimes be beneficial:
-
-\qml
-// good.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
-
- property int intermediateBinding: qrealListProperty[1]
- property int firstBinding: intermediateBinding + 10;
- property int secondBinding: intermediateBinding + 20;
- property int thirdBinding: intermediateBinding + 30;
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- qrealListProperty[2] = i;
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-In the above example, only the intermediate binding will be re-evaluated each time,
-resulting in a significant performance increase.
-
-\section2 Value-Type tips
-
-Value-type properties (font, color, vector3d, etc) have similar QObject property
-and change notification semantics to sequence type properties. As such, the tips
-given above for sequences are also applicable for value-type properties. While
-they are usually less of a problem with value-types (since the number of
-sub-properties of a value-type is usually far less than the number of elements
-in a sequence), any increase in the number of bindings being re-evaluated needlessly
-will have a negative impact on performance.
-
-\section2 Other JavaScript Objects
-
-Different JavaScript engines provide different optimizations. The JavaScript engine
-which QtQuick 2 uses is optimized for object instantiation and property lookup, but
-the optimizations which it provides relies on certain criteria. If your application
-does not meet the criteria, the JavaScript engine falls back to a "slow-path" mode
-with much worse performance. As such, always try to ensure you meet the following
-criteria:
-
-\list
-\li Avoid using eval() if at all possible
-\li Do not delete properties of objects
-\endlist
-
-\section1 Common Interface Elements
-
-\section2 Text Elements
-
-Calculating text layouts can be a slow operation. Consider using the \c PlainText
-format instead of \c StyledText wherever possible, as this reduces the amount of work
-required of the layout engine. If you cannot use \c PlainText (as you need to embed
-images, or use tags to specify ranges of characters to have certain formatting (bold,
-italic, etc) as opposed to the entire text) then you should use \c StyledText.
-
-You should only use \c AutoText if the text might be (but probably isn't)
-\c StyledText as this mode will incur a parsing cost. The \c RichText mode should
-not be used, as \c StyledText provides almost all of its features at a fraction of
-its cost.
-
-\section2 Images
-
-Images are a vital part of any user interface. Unfortunately, they are also a big
-source of problems due to the time it takes to load them, the amount of memory they
-consume, and the way in which they are used.
-
-\section3 Asynchronous Loading
-
-Images are often quite large, and so it is wise to ensure that loading an image doesn't
-block the UI thread. Set the "asynchronous" property of the QML Image element to
-\c true to enable asynchronous loading of images from the local file system (remote
-images are always loaded asynchronously) where this would not result in a negative impact
-upon the aesthetics of the user interface.
-
-Image elements with the "asynchronous" property set to \c true will load images in
-a low-priority worker thread.
-
-\section3 Explicit Source Size
-
-If your application loads a large image but displays it in a small-sized element, set
-the "sourceSize" property to the size of the element being rendered to ensure that the
-smaller-scaled version of the image is kept in memory, rather than the large one.
-
-Beware that changing the sourceSize will cause the image to be reloaded.
-
-\section3 Avoid Run-time Composition
-
-Also remember that you can avoid doing composition work at run-time by providing the
-pre-composed image resource with your application (e.g., providing elements with shadow
-effects).
-
-\section2 Position Elements With Anchors
-
-It is more efficient to use anchors rather than bindings to position items
-relative to each other. Consider this use of bindings to position rect2
-relative to rect1:
-
-\code
-Rectangle {
- id: rect1
- x: 20
- width: 200; height: 200
-}
-Rectangle {
- id: rect2
- x: rect1.x
- y: rect1.y + rect1.height
- width: rect1.width - 20
- height: 200
-}
-\endcode
-
-This is achieved more efficiently using anchors:
-
-\code
-Rectangle {
- id: rect1
- x: 20
- width: 200; height: 200
-}
-Rectangle {
- id: rect2
- height: 200
- anchors.left: rect1.left
- anchors.top: rect1.bottom
- anchors.right: rect1.right
- anchors.rightMargin: 20
-}
-\endcode
-
-Positioning with bindings (by assigning binding expressions to the x, y, width
-and height properties of visual objects, rather than using anchors) is
-relatively slow, although it allows maximum flexibility.
-
-If the layout is not dynamic, the most performant way to specify the layout is
-via static initialization of the x, y, width and height properties. Item
-coordinates are always relative to their parent, so if you wanted to be a fixed
-offset from your parent's 0,0 coordinate you should not use anchors. In the
-following example the child Rectangle objects are in the same place, but the
-anchors code shown is not as resource efficient as the code which
-uses fixed positioning via static initialization:
-
-\code
-Rectangle {
- width: 60
- height: 60
- Rectangle {
- id: fixedPositioning
- x: 20
- y: 20
- width: 20
- height: 20
- }
- Rectangle {
- id: anchorPositioning
- anchors.fill: parent
- anchors.margins: 20
- }
-}
-\endcode
-
-\section1 Models and Views
-
-Most applications will have at least one model feeding data to a view. There are
-some semantics which application developers need to be aware of, in order to achieve
-maximal performance.
-
-\section2 Custom C++ Models
-
-It is often desirable to write your own custom model in C++ for use with a view in
-QML. While the optimal implementation of any such model will depend heavily on the
-use-case it must fulfil, some general guidelines are as follows:
-
-\list
-\li Be as asynchronous as possible
-\li Do all processing in a (low priority) worker thread
-\li Batch up backend operations so that (potentially slow) I/O and IPC is minimized
-\li Use a sliding slice window to cache results, whose parameters are determined with the help of profiling
-\endlist
-
-It is important to note that using a low-priority worker thread is recommended to
-minimise the risk of starving the GUI thread (which could result in worse perceived
-performance). Also, remember that synchronization and locking mechanisms can be a
-significant cause of slow performance, and so care should be taken to avoid
-unnecessary locking.
-
-\section2 ListModel
-
-QML provides a ListModel element which can be used to feed data to a ListView.
-It should suffice for most use-cases and be relatively performant so long as
-it is used correctly.
-
-\section3 Populate Within A Worker Thread
-
-ListModel elements can be populated in a (low priority) worker thread in JavaScript. The
-developer must explicitly call "sync()" on the ListModel from within the WorkerScript to
-have the changes synchronized to the main thread. See the WorkerScript documentation
-for more information.
-
-Please note that using a WorkerScript element will result in a separate JavaScript engine
-being created (as the JavaScript engine is per-thread). This will result in increased
-memory usage. Multiple WorkerScript elements will all use the same worker thread, however,
-so the memory impact of using a second or third WorkerScript element is negligible once
-an application already uses one.
-
-\section3 Don't Use Dynamic Roles
-
-The ListModel element in QtQuick 2.0 is much more performant than in QtQuick 1.0. The
-performance improvements mainly come from assumptions about the type of roles within each
-element in a given model - if the type doesn't change, the caching performance improves
-dramatically. If the type can change dynamically from element to element, this optimization
-becomes impossible, and the performance of the model will be an order of magnitude worse.
-
-Therefore, dynamic typing is disabled by default; the developer must specifically set
-the boolean "dynamicRoles" property of the model to enable dynamic typing (and suffer
-the attendant performance degradation). We recommend that you do not use dynamic typing
-if it is possible to redesign your application to avoid it.
-
-\section2 Views
-
-View delegates should be kept as simple as possible. Have just enough QML in the delegate
-to display the necessary information. Any additional functionality which is not immediately
-required (e.g., if it displays more information when clicked) should not be created until
-needed (see the upcoming section on lazy initialization).
-
-The following list is a good summary of things to keep in mind when designing a delegate:
-\list
-\li The fewer elements that are in a delegate, the faster they can be created, and thus
- the faster the view can be scrolled.
-\li Keep the number of bindings in a delegate to a minimum; in particular, use anchors
- rather than bindings for relative positioning within a delegate.
-\li Avoid using ShaderEffect elements within delegates.
-\li Never enable clipping on a delegate.
-\endlist
-
-You may set the \c cacheBuffer property of a view to allow asynchronous creation and
-buffering of delegates outside of the visible area. Utilizing a \c cacheBuffer is
-recommended for view delegates that are non-trivial and unlikely to be created within a
-single frame.
-
-Be mindful that a \c cacheBuffer keeps additional delegates in-memory and therefore the
-value derived from utilizing the \c cacheBuffer must be balanced against additional memory
-usage. Developers should use benchmarking to find the best value for their use-case, since
-the increased memory pressure caused by utilizing a \c cacheBuffer can, in some rare cases,
-cause reduced frame rate when scrolling.
-
-\section1 Visual Effects
-
-QtQuick 2 includes several features which allow developers and designers to create
-exceptionally appealing user interfaces. Fluidity and dynamic transitions as well
-as visual effects can be used to great effect in an application, but some care must
-be taken when using some of the features in QML as they can have performance implications.
-
-\section2 Animations
-
-In general, animating a property will cause any bindings which reference that property
-to be re-evaluated. Usually, this is what is desired but in other cases it may be better
-to disable the binding prior to performing the animation, and then reassign the binding
-once the animation has completed.
-
-Avoid running JavaScript during animation. For example, running a complex JavaScript
-expression for each frame of an x property animation should be avoided.
-
-Developers should be especially careful using script animations, as these are run in the main
-thread (and therefore can cause frames to be skipped if they take too long to complete).
-
-\section2 Particles
-
-The QtQuick 2.0 Particles module allows beautiful particle effects to be integrated
-seamlessly into user interfaces. However every platform has different graphics hardware
-capabilities, and the Particles module is unable to limit parameters to what your hardware
-can gracefully support. The more particles you attempt to render (and the larger they are),
-the faster your graphics hardware will need to be in order to render at 60 FPS. Affecting
-more particles requires a faster CPU. It is therefore important to test all
-particle effects on your target platform carefully, to calibrate the number and size of
-particles you can render at 60 FPS.
-
-It should be noted that a particle system can be disabled when not in use
-(e.g., on a non-visible element) to avoid doing unnecessary simulation.
-
-See the \l{Particle System Performance Guide} for more in-depth information.
-
-\section2 Shaders
-
-Shaders written in GLSL allow for complex transformations and visual effects to be written,
-however they should be used with care. Using a ShaderEffectSource causes a scene to
-prerendered into an FBO before it can be drawn. This extra overhead is quite expensive.
-
-A ShaderEffect element can imply a ShaderEffectSource (and the indirect rendering costs
-associated with that) and also involves uploading a vertex and fragment shader program
-(which is then compiled into a GLSL shader). Each fragment shader runs once for every
-pixel of the scene, and so these should be kept as simple as possible.
-
-\section1 Controlling Element Lifetime
-
-By partitioning an application into simple, modular components, each contained in a single
-QML file, you can achieve faster application startup time and better control over memory
-usage, and reduce the number of active-but-invisible elements in your application.
-
-\section2 Lazy Initialization
-
-The QML engine does some tricky things to try to ensure that loading and initialization of
-components doesn't cause frames to be skipped, however there is no better way to reduce
-startup time than to avoid doing work you don't need to do, and delaying the work until
-it is necessary. This may be achieved by using either \l Loader or creating components
-\l {qtqml-javascript-dynamicobjects.html}{dynamically}.
-
-\section3 Using Loader
-
-The Loader is an element which allows dynamic loading and unloading of components.
-
-\list
-\li Using the "active" property of a Loader, initialization can be delayed until required.
-\li Using the overloaded version of the "setSource()" function, initial property values can
- be supplied.
-\li Setting the Loader \l {Loader::asynchronous}{asynchronous} property to true may also
- improve fluidity while a component is instantiated.
-\endlist
-
-\section3 Using Dynamic Creation
-
-Developers can use the Qt.createComponent() function to create a component dynamically at
-runtime from within JavaScript, and then call createObject() to instantiate it. Depending
-on the ownership semantics specified in the call, the developer may have to delete the
-created object manually. See \l{qtqml-javascript-dynamicobjects.html}
-{Dynamic Object Management in QML} for more information.
-
-\section2 Destroy Unused Elements
-
-Elements which are invisible because they are a child of a non-visible element (e.g., the
-second tab in a tab-widget, while the first tab is shown) should be initialized lazily in
-most cases, and deleted when no longer in use, to avoid the ongoing cost of leaving them
-active (e.g., rendering, animations, property binding evaluation, etc).
-
-An item loaded with a Loader element may be released by resetting the "source" or
-"sourceComponent" property of the Loader, while other items may be explicitly
-released by calling destroy() on them. In some cases, it may be necessary to
-leave the item active, in which case it should be made invisible at the very least.
-
-See the upcoming section on Rendering for more information on active but invisible elements.
-
-\section1 Rendering
-
-The scene graph used for rendering in QtQuick 2.0 allows highly dynamic, animated user
-interfaces to be rendered fluidly at 60 FPS. There are some things which can
-dramatically decrease rendering performance, however, and developers should be careful
-to avoid these pitfalls wherever possible.
-
-\section2 Clipping
-
-Clipping is disabled by default, and should only be enabled when required.
-
-Clipping is a visual effect, NOT an optimization. It increases (rather than reduces)
-complexity for the renderer. If clipping is enabled, an item will clip its own painting,
-as well as the painting of its children, to its bounding rectangle. This stops the renderer
-from being able to reorder the drawing order of elements freely, resulting in a sub-optimal
-best-case scene graph traversal.
-
-Clipping inside a delegate is especially bad and should be avoided at all costs.
-
-\section2 Over-drawing and Invisible Elements
-
-If you have elements which are totally covered by other (opaque) elements, it is best to
-set their "visible" property to \c false or they will be needlessly drawn.
-
-Similarly, elements which are invisible (e.g., the second tab in a tab widget, while the
-first tab is shown) but need to be initialized at startup time (e.g., if the cost of
-instantiating the second tab takes too long to be able to do it only when the tab is
-activated), should have their "visible" property set to \c false, in order to avoid the
-cost of drawing them (although as previously explained, they will still incur the cost of
-any animations or bindings evaluation since they are still active).
-
-\section2 Manual Layouts
-
-The scene graph renderer is able to batch up certain operations to minimise the number of
-OpenGL state changes required. However, this optimization is only possible for the
-built-in layout elements provided by QtQuick 2.0, and cannot be applied to manual layouts.
-
-Therefore, application developers should use the Row, Column, Grid, GridView and ListView
-elements instead of manual layouts wherever possible.
-
-\section1 Memory Allocation And Collection
-
-The amount of memory which will be allocated by an application and the way in which that
-memory will be allocated are very important considerations. Aside from the obvious
-concerns about out-of-memory conditions on memory-constrained devices, allocating memory
-on the heap is a fairly computationally expensive operation, and certain allocation
-strategies can result in increased fragmentation of data across pages. JavaScript uses
-a managed memory heap which is automatically garbage collected, and this provides some
-advantages but also has some important implications.
-
-An application written in QML uses memory from both the C++ heap and an automatically
-managed JavaScript heap. The application developer needs to be aware of the subtleties
-of each in order to maximise performance.
-
-\section2 Tips For QML Application Developers
-
-The tips and suggestions contained in this section are guidelines only, and may not be
-applicable in all circumstances. Be sure to benchmark and analyse your application
-carefully using empirical metrics, in order to make the best decisions possible.
-
-\section3 Instantiate and initialize components lazily
-
-If your application consists of multiple views (for example, multiple tabs) but only
-one is required at any one time, you can use lazy instantiation to minimize the
-amount of memory you need to have allocated at any given time. See the prior section
-on \l{Lazy Initialization} for more information.
-
-\section3 Destroy unused objects
-
-If you lazily instantiate components, or dynamically create objects during a JavaScript
-expression, it is often better to manually \c{destroy()} them rather than waiting for
-automatic garbage collection to do so. See the prior section on
-\l{Controlling Element Lifetime} for more information.
-
-\section3 Don't manually invoke the garbage collector
-
-In most cases, it is not wise to manually invoke the garbage collector, as it will block
-the GUI thread for a substantial period of time. This can result in skipped frames and
-jerky animations, which should be avoided at all costs.
-
-There are some cases where manually invoking the garbage collector is acceptable (and
-this is explained in greater detail in an upcoming section), but in most cases, invoking
-the garbage collector is unnecessary and counter-productive.
-
-\section3 Avoid complex bindings
-
-Aside from the reduced performance of complex bindings (for example, due to having to
-enter the JavaScript execution context to perform evaluation), they also take up more
-memory both on the C++ heap and the JavaScript heap than bindings which can be
-evaluated by QML's optimized binding expression evaluator.
-
-\section3 Avoid defining multiple identical implicit types
-
-If a QML element has a custom property defined in QML, it becomes its own implicit type.
-This is explained in greater detail in an upcoming section. If multiple identical
-implicit types are defined inline in a component, some memory will be wasted. In that
-situation it is usually better to explicitly define a new component which can then be
-reused.
-
-Defining a custom property can often be a beneficial performance optimization (for
-example, to reduce the number of bindings which are required or re-evaluated), or it
-can improve the modularity and maintainability of a component. In those cases, using
-custom properties is encouraged; however, the new type should, if it is used more than
-once, be split into its own component (.qml file) in order to conserve memory.
-
-\section3 Re-use existing components
-
-If you are considering defining a new component, it's worth double checking that such a
-component doesn't already exist in the component set for your platform. Otherwise, you
-will be forcing the QML engine to generate and store type-data for a type which is
-essentially a duplicate of another pre-existing and potentially already loaded component.
-
-\section3 Use singleton types instead of pragma library scripts
-
-If you are using a pragma library script to store application-wide instance data,
-consider using a QObject singleton type instead. This should result in better performance,
-and will result in less JavaScript heap memory being used.
-
-\section2 Memory Allocation in a QML Application
-
-The memory usage of a QML application may be split into two parts: its C++ heap usage,
-and its JavaScript heap usage. Some of the memory allocated in each will be unavoidable,
-as it is allocated by the QML engine or the JavaScript engine, while the rest is
-dependent upon decisions made by the application developer.
-
-The C++ heap will contain:
-\list
- \li the fixed and unavoidable overhead of the QML engine (implementation data
- structures, context information, and so on)
- \li per-component compiled data and type information, including per-type property
- metadata, which is generated by the QML engine depending on which modules are
- imported by the application and which components the application loads
- \li per-object C++ data (including property values) plus a per-element metaobject
- hierarchy, depending on which components the application instantiates
- \li any data which is allocated specifically by QML imports (libraries)
-\endlist
-
-The JavaScript heap will contain:
-\list
- \li the fixed and unavoidable overhead of the JavaScript engine itself (including
- built-in JavaScript types)
- \li the fixed and unavoidable overhead of our JavaScript integration (constructor
- functions for loaded types, function templates, and so on)
- \li per-type layout information and other internal type-data generated by the JavaScript
- engine at runtime, for each type (see note below, regarding types)
- \li per-object JavaScript data ("var" properties, JavaScript functions and signal
- handlers, and non-optimized binding expressions)
- \li variables allocated during expression evaluation
-\endlist
-
-Furthermore, there will be one JavaScript heap allocated for use in the main thread, and
-optionally one other JavaScript heap allocated for use in the WorkerScript thread. If an
-application does not use a WorkerScript element, that overhead will not be incurred. The
-JavaScript heap can be several megabytes in size, and so applications written for
-memory-constrained devices may be best served to avoid using the WorkerScript element
-despite its usefulness in populating list models asynchronously.
-
-Note that both the QML engine and the JavaScript engine will automatically generate their
-own caches of type-data about observed types. Every component loaded by an application
-is a distinct (explicit) type, and every element (component instance) which defines its
-own custom properties in QML is an implicit type. Any element (instance of a component)
-which does not define any custom properties is considered by the JavaScript and QML engines
-to be of the type explicitly defined by the component, rather than its own implicit type.
-
-Consider the following example:
-\qml
-import QtQuick 2.0
-
-Item {
- id: root
-
- Rectangle {
- id: r0
- color: "red"
- }
-
- Rectangle {
- id: r1
- color: "blue"
- width: 50
- }
-
- Rectangle {
- id: r2
- property int customProperty: 5
- }
-
- Rectangle {
- id: r3
- property string customProperty: "hello"
- }
-
- Rectangle {
- id: r4
- property string customProperty: "hello"
- }
-}
-\endqml
-
-In the previous example, the rectangles \c r0 and \c r1 do not have any custom properties,
-and thus the JavaScript and QML engines consider them both to be of the same type. That
-is, \c r0 and \c r1 are both considered to be of the explicitly defined \c Rectangle type.
-The rectangles \c r2, \c r3 and \c r4 each have custom properties and are each considered
-to be different (implicit) types. Note that \c r3 and \c r4 are each considered to be of
-different types, even though they have identical property information, simply because the
-custom property was not declared in the component which they are instances of.
-
-If \c r3 and \c r4 were both instances of a \c RectangleWithString component, and that
-component definition included the declaration of a string property named \c customProperty,
-then \c r3 and \c r4 would be considered to be the same type (that is, they would be
-instances of the \c RectangleWithString type, rather than defining their own implicit type).
-
-\section2 In-Depth Memory Allocation Considerations
-
-Whenever making decisions regarding memory allocation or performance trade-offs, it is
-important to keep in mind the impact of CPU-cache performance, operating system paging,
-and JavaScript engine garbage collection. Potential solutions should be benchmarked
-carefully in order to ensure that the best one is selected.
-
-No set of general guidelines can replace a solid understanding of the underlying
-principles of computer science combined with a practical knowledge of the implementation
-details of the platform for which the application developer is developing. Furthermore,
-no amount of theoretical calculation can replace a good set of benchmarks and analysis
-tools when making trade-off decisions.
-
-\section3 Fragmentation
-
-Fragmentation is a C++ development issue. If the application developer is not defining
-any C++ types or plugins, they may safely ignore this section.
-
-Over time, an application will allocate large portions of memory, write data to that
-memory, and subsequently free some portions of that memory once it has finished using
-some of the data. This can result in "free" memory being located in non-contiguous
-chunks, which cannot be returned to the operating system for other applications to use.
-It also has an impact on the caching and access characteristics of the application, as
-the "living" data may be spread across many different pages of physical memory. This
-in turn could force the operating system to swap which can cause filesystem I/O - which
-is, comparatively speaking, an extremely slow operation.
-
-Fragmentation can be avoided by utilizing pool allocators (and other contiguous memory
-allocators), by reducing the amount of memory which is allocated at any one time by
-carefully managing object lifetimes, by periodically cleansing and rebuilding caches,
-or by utilizing a memory-managed runtime with garbage collection (such as JavaScript).
-
-\section3 Garbage Collection
-
-JavaScript provides garbage collection. Memory which is allocated on the JavaScript
-heap (as opposed to the C++ heap) is owned by the JavaScript engine. The engine will
-periodically collect all unreferenced data on the JavaScript heap, and if fragmentation
-becomes an issue, it will compact its heap by moving all "living" data into a contiguous
-region of memory (allowing the freed memory to be returned to the operating system).
-
-\section4 Implications of Garbage Collection
-
-Garbage collection has advantages and disadvantages. It ensures that fragmentation is
-less of an issue, and it means that manually managing object lifetime is less important.
-However, it also means that a potentially long-lasting operation may be initiated by the
-JavaScript engine at a time which is out of the application developer's control. Unless
-JavaScript heap usage is considered carefully by the application developer, the frequency
-and duration of garbage collection may have a negative impact upon the application
-experience.
-
-\section4 Manually Invoking the Garbage Collector
-
-An application written in QML will (most likely) require garbage collection to be
-performed at some stage. While garbage collection will be automatically triggered by
-the JavaScript engine when the amount of available free memory is low, it is occasionally
-better if the application developer makes decisions about when to invoke the garbage
-collector manually (although usually this is not the case).
-
-The application developer is likely to have the best understanding of when an application
-is going to be idle for substantial periods of time. If a QML application uses a lot
-of JavaScript heap memory, causing regular and disruptive garbage collection cycles
-during particularly performance-sensitive tasks (for example, list scrolling, animations,
-and so forth), the application developer may be well served to manually invoke the
-garbage collector during periods of zero activity. Idle periods are ideal for performing
-garbage collection since the user will not notice any degradation of user experience
-(skipped frames, jerky animations, and so on) which would result from invoking the garbage
-collector while activity is occurring.
-
-The garbage collector may be invoked manually by calling \c{gc()} within JavaScript.
-This will cause a comprehensive collection and compaction cycle to be performed, which
-may take from between a few hundred to more than a thousand milliseconds to complete, and
-so should be avoided if at all possible.
-
-\section3 Memory vs Performance Trade-offs
-
-In some situations, it is possible to trade-off increased memory usage for decreased
-processing time. For example, caching the result of a symbol lookup used in a tight loop
-to a temporary variable in a JavaScript expression will result in a significant performance
-improvement when evaluating that expression, but it involves allocating a temporary variable.
-In some cases, these trade-offs are sensible (such as the case above, which is almost always
-sensible), but in other cases it may be better to allow processing to take slightly longer
-in order to avoid increasing the memory pressure on the system.
-
-In some cases, the impact of increased memory pressure can be extreme. In some situations,
-trading off memory usage for an assumed performance gain can result in increased page-thrash
-or cache-thrash, causing a huge reduction in performance. It is always necessary to benchmark
-the impact of trade-offs carefully in order to determine which solution is best in a given
-situation.
-
-For in-depth information on cache performance and memory-time trade-offs, please see
-Ulrich Drepper's excellent article "What Every Programmer Should Know About Memory"
-(available at http://ftp.linux.org.ua/pub/docs/developer/general/cpumemory.pdf as at 18th
-April 2012), and for information on C++-specific optimizations, please see Agner Fog's
-excellent manuals on optimizing C++ applications (available at
-http://www.agner.org/optimize/ as at 18th April 2012).
-
-*/
diff --git a/src/quick/doc/src/appdevguide/porting.qdoc b/src/quick/doc/src/appdevguide/porting.qdoc
deleted file mode 100644
index 907f7403b9..0000000000
--- a/src/quick/doc/src/appdevguide/porting.qdoc
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-porting-qt5.html
-\title Porting QML Applications to Qt 5
-\brief Lists the Qt 5.0 changes that affect the existing QML applications
-
-When porting QML-related code from Qt 4.8 to Qt 5, application developers should be aware that
-the QML infrastructure has undergone considerable changes in Qt 5. The sections below describe
-these changes and the impact they have on your existing code.
-
-This article describes the changes that affect your existing code. If you are
-interested in the summary of all new features in Qt 5 for QML application development, see
-\l{Qt QML Release Notes} and \l{Qt Quick Release Notes}.
-
-\section1 QML Language changes
-
-There are very few changes in the QML language which affect the porting of existing Qt 4.8 QML code to Qt 5. These are:
-
-\list
-\li Individual file imports no longer work (e.g. import "MyType.qml"). Import the containing directory instead.
-\li Relative file paths in JavaScript files are now resolved relative to the location of the JavaScript file instead of the QML file that imported it.
-\endlist
-
-\section1 QtQuick Module
-
-The QtQuick module has been updated to version 2.0. All QML applications should update their import
-statements to use the new version:
-
-\qml
-import QtQuick 2.0
-\endqml
-
-
-\section2 Property and Method Changes
-
-\list
-\li ListView's \c highlightMoveSpeed and \c highlightResizeSpeed properties have been renamed to
-\l{ListView::}{highlightMoveVelocity} and \l{ListView::}{highlightResizeVelocity}, respectively.
-\li TextInput and TextEdit's \c openSoftwareInputPanel() and \c closeSoftwareInputPanel() methods
-have been removed. Use the new Qt.inputMethod property and call Qt.inputMethod.show()
-Qt.inputMethod.hide() to show and hide the virtual keyboard.
-\endlist
-
-\section2 Type and API Changes
-
-\list
-\li XmlListModel has moved into its own module, QtQuick.XmlListModel. Any code that uses the
-XmlListModel and XmlRole types must import \e {QtQuick.XmlListModel} instead.
-\li The local storage API that enables SQL support has been moved from the \l {QML Global Object}
-into a \c QtQuick.LocalStorage singleton type. Any code that requires the local storage API must import
-\e {QtQuick.LocalStorage} instead. See the \l {QtQuick.LocalStorage 2}{QtQuick.LocalStorage} documentation
-for examples.
-\li The \c LayoutItem type has been removed from the \c QtQuick module as it was specific to the
-Graphics View framework backend used in QtQuick 1.
-\endlist
-
-\section2 Behavioral Changes
-
-QtQuick 2.0 includes a number of behavioral changes and you should thoroughly test your applications after
-porting. These changes will not necessarily lead to run-time errors, but may break certain assumptions in your code.
-Below are the prominent changes to be aware of when porting your applications.
-
-Item opacity and visibility:
-
-\list
-\li The input handling details of \l{Item::}{opacity} and \l{Item::}{visible} have changed. An opacity of zero no
- longer affects input handling, where previously it stopped mouse input. A visibility of false no longer affects
- keyboard input, but still stops mouse input. The new \l{Item::}{enabled} property stops mouse and keyboard input, but does not affect how or whether
- the item is rendered. A workaround for applying the old behavior in most cases is to bind enabled to
- \tt {(visible && opacity > 0.0)}.
-\li Previously, if an item was in a positioner (i.e. a \l Row, \l Column, \l Grid and \l Flow)
- and the item's \c opacity changed to 0, or its \c visible value became \c false, the positioner
- would remove the item from its layout and collapse the space for that item. In QtQuick 2.0, this
- now only happens when an item's \c visible is \c false; the item opacity no longer affects whether
- the item is laid out. (This is consistent with the existing behavior of ListView and GridView).
-\endlist
-
-Text:
-
-\list
-\li The TextEdit::textFormat property now defaults to \c PlainText instead of \c AutoText.
-\li When Text::textFormat is set to \c Text.AutoText format, the text object will automatically
- switch to \c Text.StyledText instead of \c Text.RichText.
-\endlist
-
-Other:
-
-\list
-\li Modifying the Image::sourceSize now fits the image to the size, maintaining aspect
- ratio.
-\li For ListView and GridView, the \c cacheBuffer property now has a non-zero default and
- delegates in the cache buffer are created asynchronously. Also, using a \c RightToLeft layout
- now also reverses the \c preferredHighlightBegin and \c preferredHighlightEnd.
-\li For \l Loader, the \c sourceChanged and \c sourceComponentChanged signals are now only emitted
- when their respective properties change value. (Previously \l Loader emitted both of these signals
- when either of the relevant properties had changed.)
-\endlist
-
-
-\section2 Changes to experimental Qt.labs modules
-
-\list
-\li The \c Qt.labs.particles module has been removed. It is replaced by the fully-fledged \l
-QtQuick.particles module which is an enormous improvement on its predecessor.
-\li The \c Qt.labs.shaders module has been removed as the \c ShaderEffectItem and \l
-ShaderEffectSource types from this module have been moved into the \l QtQuick module. Note the \c
-ShaderEffectItem type has been renamed to \l ShaderEffect.
-\endlist
-
-
-\section1 C++ code
-
-In Qt 5, all QML applications are rendered with an OpenGL scenegraph architecture rather than the
-Graphics View framework used in Qt 4. Due to the scale of this architectural change, the C++ API has
-been extensively restructured and the \c QtDeclarative module has been deprecated in favour of two
-new modules: \l QtQml, which implements the QML engine and language infrastructure, and \l QtQuick,
-which implements the visual canvas and scenegraph backend.
-
-All classes that were previously in the \c QtDeclarative module have been moved into the \l QtQml
-and \l QtQuick modules, and their class names have been changed to reflect their new module
-locations. The class name changes are as follows:
-
-\table
-\header
- \li QtQml
- \li QtQuick
-\row
- \li
- \list
- \li QDeclarativeComponent -> QQmlComponent
- \li QDeclarativeContext -> QQmlContext
- \li QDeclarativeEngine -> QQmlEngine
- \li QDeclarativeError -> QQmlError
- \li QDeclarativeExpression -> QQmlExpression
- \li QDeclarativeExtensionPlugin -> QQmlExtensionPlugin
- \li QDeclarativeInfo -> QQmlInfo
- \li QDeclarativeListReference -> QQmlListReference
- \li QDeclarativeNetworkAccessManagerFactory -> QQmlNetworkAccessManagerFactory
- \li QDeclarativeParserStatus -> QQmlParserStatus
- \li QDeclarativeProperty -> QQmlProperty
- \li QDeclarativePropertyMap -> QQmlPropertyMap
- \li QDeclarativePropertyValueSource -> QQmlPropertyValueSource
- \li QDeclarativeScriptString -> QQmlScriptString
- \endlist
- \li
- \list
- \li QDeclarativeItem -> QQuickItem
- \li QDeclarativeView -> QQuickView
- \li QDeclarativeImageProvider -> QQuickImageProvider
- \endlist
-\endtable
-
-To use the new \c QtQml* and \c QtQuick* classes in Qt 5, link against the approprate module from
-your qmake \c .pro file. For example the following will link against both the QtQml and QtQuick
-modules:
-
-\code
-QT += qml quick
-\endcode
-
-Required header files can then be included:
-
-\code
-#include <QtQml/QQmlEngine>
-#include <QtQuick/QQuickView>
-\endcode
-
-(The \c QtDeclarative module is still available to developers as the \l QtQuick1 module, as
-discussed in \l{Using the QtDeclarative module in Qt 5}{below}. However, it should not be used for
-new applications.)
-
-
-\section3 QDeclarativeItem and QDeclarativeView
-
-When porting to QQuickItem, note that QDeclarativeItem inherited from QGraphicsItem; in contrast,
-QQuickItem inherits directly from QObject, and any QGraphicsItem-specific functionality is no longer
-available. In particular, QQuickItem does not have a \c paint() method for performing custom
-rendering through the QPainter API. Instead, in Qt 5, custom rendering should be performed through
-the new \c QSG* classes to take full advantage of the scene graph. See the \l {Qt Quick Scene Graph}
-documentation details on using these classes.
-
-Alternatively, the QQuickPaintedItem provides a \c paint() method and can be used as
-a convenient way to port QDeclarativeItem-based classes that use the QPainter API. Note this method
-is less performant than using the \c QSG* classes.
-
-When porting from QDeclarativeView to QQuickView, note that QDeclarativeItem inherited from
-QGraphicsView. In contrast, QQuickView inherits from QQuickWindow and uses the QWindow
-infrastructure introduced in Qt 5; any QGraphicsView-specific functionality is no longer available.
-
-
-\section3 qmlscene Utility
-
-The \c qmlviewer tool provided for prototyping and testing QML applications in Qt 4.x has been
-replaced with the \c qmlscene tool which integrates with the new scenegraph features in Qt 5.
-
-
-\section2 QML plugins
-
-All QML plugins should extend QQmlExtensionPlugin in Qt 5.
-
-Additionally, plugins should use the new Qt plugin infrastructure introduced in Qt 5. QML plugins no
-longer require the Q_EXPORT_PLUGIN2() macro. Instead, they should use the Q_PLUGIN_METADATA() macro
-within the plugin class declaration.
-
-See the updated \l {qtqml-modules-cppplugins.html}{Creating C++ Plugins For QML} documentation for
-an overview of creating QML plugins in Qt 5.
-
-
-\section2 QtDeclarative module in Qt 5
-
-For the purposes of porting older applications, the \c QtDeclarative module is still available in Qt
-5 but has been renamed to \c QtQuick1. Applications that required QtQuick 1 specific API (e.g.
-QDeclarativeView or QDeclarativeItem and the Graphics View integration) can use this module. Note
-that new applications should use the new \l QtQml and \l QtQuick modules instead.
-
-To use the \c QtQuick1 module, add “quick1” module to your qmake \c .pro file:
-
-\code
-QT += quick1
-\endcode
-
-Required header files can be included from the QtQuick 1 module:
-
-\code
-#include <QtQuick1/QDeclarativeView>
-#include <QtQuick1/QDeclarativeItem>
-\endcode
-
-*/
diff --git a/src/quick/doc/src/appdevguide/qmlscene.qdoc b/src/quick/doc/src/appdevguide/qmlscene.qdoc
deleted file mode 100644
index a749b48c04..0000000000
--- a/src/quick/doc/src/appdevguide/qmlscene.qdoc
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qtquick-qmlscene.html
- \ingroup qtquick-tools
- \title Prototyping with qmlscene
- \ingroup qttools
- \brief Utility to test and load QML files
-
- Qt 5 includes \c qmlscene, a utility to load QML documents.
- The \c{qmlscene} utility enables viewing your QML document even before the
- application is complete. This utility also provides the following
- additional features that are useful while developing QML applications:
- \list
- \li View the QML document in a maximized window.
- \li View the QML document in full-screen mode.
- \li Make the window transparent.
- \li Disable multi-sampling (anti-aliasing).
- \li Do not detect the version of the .qml file.
- \li Run all animations in slow motion.
- \li Resize the window to the size of the root item.
- \li Add the list of import paths.
- \li Add a named bundle.
- \li Use a translation file to set the language.
- \endlist
-
- The \c qmlscene utility is meant to be used for testing your QML
- applications, and not as a launcher in a production environment.
- To launch a QML application in a production environment, develop a custom
- C++ application or bundle the QML file in a module. See \l {Deploying QML
- applications} for more information.
-
- To load a .qml file, run the tool and select the file to be opened, or
- provide the file path on the command prompt:
-
- \code
- qmlscene myqmlfile.qml
- \endcode
-
- To see the configuration options, run \c qmlscene with the \c -help
- argument.
-
- \section1 Adding Module Import Paths
-
- Additional module import paths can be provided using the \c -I flag.
- For example, the \l{QML Plugin Example}{QML plugin example}
- creates a C++ plugin identified with the namespace, \c TimeExample.
- To load the plugin, you must run \c qmlscene with the \c{-I} flag from the
- example's base directory:
-
- \code
- qmlscene -I imports plugins.qml
- \endcode
-
- This adds the current directory to the import path so that \c qmlscene will
- find the plugin in the \c imports directory.
-
- \note By default, the current directory is included in the import search
- path, but modules in a namespace such as \c TimeExample are not found
- unless the path is explicitly added.
-
- \section1 Loading Test Data
-
- Often, QML applications are prototyped with test data that is later
- replaced by real data sources from C++ plugins. The \c qmlscene utility
- assists in this aspect by loading test data into the application context.
- It looks for a directory named \c {dummydata} in the same directory as
- the target QML file, and loads the .qml files in that directory as QML
- objects and bind them to the root context as properties named after the files.
-
- For example, the following QML document refers to a \c lottoNumbers
- property which does not exist within the document:
-
- \qml
- import QtQuick 2.0
-
- ListView {
- width: 200; height: 300
- model: lottoNumbers
- delegate: Text { text: number }
- }
- \endqml
-
- If within the document's directory, there is a \c{dummydata} directory
- which contains a \c lottoNumbers.qml file like this:
-
- \qml
- import QtQuick 2.0
-
- ListModel {
- ListElement { number: 23 }
- ListElement { number: 44 }
- ListElement { number: 78 }
- }
- \endqml
-
- Then this model would be automatically loaded into the ListView in the
- previous document.
-
- Child properties are included when loaded from \c dummydata. The following
- document refers to a \c clock.time property:
-
- \qml
- import QtQuick 2.0
- Text { text: clock.time }
- \endqml
-
- The text value could be filled by a \c dummydata/clock.qml file with a
- \c time property in the root context:
-
- \qml
- import QtQuick 2.0
- QtObject { property int time: 54321 }
- \endqml
-
- To replace this with real data, bind the real data object to
- the root context in C++ using QQmlContext::setContextProperty(). This is
- detailed in \l{Integrating QML and C++}.
-
-*/
-
diff --git a/src/quick/doc/src/appdevguide/qtquicktest.qdoc b/src/quick/doc/src/appdevguide/qtquicktest.qdoc
deleted file mode 100644
index 6d434279e6..0000000000
--- a/src/quick/doc/src/appdevguide/qtquicktest.qdoc
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qtquick-qtquicktest.html
- \inqmlmodule QtQuick 2
- \title Qt Quick Test Reference Documentation
- \brief unit testing framework for QML
-
- \section1 Introduction
-
- QtQuickTest is a unit test framework for QML applications.
- Test cases are written as JavaScript functions within a TestCase
- type:
-
- \code
- import QtQuick 2.0
- import QtTest 1.0
-
- TestCase {
- name: "MathTests"
-
- function test_math() {
- compare(2 + 2, 4, "2 + 2 = 4")
- }
-
- function test_fail() {
- compare(2 + 2, 5, "2 + 2 = 5")
- }
- }
- \endcode
-
- Functions whose names start with \c{test_} are treated as test cases
- to be executed. See the documentation for the \l TestCase and
- \l SignalSpy types for more information on writing test cases.
-
- \section1 Running tests
-
- Test cases are launched by a C++ harness that consists of
- the following code:
-
- \code
- #include <QtQuickTest/quicktest.h>
- QUICK_TEST_MAIN(example)
- \endcode
-
- Where "example" is an identifier to use to uniquely identify
- this set of tests. You should add \c{CONFIG += qmltestcase}.
- for example:
-
- \code
- TEMPLATE = app
- TARGET = tst_example
- CONFIG += warn_on qmltestcase
- SOURCES += tst_example.cpp
- \endcode
-
- The test harness scans the specified source directory recursively
- for "tst_*.qml" files. If \c{QUICK_TEST_SOURCE_DIR} is not defined,
- then the current directory will be scanned when the harness is run.
- Other *.qml files may appear for auxillary QML components that are
- used by the test.
-
- The \c{-input} command-line option can be set at runtime to run
- test cases from a different directory. This may be needed to run
- tests on a target device where the compiled-in directory name refers
- to a host. For example:
-
- \code
- tst_example -input /mnt/SDCard/qmltests
- \endcode
-
- It is also possible to run a single file using the \c{-input} option.
- For example:
-
- \code
- tst_example -input data/test.qml
- \endcode
-
- \code
- tst_example -input <full_path>/test.qml
- \endcode
-
- \note Specifying the full path to the qml test file is for example
- needed for shadow builds.
-
- If your test case needs QML imports, then you can add them as
- \c{-import} options to the test program command-line by adding
- the following line to your .pro file:
-
- \code
- IMPORTPATH += $$PWD/../imports/my_module1 $$PWD/../imports/my_module2
- \endcode
-
- The \c{-functions} command-line option will return a list of the current
- tests functions. It is possible to run a single test function using the name
- of the test function as an argument. For example:
-
- \code
- tst_example Test_Name::function1
- \endcode
-
- The \c{-help} command-line option will return all the options available.
-
- \code
- tst_example -help
- \endcode
-*/
diff --git a/src/quick/doc/src/appdevguide/quickstart/basics.qdoc b/src/quick/doc/src/appdevguide/quickstart/basics.qdoc
deleted file mode 100644
index 15f3c2f5ff..0000000000
--- a/src/quick/doc/src/appdevguide/quickstart/basics.qdoc
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-quickstart-basics.html
-\title Quick Start Guide - QML Basics
-\brief Basic QML application development examples
-
-\section1 Creating a QML Document
-
-A QML document defines a hierarchy of objects with a highly-readable,
-structured layout. Every QML document consists of two parts: an imports
-section and an object declaration section. The types and functionality most
-common to user interfaces are provided in the \c{QtQuick}
-import.
-
-\section2 Importing and Using the QtQuick Module
-
-To use the \l{Qt Quick} module, a QML document needs to
-import it. The import syntax looks like this:
-
-\qml
-import QtQuick 2.0
-\endqml
-
-The types and functionality that \l{Qt Quick} provides can now
-be used in the QML document!
-
-\section2 Defining an Object Hierarchy
-
-The object declaration in a QML document defines what will be displayed in the
-visual scene. \l{Qt Quick} provides the basic building blocks
-for all user interfaces, including objects to display images and text, and to
-handle user input.
-
-A simple object declaration might be a colored rectangle with some text centered
-in it:
-
-\qml
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-}
-\endqml
-
-This defines an object hierarchy with a root \l Rectangle object
-which has a child \l Text object. The \c parent of the \l Text object is
-automatically set to the \l Rectangle, and similarly, the \l Text object is
-added to the \c children property of the \l Rectangle object, by QML.
-
-\section2 Putting it Together
-
-The \l Rectangle and \l Text types used in the above example are both provided
-by the \c{QtQuick} import. Putting the import and object declaration
-together, we get a complete QML document:
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-}
-\endqml
-
-If we save that document as "HelloWorld.qml" we can load and display it.
-
-\section1 Loading and Displaying the QML Document
-
-To display the graphical scene defined by the QML document, it may be loaded
-with the \l{Prototyping with qmlscene}{qmlscene} tool. The
-\l{Prototyping with qmlscene}{qmlscene} tool should be installed into the
-Qt installation directory. Assuming that the Qt binaries are installed into
-or are available in the system executable path, you can display the QML
-document with the following command:
-
-\code
-qmlscene HelloWorld.qml
-\endcode
-
-You should see the text "Hello, World!" in the center of a red rectangle.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/quickstart/essentials.qdoc b/src/quick/doc/src/appdevguide/quickstart/essentials.qdoc
deleted file mode 100644
index d7a9ec3cdb..0000000000
--- a/src/quick/doc/src/appdevguide/quickstart/essentials.qdoc
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-quickstart-essentials.html
-\title Quick Start Guide - QML Essentials
-\brief Essential QML application development examples
-
-\section1 Handling User Input
-
-One of the great advantages of using QML to define a user interface is that it
-allows the user interface designer to define how the application should react
-to events with simple JavaScript expressions. In QML, we refer to those events
-as \l{Signal and Handler Event System}{signals} and such signals can be handled
-with \l{qml-signals-and-handlers}{signal handlers}.
-
-For example, consider the following example:
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: parent.color = "blue"
- }
-}
-\endqml
-
-This example can be saved as "ClickableHelloWorld.qml" and run with qmlscene.
-Whenever the user clicks anywhere in the window, the rectangle will change
-from red to blue. Note that the \l MouseArea type also emits the clicked
-signal for touch events, so this code will also work on a mobile device.
-
-Keyboard user input can be similarly handled with a simple expression:
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-
- focus: true
- Keys.onPressed: {
- if (event.key == Qt.Key_Return) {
- color = "blue";
- event.accepted = true;
- }
- }
-}
-\endqml
-
-By accepting focus, the color can be changed to blue whenever the return key
-is pressed.
-
-\section1 Property Bindings
-
-Objects and their properties form the basis of a graphical interface defined
-in a QML document. The QML language allows properties to be bound to each
-other in various ways, enabling highly dynamic user interfaces.
-
-In the following example, the geometry of each child \l Rectangle is bound to
-that of the parent \l Rectangle. If the geometry of the parent \l Rectangle
-were to change, the geometry of each child \l Rectangle would automatically
-update due to the property bindings.
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 400
- height: 200
-
- Rectangle {
- width: parent.width / 2
- height: parent.height
- }
-
- Rectangle {
- width: parent.width / 2
- height: parent.height
- x: parent.width / 2
- }
-}
-\endqml
-
-\section1 Animations
-
-Properties can also be dynamically updated via animations. The \c QtQuick
-import provides various animation types which can be used to animate changes
-to a property's value. In the following example, a property is animated which
-then gets displayed in a \l Text area:
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- color: "lightgray"
- width: 200
- height: 200
-
- property int animatedValue: 0
- SequentialAnimation on animatedValue {
- loops: Animation.Infinite
- PropertyAnimation { to: 150; duration: 1000 }
- PropertyAnimation { to: 0; duration: 1000 }
- }
-
- Text {
- anchors.centerIn: parent
- text: animatedValue
- }
-}
-\endqml
-
-The value being displayed will vary from 0 to 150 periodically.
-
-\section1 Defining Custom QML Types for Re-use
-
-One of the most important concepts in QML is that of type re-use. An
-application will probably have multiple visual types which are all similar
-(for example, multiple push buttons), and QML allows these sort of things to
-be defined as re-usable, custom types, to minimize code duplication and
-maximize readability.
-
-For example, imagine that the developer defines a new \c Button type in the
-\c Button.qml file:
-
-\snippet qml/qml-extending-types/components/Button.qml 0
-
-That type may now be re-used multiple times in the application, as follows:
-
-\table
-\row
-\li \snippet qml/qml-extending-types/components/application.qml 0
-\li \image qml-extending-types.png
-\endtable
-
-
-In this way, modular user interface types can be built up and re-used within
-an application.
-
-See \l {QML Object Attributes}
-for more details on how to develop your own reusable components.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/animations.qdoc b/src/quick/doc/src/appdevguide/usecases/animations.qdoc
deleted file mode 100644
index b237849caf..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/animations.qdoc
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-animations.html
-\title Usecase - Animations In QML
-\brief Example of how to include animations in QML applications
-
-QtQuick provides the ability to animate properties. Animating properties allows property values to move through
-intermediate values instead of immediately changing to the target value. To animate the position of an item, you can
-animate the properties that controle the item's position, x and y for example, so that the item's position
-changes each frame on the way to the target position.
-
-\section1 Fluid UIs
-
-QML was designed to facilitate the creation of fluid UIs. These are user interfaces where the UI components animate instead of appearing, disappearing, or jumping abruptly. Qt Quick provides two simple ways to have UI
-components move with animation instead of instantly appearing at their new location.
-
-\section2 States and Transitions
-
-Qt Quick allows you to declare various UI states in \l State objects. These states are comprised of property changes from a
-base state, and can be a useful way of organizing your UI logic. Transitions are objects you can associate with an item
-to define how its properties will animate when they change due to a state change.
-
-States and transitions for an item can be declared with the \l Item::states and \l Item::transitions properties.
-States are declared inside the states list property of an item, usually the root item of the component. Transitions
-defined on the same item are used to animate the changes in the state. Here is an example.
-
-\snippet qml/usecases/animations.qml states
-
-\section2 Animating Property Changes.
-
-Behaviors can be used to specify an animation for a property to use when it changes. This is then applied to all
-changes, regardless of their source. The following example animates a button moving around the
-screen using behaviors.
-
-\snippet qml/usecases/animations.qml behave
-
-\section1 Other Animations
-
-Not all animations have to be tied to a specific property or state. You can also create animations more generally, and
-specify target items and properties inside the animation. Here are some examples of different ways to do this:
-
-\snippet qml/usecases/animations.qml constant
-\snippet qml/usecases/animations.qml scripted
-\image qml-uses-animation.png
-
-More information about animations can be found on the \l{Important Concepts in Qt Quick - States, Transitions and
-Animations} page.
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc b/src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc
deleted file mode 100644
index 4bad4a4033..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-integratingjs.html
-\title Use Case - Integrating JavaScript in QML
-\brief Example of how to integrate JavaScript code in QML applications
-
-JavaScript code can be easily integrated into QML to provide UI logic, imperative control, or other benefits.
-
-\section1 Using JavaScript Expressions for Property Values
-
-JavaScript expressions can be used in QML as bindings. For example
-\code
-Item {
- width: Math.random()
- height: width < 100 ? 100 : (width + 50) / 2
-}
-\endcode
-
-Note that function calls, like Math.random(), will not be revaluated unless their arguments
-change. So binding to Math.random() will be one random number and not revaluated, but if the width is changed in some
-other manner, the height binding will be reevaluated to take that into account.
-
-\section1 Adding JavaScript Functions in QML
-
-JavaScript functions can be declared on QML items, like in the below example. This allows you to call the method
-using the item id.
-
-\snippet qml/usecases/integratingjs-inline.qml 0
-
-\section1 Using JavaScript files
-
-JavaScript files can be used for abstracting out logic from QML files. To do this, first place your functions inside a
-.js file like in the example shown.
-
-\snippet qml/usecases/myscript.js 0
-
-Then import the file into any .qml file that needs to use the functions, like the example QML file below.
-
-\snippet qml/usecases/integratingjs.qml 0
-
-\image qml-uses-integratingjs.png
-
-For further details on the JavaScript engine used by QML, as well as the difference from browser JS, see the full
-documentation on \c {Using JavaScript Expressions with QML}.
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/layouts.qdoc b/src/quick/doc/src/appdevguide/usecases/layouts.qdoc
deleted file mode 100644
index e8e35a93e7..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/layouts.qdoc
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-layouts.html
-\title Use Case - Layouts In QML
-\brief Example of how to create layouts for visual components in a QML application
-
-There are several ways to position items in QML.
-
-Below is a brief overview. For more details, see \l {Important Concepts In Qt Quick - Positioning}.
-
-\section1 Manual Positioning
-
-Items can be placed at specific x,y coordinates on the screen by setting their x,y properties. This will
-setup their position relative to the top left corner of their parent, according to the
-\l {Concepts - Visual Coordinates in Qt Quick}{visual coordinate system} rules.
-
-Combined with using \l{Property Binding}{bindings} instead of constant valudes for these properties, relative positioning is also easily
-accomplished by setting the x and y coordinates to the appropriate bindings.
-
-\snippet qml/usecases/layouts.qml import
-\snippet qml/usecases/layouts.qml direct
-
-\image qml-uses-layouts-direct.png
-
-
-\section1 Anchors
-
-The \c Item type provides the abilitiy to anchor to other \l Item types. There are six anchor lines for each item: \e left,
-\e right, \e{vertical center}, \e top, \e bottom and \e{horizontal center}. The three vertical anchor lines can be anchored to any of
-the three vertical anchor lines of another item, and the three horizontal anchor lines can be anchored to the
-horizontal anchor lines of another item.
-
-For full details, see \l {Positioning with Anchors} and the documentation of the \l{Item::anchors.top}{anchors property}.
-
-\snippet qml/usecases/layouts.qml import
-\snippet qml/usecases/layouts.qml anchors
-
-\image qml-uses-layouts-anchors.png
-
-
-\section1 Positioners
-
-For the common case of wanting to position a set of types in a regular pattern, Qt Quick provides some positioner
-types. Items placed in a positioner are automatically positioned in some way; for example, a \l Row positions items to be
-horizontally adjacent (forming a row).
-
-For full details see \l {Item Layouts} and the documentation for \l{qtquick-qmltypereference.html#positioning}{the positioner types}.
-
-\snippet qml/usecases/layouts.qml import
-\snippet qml/usecases/layouts.qml positioners
-
-\image qml-uses-layouts-positioners.png
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/styling.qdoc b/src/quick/doc/src/appdevguide/usecases/styling.qdoc
deleted file mode 100644
index 68b8d0302c..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/styling.qdoc
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-styling.html
-\title Use Case - Style And Theme Support
-\brief Example of how to style user interface components in QML
-
-The types provided in the QtQuick module are not complete user interface components on their own. A common use case is to
-develop a set of custom styled user interface components out of the types in the QtQuick module. This is easily
-accomplished by creating your own reusable components.
-
-With the reusable components approach, you define your own type with the appearance you want to have in your
-application and style that type directly. You then use that type in your application instead of the unstyled type. For
-example, you could create a MyText.qml which is a Text type with certain properties set by default, and use MyText
-instead of Text elsewhere in your application.
-
-\section1 Example Themed Text
-\section2 Button Definition
-\snippet qml/usecases/MyText.qml 0
-\section2 Using the Text
-\snippet qml/usecases/styling-text.qml texts
-\image qml-uses-styling-text.png
-
-Because the root item in MyText.qml is a Text item it will behave as a
-Text item, and the properties can be overriden in specific uses. However, the properties will be set to the values
-specified in MyText when the item is first generated, thus applying your style by default.
-
-For pre-styled user interface components, see the \c{Qt Components} add-on which provides a set of components.
-For accessing the system theme, see the \l{SystemPalette} type documentation.
-
-\section1 Example Themed Button
-\section2 Button Definition
-\snippet qml/usecases/Button.qml 0
-\section2 Using the Button
-\snippet qml/usecases/styling.qml 0
-\image qml-uses-styling.png
-
-For more examples of creating custom UI components in QML, see the tutorials.
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/text.qdoc b/src/quick/doc/src/appdevguide/usecases/text.qdoc
deleted file mode 100644
index d0b8901170..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/text.qdoc
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-text.html
-\title Use Case - Displaying Text In QML
-\brief Example of how to display text in QML
-To display text the Text type is provided by the QtQuick module. For related uses, the \l{TextInput} and
-\l{TextEdit} types provide editable text controls. For full HTML markup, see the \c{QtWebkit} module.
-
-\section1 Displaying and Formatting Text
-
-To display text in QML, create a Text item and set the text property to the text you wish to display. The Text item
-will now display that text.
-
-Several properties can be set on the Text item to style the entire block of text. These include color, font family,
-font size, bold and italic. For a full list of properties, consult the \l{Text} type documentation.
-
-Rich text like markup can be used to selectively style specific sections of text with a Text item. Set \l
-Text::textFormat to Text.StyledText to use this functionality. More details are available in the documentation of the
-\l{Text} type.
-
-\section1 Laying out Text
-
-By default, Text will display the text as a single line unless it contains embedded newlines. To wrap the line, set the
-wrapMode property and give the text an explicit width for it to wrap to. If the width or height is not explicitly set,
-reading these properties will return the parameters of the bounding rect of the text (if you have explicitly set width
-or height, you can still use paintedWidth and paintedHeight). With these parameters in mind, the Text can be positioned
-like any other Item.
-
-\section1 Example Code
-\snippet qml/usecases/text.qml 0
-\image qml-uses-text.png
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/userinput.qdoc b/src/quick/doc/src/appdevguide/usecases/userinput.qdoc
deleted file mode 100644
index 1e20f9d275..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/userinput.qdoc
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-userinput.html
-\title Use Case - Responding To User Input in QML
-\brief Example of how to accept user input and respond to it in a QML application
-
-\section1 Supported Types of User Input
-
-The \l QtQuick module provides support for the most common types of user input,
-including mouse and touch events, text input and key-press events. Other
-modules provide support for other types of user input (for example, the
-\l QtSensors module provides support for shake-gestures in QML applications).
-
-This article covers how to handle basic user input; for further information
-about motion-gesture support, please see the \l QtSensors documentation. For
-information about audio-visual input, please see the \l QtMultimedia documentation.
-
-\section2 Mouse and Touch Events
-
-The \l MouseArea type allows mouse and touch events to be handled in a QML
-application. A \l MouseArea can be combined with either an \l Image or a
-\l Rectangle and \l Text object to implement a simple button.
-
-\snippet qml/usecases/userinput.qml 0
-
-For more advanced use cases requiring multiple touch points, please read the
-documentation for the \l MultiPointTouchArea type and the \l PinchArea type.
-
-Note that some types have their own built in input handling. For example,
-\l Flickable responds to mouse dragging, mouse wheel scrolling, touch dragging,
-and touch flicking by default.
-
-\section2 Keyboard and Button Events
-
-Button and key presses, from buttons on a device, a keypad, or a keyboard,
-can all be handled using the \l Keys attached property. This attached property
-is available on all \l Item derived types, and works with the \l Item::focus property
-to determine which type receives the key event. For simple key handling, you can set the focus
-to true on a single \l Item and do all your key handling there.
-
-\snippet qml/usecases/userinput-keys.qml 0
-
-For text input the \l QtQuick module provides several built-in types.
-In particular, the \l TextInput and \l TextEdit types allow for single-line
-entry and multi-line editing respectively.
-
-Here is all you need to get a working TextInput:
-
-\code
-import QtQuick 2.0
-
-TextInput {
- focus: true
- text: "Initial Text"
-}
-\endcode
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/visual.qdoc b/src/quick/doc/src/appdevguide/usecases/visual.qdoc
deleted file mode 100644
index a022b185fe..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/visual.qdoc
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-visual.html
-\title Use Case - Visual Elements In QML
-\brief Example of how to display visual item types in a QML application
-
-\section1 The Rectangle Type
-
-For the most basic of visuals, QtQuick provides a \l Rectangle type to draw rectangles. These rectangles can be colored with a
-color or a vertical gradient. The \l Rectangle type can also draw borders on the rectangle.
-
-For drawing custom shapes beyond rectangles, see the \l Canvas type or display
-a pre-rendered image using the \l Image type.
-
-\snippet qml/usecases/visual-rects.qml 0
-\image qml-uses-visual-rectangles.png
-
-\section1 The Image Type
-
-QtQuick provides an \l Image type which may be used to display images. The
-\l Image type has a \l source property whose value can be a remote or local
-URL, or the URL of an image file embedded in a compiled resource file.
-
-\snippet qml/usecases/visual.qml image
-
-For more complex images there are other types similar to \l Image.
-\l BorderImage draws an image with grid scaling, suitable for images used as
-borders. \l AnimatedImage plays animated .gif and .mng images. \l AnimatedSprite
-and \l SpriteSequence play animations comprised of multiple frames stored adjacently
-in a non animated image format.
-
-For displaying video files and camera data, see the \l QtMultimedia module.
-
-\section1 Shared Visual Properties
-
-All visual items provided by the QtQuick are based on the Item type, which provides a common set of attributes for
-visual items, including opacity and transform attributes.
-
-\section2 Opacity and Visibility
-
-The QML object types provided by Qt Quick have built-in support for \l{Item::opacity}{opacity}.
-Opacity can be animated to allow smooth transitions to or from a transparent
-state. Visibility can also be managed with the \l{Item::visible}{visible} property more efficiently,
-but at the cost of not being able to animate it.
-
-\snippet qml/usecases/visual-opacity.qml 0
-\image qml-uses-visual-opacity.png
-
-\section2 Transforms
-
-Qt Quick types have built-in support for transformations. If you wish to have your
-visual content rotated or scaled, you can set the \l Item::rotation or \l Item::scale
-property. These can also be animated.
-
-\snippet qml/usecases/visual-transforms.qml 0
-\image qml-uses-visual-transforms.png
-
-For more complex transformations, see the \l Item::transform property.
-
-*/
diff --git a/src/quick/doc/src/concepts/convenience/topic.qdoc b/src/quick/doc/src/concepts/convenience/topic.qdoc
index 113b4952a6..1a6feeaa61 100644
--- a/src/quick/doc/src/concepts/convenience/topic.qdoc
+++ b/src/quick/doc/src/concepts/convenience/topic.qdoc
@@ -66,7 +66,7 @@ required (or when it becomes available).
\section1 Dynamic Signal Connections
QML supports dynamic signal connections through a signal's \c{connect()}
-method. The QtQuick module provides the convenience \l Connections type which
+method. The \l {Qt Quick} module provides the convenience \l Connections type which
allows setting up a signal connection involving an object which isn't part of
the static object hierarchy. It also allows the connection to be dynamically
retargeted at runtime, which allows an application to process different signal
diff --git a/src/quick/doc/src/concepts/effects/particles.qdoc b/src/quick/doc/src/concepts/effects/particles.qdoc
index 708e8d2740..ec49c6df43 100644
--- a/src/quick/doc/src/concepts/effects/particles.qdoc
+++ b/src/quick/doc/src/concepts/effects/particles.qdoc
@@ -44,7 +44,6 @@
/*!
\page qtquick-effects-particles.html
- \inqmlmodule QtQuick.Particles 2.0
\title Using the Qt Quick Particle System
Documentation for all Particle System types can be found on the \l{QtQuick.Particles 2}{QtQuick.Particles} module page.
@@ -132,7 +131,6 @@
/*!
\page qtquick-particles-performance.html
- \inqmlmodule QtQuick 2.0
\title Particle System Performance Guide
The performance of the particle system scales with the number of particles it is maintaining. After prototyping the desired
diff --git a/src/quick/doc/src/concepts/effects/sprites.qdoc b/src/quick/doc/src/concepts/effects/sprites.qdoc
index 7ee98a533b..805a423002 100644
--- a/src/quick/doc/src/concepts/effects/sprites.qdoc
+++ b/src/quick/doc/src/concepts/effects/sprites.qdoc
@@ -27,7 +27,6 @@
/*!
\ingroup qtquick-images-sprites
-\ingroup qml-features
\page qtquick-effects-sprites.html
\title Sprite Animations
\brief Sprite-based animations with flexible transitioning
@@ -36,7 +35,7 @@
\section1 Sprite Engine
-The QtQuick sprite engine is a stochastic state machine combined with the ability
+The \l {Qt Quick} sprite engine is a stochastic state machine combined with the ability
to chop up images containing multiple frames of an animation.
\section2 State Machine
diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc
index 1c73c9b5ba..827f6d85c8 100644
--- a/src/quick/doc/src/concepts/input/focus.qdoc
+++ b/src/quick/doc/src/concepts/input/focus.qdoc
@@ -27,14 +27,13 @@
/*!
\page qtquick-input-focus.html
-\ingroup qml-features
\title Keyboard Focus in Qt Quick
\brief handling keyboard focus
When a key is pressed or released, a key event is generated and delivered to the
focused Qt Quick \l Item. To facilitate the construction of reusable components
-and to address some of the cases unique to fluid user interfaces, the Qt Quick items add aged
-\e scope based extension to Qt's traditional keyboard focus model.
+and to address some of the cases unique to fluid user interfaces, the Qt Quick items add a
+scope based extension to Qt's traditional keyboard focus model.
\tableofcontents
@@ -43,17 +42,16 @@ and to address some of the cases unique to fluid user interfaces, the Qt Quick i
When the user presses or releases a key, the following occurs:
\list 1
\li Qt receives the key action and generates a key event.
-\li If the Qt widget containing the \l QQuickView has focus, the key event
-is delivered to it. Otherwise, regular Qt key handling continues.
-\li The key event is delivered by the scene to the QML \l Item with
-\e {active focus}. If no Item has active focus, the key event is
-\l {QEvent::ignore()}{ignored} and regular Qt key handling continues.
-\li If the QML Item with active focus accepts the key event, propagation
-stops. Otherwise the event is "bubbled up", by recursively passing it to each
-Item's parent until either the event is accepted, or the root Item is reached.
+\li If a \l QQuickWindow is the active window, the key event
+is delivered to it.
+\li The key event is delivered by the scene to the \l Item with
+\e {active focus}. If no item has active focus, the key event is ignored.
+\li If the \l QQuickItem with active focus accepts the key event, propagation
+stops. Otherwise the event is send to the Item's parent until
+the event is accepted, or the root item is reached.
If the \c {Rectangle} type in the following example has active focus and the \c A key is pressed,
-it will bubble up to its parent. However, pressing the \c B key will bubble up to the root
+the event will not be propagated further. Pressing the \c B key the event will propagate to the root
item and thus subsequently be ignored.
\snippet qml/focus/rectangle.qml simple key event
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index 7b8d66f2a6..28bbbf1cca 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -28,7 +28,7 @@
/*!
\page qtquick-modelviewsdata-cppmodels.html
\title Using C++ Models with Qt Quick Views
-\brief using QtQuick views with models defined in C++
+\brief using Qt Quick views with models defined in C++
\section1 Data Provided In A Custom C++ Model
@@ -49,12 +49,12 @@ via the \e modelData role.
Here is a ListView with a delegate that references its model item's
value using the \c modelData role:
-\snippet quick/models/stringlistmodel/view.qml 0
+\snippet models/stringlistmodel/view.qml 0
A Qt application can load this QML document and set the value of \c myModel
to a QStringList:
-\snippet quick/models/stringlistmodel/main.cpp 0
+\snippet models/stringlistmodel/main.cpp 0
The complete source code for this example is available in
\l {quick/modelviews/stringlistmodel}{examples/quick/modelviews/stringlistmodel}
@@ -74,11 +74,11 @@ The following application creates a \c DataObject class with
Q_PROPERTY values that will be accessible as named roles when a
QList<DataObject*> is exposed to QML:
-\snippet quick/models/objectlistmodel/dataobject.h 0
+\snippet models/objectlistmodel/dataobject.h 0
\dots 4
-\snippet quick/models/objectlistmodel/dataobject.h 1
+\snippet models/objectlistmodel/dataobject.h 1
\codeline
-\snippet quick/models/objectlistmodel/main.cpp 0
+\snippet models/objectlistmodel/main.cpp 0
\dots
The QObject* is available as the \c modelData property. As a convenience,
@@ -86,7 +86,7 @@ the properties of the object are also made available directly in the
delegate's context. Here, \c view.qml references the \c DataModel properties in
the ListView delegate:
-\snippet quick/models/objectlistmodel/view.qml 0
+\snippet models/objectlistmodel/view.qml 0
Note the use of \c color property with qualifier.
The properties of the object are not replicated in the \c model
@@ -130,21 +130,21 @@ which exposes the \e type and \e sizes roles. It reimplements
QAbstractItemModel::roleNames() to expose the role names, so that they can be
accessed via QML:
-\snippet quick/models/abstractitemmodel/model.h 0
+\snippet models/abstractitemmodel/model.h 0
\dots
-\snippet quick/models/abstractitemmodel/model.h 1
+\snippet models/abstractitemmodel/model.h 1
\dots
-\snippet quick/models/abstractitemmodel/model.h 2
+\snippet models/abstractitemmodel/model.h 2
\codeline
-\snippet quick/models/abstractitemmodel/model.cpp 0
+\snippet models/abstractitemmodel/model.cpp 0
\codeline
-\snippet quick/models/abstractitemmodel/main.cpp 0
+\snippet models/abstractitemmodel/main.cpp 0
\dots
This model is displayed by a ListView delegate that accesses the \e type and \e size
roles:
-\snippet quick/models/abstractitemmodel/view.qml 0
+\snippet models/abstractitemmodel/view.qml 0
QML views are automatically updated when the model changes. Remember the model
must follow the standard rules for model changes and notify the view when
diff --git a/src/quick/doc/src/concepts/positioning/layouts.qdoc b/src/quick/doc/src/concepts/positioning/layouts.qdoc
index 9165c2f6df..35be2f6235 100644
--- a/src/quick/doc/src/concepts/positioning/layouts.qdoc
+++ b/src/quick/doc/src/concepts/positioning/layouts.qdoc
@@ -28,10 +28,9 @@
/*!
\ingroup qtquick-positioners
\page qtquick-positioning-layouts.html
-\ingroup qml-features
-\title Item Layouts
+\title Item Positioners
-Positioner items are container items that manage the positions and sizes of
+Positioner items are container items that manage the positions of
items in a declarative user interface. Positioners behave in a similar way to
the \l{Widgets and Layouts}{layout managers} used with standard Qt widgets,
except that they are also containers in their own right.
@@ -39,6 +38,10 @@ except that they are also containers in their own right.
Positioners make it easier to work with many items when they need
to be arranged in a regular layout.
+\l{Qt Quick Layouts} can also be used to arrange Qt Quick items in a user interface.
+They manage both the positions and the sizes of items on a declarative user interface,
+and are well suited for resizable user interfaces.
+
\section1 Positioners
A set of standard positioners are provided in the basic set of Qt Quick
diff --git a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
index 7052de3b49..bc67594960 100644
--- a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
+++ b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
@@ -27,7 +27,6 @@
/*!
\page qtquick-positioning-righttoleft.html
-\ingroup qml-features
\title Right-to-left User Interfaces
\brief switching text flow and layout
\section1 Overview
@@ -139,7 +138,7 @@ The painting of these icons can be mirrored with a dedicated \c mirror property
\section1 Default layout direction
-The \l {QML:Qt::application}{Qt.application.layoutDirection} property can be used to query the active layout direction of the
+The \l {QtQml2::Qt::application}{Qt.application.layoutDirection} property can be used to query the active layout direction of the
application. It is based on QApplication::layoutDirection(), which most commonly determines the layout
direction from the active language translation file.
diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc
index 25fc6eaab7..bae6a7f71b 100644
--- a/src/quick/doc/src/concepts/positioning/topic.qdoc
+++ b/src/quick/doc/src/concepts/positioning/topic.qdoc
@@ -34,7 +34,7 @@ Visual items in QML can be positioned in a variety of ways. The most important
positioning-related concept is that of anchoring, a form of relative
positioning where items can be anchored (or attached) to each other at certain
boundaries. Other positioning concepts include absolute positioning,
-positioning with coordinate bindings, and layouts.
+positioning with coordinate bindings, positioners, and layouts.
\section1 Manual Positioning
@@ -134,21 +134,20 @@ positioning, whereas a "contaminated" anchor layout is one which uses both
anchoring and bindings (either on position-related [x,y] properties or on
dimension-related [width,height] properties) to determine the position.
-\section1 Layouts
-
-Qt Quick also provides some built-in layout items. For many use cases, the
-best layout to use is a simple grid, row, or column, and Qt Quick provides
-items which will layout children in these formations in the most efficient
-manner possible.
+\section1 Positioners
-There are many well-known layouts which work well in user-interfaces, such as
-grids and lists, rows and columns. Qt Quick supports these sort of pre-defined
-layouts, which can often be more performant to draw than anchor or
-binding-based layouts. See the documentation on
-\l{qtquick-positioning-layouts.html}{layout types} for more
-information about utilizing pre-defined layouts.
+Qt Quick also provides some built-in positioner items. For many use cases, the best
+positioner to use is a simple grid, row, or column, and Qt Quick provides items which
+will position children in these formations in the most efficient manner possible.
+See the documentation on \l{qtquick-positioning-layouts.html}{item positioners types}
+for more information about utilizing pre-defined positioners.
+\section1 Layouts
+From Qt 5.1, the module \l {Qt Quick Layouts} can also be used to arrange Qt Quick
+items in a user interface. Unlike positioners, the types in Qt Quick Layouts manage
+both the positions and sizes of items in a declarative interface. They are well
+suited for resizable user interfaces.
\section1 Right-To-Left Support
diff --git a/src/quick/doc/src/dynamicview-tutorial.qdoc b/src/quick/doc/src/dynamicview-tutorial.qdoc
index daa14a6973..fad09b396b 100644
--- a/src/quick/doc/src/dynamicview-tutorial.qdoc
+++ b/src/quick/doc/src/dynamicview-tutorial.qdoc
@@ -27,7 +27,6 @@
/*!
\page qml-dynamicview-tutorial.html tutorial
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial
\brief A tutorial describing how to re-arrange items in a QML ListView
\nextpage QML Dynamic View Ordering Tutorial 1 - A Simple ListView and Delegate
@@ -51,7 +50,6 @@ directory.
/*!
\page qml-dynamicview-tutorial1.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 1 - A Simple ListView and Delegate
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial
@@ -64,12 +62,12 @@ delegate which provides a template for constructing items in the view.
The code for the ListView and delegate looks like this:
-\snippet quick/tutorials/dynamicview/dynamicview1/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview1/dynamicview.qml 0
The model is defined in a separate QML file which looks like this:
-\snippet quick/tutorials/dynamicview/dynamicview1/PetsModel.qml 0
-\snippet quick/tutorials/dynamicview/dynamicview1/PetsModel.qml 1
+\snippet tutorials/dynamicview/dynamicview1/PetsModel.qml 0
+\snippet tutorials/dynamicview/dynamicview1/PetsModel.qml 1
\section2 Walkthrough
@@ -79,16 +77,15 @@ is the template from which each item in the ListView is constructed.
The \c name, \c age, \c type, and \c size variables referenced in the delegate are sourced from
the model data. The names correspond to roles defined in the model.
-\snippet quick/tutorials/dynamicview/dynamicview1/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview1/dynamicview.qml 1
The second part of the application is the ListView itself to which we bind the model and delegate.
-\snippet quick/tutorials/dynamicview/dynamicview1/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview1/dynamicview.qml 2
*/
/*!
\page qml-dynamicview-tutorial2.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 2 - Dragging View Items
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial 1 - A Simple ListView and Delegate
@@ -100,7 +97,7 @@ Now that we have a visible list of items we want to be able to interact with the
by extending the delegate so the visible content can be dragged up and down the screen. The
updated delegate looks like this:
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 0
\section2 Walkthrough
@@ -109,8 +106,8 @@ for mouse events and will allow us to drag the delegate's content item. It also
a container for the content item which is important as a delegate's root item is positioned by
the view and cannot be moved by other means.
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 1
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 2
Dragging the content item is enabled by binding it to the MouseArea's
\l {QtQuick2::MouseArea::drag.target}{drag.target} property. Because we still want the view to be
@@ -120,20 +117,19 @@ timeout has expired it is interpreted as moving the list and if it moves after i
dragging an item. To make it more obvious to the user when an item can be dragged we'll change the
background color of the content item when the timeout has expired.
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 3
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 3
The other thing we'll need to do before an item can be dragged is to unset any anchors on the
content item so it can be freely moved around. We do this in a state change that is triggered
when the delegate item is held, at the same time we can reparent the content item to the root item
so that is above other items in the stacking order and isn't obscured as it is dragged around.
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 4
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 4
*/
/*!
\page qml-dynamicview-tutorial3.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 3 - Moving Dragged Items
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial 2 - Dragging View Items
@@ -145,10 +141,10 @@ The next step in our application to move items within the list as they're dragge
can re-order the list. To achieve this we introduce three new types to our application;
VisualDataModel, \l Drag and DropArea.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 0
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 1
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 2
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 5
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 5
\section2 Walkthrough
@@ -156,7 +152,7 @@ In order to re-order the view we need to determine when one item has been dragge
the Drag attached property we can generate events that are sent to the scene graph whenever the item
it is attached to moves.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 1
Drag events are only sent while the active property is true, so in this example the first event
would be sent when the delegate was held with additional event sents when dragging. The
@@ -167,7 +163,7 @@ Then we use a DropArea in each view item to determine when the hot spot of the d
intersects another item, when a drag enters one of these DropAreas we can move the dragged item
to the index of the item it was dragged over.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 3
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 3
To move the items within the view we use a VisualDataModel. The VisualDataModel type is used by
the view types to instantiate delegate items from model data and when constructed explicitly can
@@ -181,13 +177,12 @@ To utilize a VisualDataModel with a ListView we bind it to the \l {QtQuick2::Lis
property of the view and bind the \l {QtQuick2::VisualDataModel::model}{model} and
\l {QtQuick2::VisualDataModel::delegate}{delegate} to the VisualDataModel.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 4
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 4
*/
/*!
\page qml-dynamicview-tutorial4.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 4 - Sorting Items
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial 3 - Moving Dragged Items
@@ -198,7 +193,7 @@ Drag and drop isn't the only way items in a view can be re-ordered, using a Visu
also possible to sort items based on model data. To do that we extend our VisualDataModel instance
like this:
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 0
\section2 Walkthrough
@@ -209,8 +204,8 @@ we want items to first be added to an unsorted group from where we can transfer
position in the items group. To do that we clear includeByDefault on the items group and set it on
a new group name 'unsorted'.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 1
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 2
We sort the items by first finding the position in the items group to insert the first unsorted
item and then transfer the item to the items group before moving it to the pre-determined index and
@@ -221,19 +216,19 @@ with the \l {QtQuick2::VisualDataModel::get} {get} function. Through the model
handle we can access the same model data that is available in a delegate instance of that item and
compare against other items to determine relative position.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 3
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 3
The lessThan argument to the sort function is a comparsion function which will determine the order
of the list. In this example it can be one of the following:
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 4
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 4
A sort is triggered whenever new items are added to the unsorted VisualDataGroup which we are
notified of by the \l {QtQuick2::VisualDataGroup::onChanged}{onChanged} handler. If no sort
function is currently selected we simply transfer all items from the unsorted group to the items
group, otherwise we call sort with the selected sort function.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 5
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 5
Finally when the selected sort order changes we can trigger a full re-sort of the list by moving
all items from the items group to the unsorted group, which will trigger the
@@ -241,6 +236,6 @@ all items from the items group to the unsorted group, which will trigger the
items group in correct order. Note that the \l {QtQuick2::VisualDataGroup::onChanged}{onChanged}
handler will not be invoked recursively so there's no issue with it being invoked during a sort.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 6
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 6
*/
diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc
index aad8cfc3c4..ddca973496 100644
--- a/src/quick/doc/src/examples.qdoc
+++ b/src/quick/doc/src/examples.qdoc
@@ -33,16 +33,18 @@
\ingroup all-examples
\ingroup qtquick
\target qtquick-samples
-\inqmlmodule QtQuick 2
These are code samples that show how to use various aspects of Qt Quick. Larger
compound interfaces are grouped as applications as they demonstrate more Qt
Quick features.
+Here is a list of fully-functional demo applications.
To run the sample applications, open them in Qt Creator or use the included
\l {Prototyping with qmlscene}{qmlscene} tool.
-Some of these code samples have a corresponding \l{qtquick-tutorials}{tutorial}.
+\annotatedlist{qtquickdemos}
+
+Some of these code samples below have a corresponding \l{qtquick-tutorials}{tutorial}.
The Qt Quick features are covered in the \l {qtquick-overviews}{main page}.
This set of code samples are part of the collection of \l{Qt Examples}.
@@ -131,7 +133,7 @@ code using the \l{Qt QML} module.
\li \l{external: Qt Mobility QML Plugins}{QML Plugins}
\li \l{external: Qt Quick Components for Symbian}{Symbian Components}
\li MeeGo Components
- \li \l{QtWebKit QML Module}
+ \li \l{Qt WebKit QML Types}
\endlist
\enddiv
\div {class="threecolumn_piece"}
diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc
index 14f0151a3b..6863758455 100644
--- a/src/quick/doc/src/qmltypereference.qdoc
+++ b/src/quick/doc/src/qmltypereference.qdoc
@@ -36,19 +36,19 @@ interfaces and applications with QML. This page lists every QML type provided
by this module, organized according to category and purpose.
-\section1 Importing QtQuick
+\section1 Importing \c QtQuick
-The types provided by the QtQuick module are only available in a QML document
+The types provided by the \l {Qt Quick} module are only available in a QML document
if that document imports the \c QtQuick namespace.
-The current version of the QtQuick module is version 2.0, and thus it may be
+The current version of the \c QtQuick module is version 2.0, and thus it may be
imported via the following statement:
\qml
import QtQuick 2.0
\endqml
-See the QtQuick module documentation for more
+See the \l {Qt Quick} module documentation for more
information about the concepts which are central to \c QtQuick.
\section2 Submodules
@@ -56,14 +56,20 @@ information about the concepts which are central to \c QtQuick.
Qt Quick includes several submodules which contain additional types.
\list
- \li \l{QtQuick.XmlListModel 2}{XML List Model} - contains types
+ \li \l{Qt Quick XmlListModel QML Types}{XML List Model} - contains types
for creating models from XML data
- \li \l{QtQuick.LocalStorage 2}{Local Storage} - a submodule
+ \li \l{Qt Quick Local Storage QML Types}{Local Storage} - a submodule
containing a JavaScript interface for an SQLite database
- \li \l{QtQuick.Particles 2}{Particles} - provides a particle
+ \li \l{Qt Quick Particles QML Types}{Particles} - provides a particle
system for QML applications
- \li \l{QtQuick.Window 2}{Window} - contains types for creating
+ \li \l{Qt Quick Window QML Types}{Window} - contains types for creating
top-level windows and accessing screen information
+ \li \l{Qt Quick Dialogs QML Types}{Dialogs} - contains types for creating and
+ interacting with system dialogs
+ \li \l{Qt Quick Controls QML Types}{Controls} - provides a set of reusable
+ UI components
+ \li \l{Qt Quick Layouts QML Types}{Layouts} - contains types that are used
+ to arrange items in the user interface
\endlist
\section1 Basic Types
@@ -72,15 +78,15 @@ There are a number of basic types that are
\l{qtqml-typesystem-basictypes.html#basic-types-provided-by-the-qml-language}
{supported by default in the QML language}.
-In addition, the QtQuick module provides the following basic types:
+In addition, the \c QtQuick module provides the following basic types:
\annotatedlist qtquickbasictypes
\section1 Object Types
-All of the object types provided by QtQuick are based on the \l{Item} type,
-which itself derives from \l{QML::QtObject}. \l{qtqml-typereference-topic.html#object-types}
+All of the object types provided by \c QtQuick are based on the \l{Item} type,
+which itself derives from \l{QtQml2::QtObject}{QtObject}. \l{qtqml-typereference-topic.html#object-types}
{QML object types} provided by the Qt QML module
-(such as \l{QML::QtObject} and \l{QML::Component}) are also available when
+(such as \l{QtQml2::QtObject}{QtObject} and \l{QtQml2::Component}{Component}) are also available when
you import \c QtQuick.
\section2 Visual Types
@@ -228,13 +234,26 @@ Animation paths
\section2 Model/View Types And Data Storage And Access
-Models And Model Data
+QML Lists and Models
+
+The \l{Qt QML Models QML Types}{Qt QML Models} submodule provides the types for
+structuring data with models and lists.
+\list
+\li \l ListModel - Defines a list of data
+\li \l ListElement - Defines a data item in a \l ListModel
+\endlist
+
+These QML types are part of Qt Quick for backwards compatibility, but for
+newer applications, \l{Qt QML Models QML Types}{Qt QML Models} provides
+the same functionality.
\list
-\li \l {QtQuick2::ListModel}{ListModel} - Defines a list of data
-\li \l {QtQuick2::ListElement}{ListElement} - Defines a data item in a \l {QtQuick2::ListModel}{ListModel}
\li \l {VisualItemModel} - Contains items that already defines its own visual delegate
\li \l {VisualDataModel} - Encapsulates a model and a delegate
-\li \l {VisualDataGroup} -Encapsulates a filtered set of visual data items
+\li \l {VisualDataGroup} - Encapsulates a filtered set of visual data items
+\endlist
+
+XML Lists
+\list
\li \l {XmlListModel} - Specifies a model using XPath expressions
\li \l {XmlRole} - Specifies a role for an \l {XmlListModel}
\endlist
@@ -259,7 +278,7 @@ Data Storage
\li \l {ShaderEffect} - Allows GLSL shaders to be used as graphical effects
\li \l {ShaderEffectSource} - Usable as a texture in ShaderEffect
\li \l {GridMesh} - Generates a grid mesh of vertices for use by ShaderEffect
-\li The \l{QtQuick.Particles 2} module provides a set of Particle System types for QtQuick 2
+\li The \l{QtQuick.Particles 2} module provides a set of Particle System types for Qt Quick 2
\endlist
\section2 Convenience Types
@@ -286,14 +305,14 @@ Data Storage
/*!
\qmlmodule QtQuick 2
-\brief The QtQuick 2 module provides graphical primitives for use in QML.
+\brief The \c {QtQuick 2} module provides graphical primitives for use in QML.
-The QtQuick 2 module provides graphical primitive types. They can be used with the following import
+The \c {QtQuick 2} module provides graphical primitive types. They can be used with the following import
\code
import QtQuick 2.1
\endcode
-For a more detailed listing of types in the \c QtQuick 2 import, see the \l{Qt Quick QML Types} page.
+For a more detailed listing of types in the \c {QtQuick 2} import, see the \l{Qt Quick QML Types} page.
For more details about the module itself, see the \l{Qt Quick} module page.
*/
@@ -311,9 +330,9 @@ For more details about the module itself, see the \l{Qt Quick} module page.
\li By a hexadecimal triplet or quad in the form \c "#RRGGBB" and \c "#AARRGGBB"
respectively. For example, the color red corresponds to a triplet of \c "#FF0000"
and a slightly transparent blue to a quad of \c "#800000FF".
- \li Using the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()},
- \l{QML:Qt::darker()}{Qt.darker()}, \l{QML:Qt::lighter()}{Qt.lighter()} or
- \l{QML:Qt::tint()}{Qt.tint()} functions.
+ \li Using the \l{QtQml2::Qt::rgba()}{Qt.rgba()}, \l{QtQml2::Qt::hsla()}{Qt.hsla()},
+ \l{QtQml2::Qt::darker()}{Qt.darker()}, \l{QtQml2::Qt::lighter()}{Qt.lighter()} or
+ \l{QtQml2::Qt::tint()}{Qt.tint()} functions.
\endlist
Example:
@@ -335,7 +354,7 @@ For more details about the module itself, see the \l{Qt Quick} module page.
}
\endqml
- To test color values for equality, use the \l{QML:Qt::colorEqual()}{Qt.colorEqual()}
+ To test color values for equality, use the \l{QtQml2::Qt::colorEqual()}{Qt.colorEqual()}
function. This allows colors to be accurately compared whether they are in property
form or in any of the acceptable string specification forms.
@@ -576,7 +595,7 @@ console.log(c + " " + d); // false true
Rotation { angle: 60; axis: "0,1,0" }
\endqml
- or with the \l{QML:Qt::vector3d()}{Qt.vector3d()} function:
+ or with the \l{QtQml2::Qt::vector3d()}{Qt.vector3d()} function:
\qml
Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }
diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc
index 1944129392..deb6aa164c 100644
--- a/src/quick/doc/src/qtquick.qdoc
+++ b/src/quick/doc/src/qtquick.qdoc
@@ -38,17 +38,18 @@ provides a visual canvas and includes types for creating and animating
visual components, receiving user input, creating data models and views
and delayed object instantiation.
-The Qt Quick module provides both the \c QtQuick QML module, which supplies
-\l{Qt Quick QML Types}{a set of QML types} for creating user
-interfaces with the QML language, and the \c QtQuick C++ module, which supplies
-\l{Qt Quick C++ Classes}{a set of C++ APIs} for integrating with user interfaces and
-applications built with QML and the \c QtQuick QML module.
+The Qt Quick module provides both a \l{Qt Quick QML Types}{QML API} which supplies
+QML types for creating user interfaces with the QML language, and a
+\l{Qt Quick C++ Classes}{C++ API} for extending QML applications with C++ code.
+
+\note From Qt 5.1, a set of Qt Quick based UI controls is available to
+create user interfaces. Please see \l{Qt Quick Controls}
+for more information.
For those new to QML and Qt Quick, please see
\l{QML Application Developer Resources}
for an introduction to writing QML applications.
-
\section1 Important Concepts in Qt Quick
Qt Quick provides everything needed to create a rich application with a fluid
@@ -75,7 +76,7 @@ of the \l{qtquick-quickstart-basics.html}{QML Basics} and
\l{qtquick-quickstart-essentials.html}{QML Essentials} from the
\l{qtquick-applicationdevelopers.html}{QML Application Developer Resources}.
-To find out more about using the QML language, see the \l{Qt QML Module Documentation}.
+To find out more about using the QML language, see the \l{Qt QML} module documentation.
\section1 Qt Quick Module Documentation
@@ -124,6 +125,8 @@ Additional Qt Quick information:
system for Qt Quick
\li \l{QtQuick.Window 2}{Window} - contains types for creating
top-level windows and accessing screen information
+ \li \l{Qt Quick Dialogs}{Dialogs} - contains types for creating and
+ interacting with system dialogs
\endlist
\li \l{Qt Quick Release Notes} - list of changes and additions in the Qt Quick
\li \l{Qt Quick Code Samples} - list of all Qt Quick examples
diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc
index b1f2304529..bd07c9a98d 100644
--- a/src/quick/doc/src/tutorial.qdoc
+++ b/src/quick/doc/src/tutorial.qdoc
@@ -27,13 +27,12 @@
/*!
\page qml-tutorial.html
-\inqmlmodule QtQuick 2
\title QML Tutorial
\brief An introduction to the basic concepts and features of QML.
\previouspage Introduction to the QML Language
\nextpage QML Tutorial 1 - Basic Types
-This tutorial gives an introduction to QML, the mark up language for Qt Quick. It doesn't cover everything;
+This tutorial gives an introduction to QML, the declarative language for Qt Quick. It doesn't cover everything;
the emphasis is on teaching the key principles, and features are introduced as needed.
Through the different steps of this tutorial we will learn about QML basic types, we will create our own QML component
@@ -55,7 +54,6 @@ Tutorial chapters:
/*!
\page qml-tutorial1.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 1 - Basic Types
\contentspage QML Tutorial
\previouspage QML Tutorial
@@ -68,7 +66,7 @@ The picture below is a screenshot of this program.
Here is the QML code for the application:
-\snippet quick/tutorials/helloworld/tutorial1.qml 0
+\snippet tutorials/helloworld/tutorial1.qml 0
\section1 Walkthrough
@@ -77,11 +75,11 @@ Here is the QML code for the application:
First, we need to import the types that we need for this example. Most QML files will import the built-in QML
types (like \l{Rectangle}, \l{Image}, ...) that come with Qt, using:
-\snippet quick/tutorials/helloworld/tutorial1.qml 3
+\snippet tutorials/helloworld/tutorial1.qml 3
\section2 Rectangle Type
-\snippet quick/tutorials/helloworld/tutorial1.qml 1
+\snippet tutorials/helloworld/tutorial1.qml 1
We declare a root object of type \l{Rectangle}. It is one of the basic building blocks you can use to create an application in QML.
We give it an \c{id} to be able to refer to it later. In this case, we call it "page".
@@ -90,7 +88,7 @@ The \l{Rectangle} type contains many other properties (such as \c x and \c y), b
\section2 Text Type
-\snippet quick/tutorials/helloworld/tutorial1.qml 2
+\snippet tutorials/helloworld/tutorial1.qml 2
We add a \l Text type as a child of the root Rectangle type that displays the text 'Hello world!'.
@@ -114,7 +112,6 @@ qmlscene tutorials/helloworld/tutorial1.qml
/*!
\page qml-tutorial2.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 2 - QML Components
\contentspage QML Tutorial
\previouspage QML Tutorial 1 - Basic Types
@@ -133,37 +130,37 @@ The component's filename must always start with a capital letter.
Here is the QML code for \c Cell.qml:
-\snippet quick/tutorials/helloworld/Cell.qml 0
+\snippet tutorials/helloworld/Cell.qml 0
\section1 Walkthrough
\section2 The Cell Component
-\snippet quick/tutorials/helloworld/Cell.qml 1
+\snippet tutorials/helloworld/Cell.qml 1
The root type of our component is an \l Item with the \c id \e container.
An \l Item is the most basic visual type in QML and is often used as a container for other types.
-\snippet quick/tutorials/helloworld/Cell.qml 4
+\snippet tutorials/helloworld/Cell.qml 4
We declare a \c cellColor property. This property is accessible from \e outside our component, this allows us
to instantiate the cells with different colors.
This property is just an alias to an existing property - the color of the rectangle that compose the cell
(see \l{Property Binding in QML}).
-\snippet quick/tutorials/helloworld/Cell.qml 5
+\snippet tutorials/helloworld/Cell.qml 5
We want our component to also have a signal that we call \e clicked with a \e cellColor parameter of type \e color.
We will use this signal to change the color of the text in the main QML file later.
-\snippet quick/tutorials/helloworld/Cell.qml 2
+\snippet tutorials/helloworld/Cell.qml 2
Our cell component is basically a colored rectangle with the \c id \e rectangle.
The \c anchors.fill property is a convenient way to set the size of a visual type.
In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-Based Layout}).
-\snippet quick/tutorials/helloworld/Cell.qml 3
+\snippet tutorials/helloworld/Cell.qml 3
In order to change the color of the text when clicking on a cell, we create a \l MouseArea type with
the same size as its parent.
@@ -175,11 +172,11 @@ When this signal is triggered we want to emit our own \e clicked signal with the
In our main QML file, we use our \c Cell component to create the color picker:
-\snippet quick/tutorials/helloworld/tutorial2.qml 0
+\snippet tutorials/helloworld/tutorial2.qml 0
We create the color picker by putting 6 cells with different colors in a grid.
-\snippet quick/tutorials/helloworld/tutorial2.qml 1
+\snippet tutorials/helloworld/tutorial2.qml 1
When the \e clicked signal of our cell is triggered, we want to set the color of the text to the \e cellColor passed as a parameter.
We can react to any signal of our component through a property of the name \e 'onSignalName' (see \l{Signal Attributes}).
@@ -187,7 +184,6 @@ We can react to any signal of our component through a property of the name \e 'o
/*!
\page qml-tutorial3.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 3 - States and Transitions
\contentspage QML Tutorial
\previouspage QML Tutorial 2 - QML Components
@@ -200,11 +196,11 @@ We want our text to move to the bottom of the screen, rotate and become red when
Here is the QML code:
-\snippet quick/tutorials/helloworld/tutorial3.qml 0
+\snippet tutorials/helloworld/tutorial3.qml 0
\section1 Walkthrough
-\snippet quick/tutorials/helloworld/tutorial3.qml 2
+\snippet tutorials/helloworld/tutorial3.qml 2
First, we create a new \e down state for our text type.
This state will be activated when the \l MouseArea is pressed, and deactivated when it is released.
@@ -213,7 +209,7 @@ The \e down state includes a set of property changes from our implicit \e {defau
(the items as they were initially defined in the QML).
Specifically, we set the \c y property of the text to \c 160, the rotation to \c 180 and the \c color to red.
-\snippet quick/tutorials/helloworld/tutorial3.qml 3
+\snippet tutorials/helloworld/tutorial3.qml 3
Because we don't want the text to appear at the bottom instantly but rather move smoothly,
we add a transition between our two states.
diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc
index 3959a1b5eb..973d41dca2 100644
--- a/src/quick/doc/src/whatsnew.qdoc
+++ b/src/quick/doc/src/whatsnew.qdoc
@@ -28,15 +28,51 @@
/*!
\title Qt Quick Release Notes
\page qtquick-releasenotes.html
-\inqmlmodule QtQuick 2.0
-\section1 Qt 5.0 - QtQuick C++ Module
+\section1 Qt Quick in Qt 5.1
-The QtQuick C++ module is new in Qt 5. It provides the visual canvas and scenegraph back-end
-as well as the QtQuick QML module for QML application development.
+\l{Qt Quick} 2.1 is new in Qt 5.1. This is a summary of improvements and new
+features introduced by the new import and new classes in Qt 5.1:
+\list
+\li New threaded render loop for Mac, Linux, and Embedded.
+\li New render loop for windows for smoother animations.
+\li New \l Window properties: activeFocusItem, minimumWidth, minimumHeight,
+ maximumWidth, maximumHeight, visibility, contentOrientation, and opacity.
+\li New \l Item property: activeFocusOnTab.
+\li New \l Grid properties: horizontalAlignment, verticalAlignment, and
+ effectiveHorizontalAlignment.
+\li New \l TextEdit properties: selectByKeyboard and textDocument
+\li A \l Window declared inside another Window or \l Item will automatically be
+ transient for (centered upon) the outer window.
+\li These types are now part of \l{Qt QML}:
+ \list
+ \li \l {VisualItemModel}
+ \li \l {VisualDataModel} - Encapsulates a model and a delegate
+ \li \l {VisualDataGroup}
+ \endlist
+ These types are kept due to compatibility reasons and are replaced by the
+ \l{Qt QML Models QML Types}{Qt QML Models} types.
+ \endlist
+\endlist
+
+\section2 New Submodules
+
+In Qt 5.1, there are several new modules which extend Qt Quick functionalities.
+\list
+\li \l{Qt Quick Dialogs} - contains types for creating and interacting with system dialogs
+\li \l{Qt Quick Controls} - provides a set of reusable UI components
+\li \l{Qt Quick Layouts} - contains types that are used to arrange items in the user interface
+\endlist
+
+The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release.
+
+\section1 Qt Quick in Qt 5.0
+
+The \l {Qt Quick} module is new in Qt 5. It provides the visual canvas and scenegraph back-end
+as well as the \c QtQuick QML module for QML application development.
-As of Qt 5, the QtQuick module is based on an OpenGL scenegraph. Many of the classes in
-the QtQuick module have been ported from the \c QtDeclarative module from Qt 4.8 to use
+As of Qt 5, the \l {Qt Quick} module is based on an OpenGL scenegraph. Many of the classes in
+the \l {Qt Quick} module have been ported from the \l {Qt Quick 1}{QtDeclarative} module from Qt 4.8 to use
the scenegraph architecture; these classes have been renamed to use a \c QQuick* prefix.
(See the \l {Porting QML Applications to Qt 5} for porting information.)
@@ -77,10 +113,10 @@ Custom rendering can be performed on the scenegraph using the following new clas
\section1 Qt 5.0 - QtQuick QML Module
-The QtQuick 2.0 QML module is a major update.
+The \c {QtQuick 2.0} QML module is a major update.
-Below are the additions in QtQuick 2.0. For a list of behavioral changes which may affect
-applications ported from QtQuick 1.x, see the \l {Porting QML Applications to Qt 5}.
+Below are the additions in \c {QtQuick 2.0}. For a list of behavioral changes which may affect
+applications ported from \c {QtQuick 1.x}, see the \l {Porting QML Applications to Qt 5}.
\section2 Visual types, Graphical Effects and Sprites
@@ -345,11 +381,11 @@ the window loses focus.
\section2 Property types
Support for various math and geometry-related value types, including QVector2D, QVector3D, QVector4D,
-QMatrix4x4 and QQuaternion, as well as QColor and QFont, are now provided by QtQuick. Properties of
+QMatrix4x4 and QQuaternion, as well as QColor and QFont, are now provided by \l {Qt Quick}. Properties of
these types can be declared in QML documents via the property syntax where the type name is \c vector2d,
\c vector3d, \c vector4d, \c matrix4x4, \c quaternion, \c color and \c font respectively.
-QtQuick also provides implementation for the various value type factory or utility functions of the
+\l {Qt Quick} also provides implementation for the various value type factory or utility functions of the
\c Qt object which return or operate on values of the above types. The functions are:
\table
\header
@@ -386,8 +422,8 @@ QtQuick also provides implementation for the various value type factory or utili
\endtable
The \c Qt.rgba(), \c Qt.hsla(), \c Qt.tint(), \c Qt.lighter(), \c Qt.darker()
-and \c Qt.fontFamilies() functions already existed in \c QtDeclarative prior
-to QtQuick 2.0; the other functions are all new in QtQuick 2.0.
+and \c Qt.fontFamilies() functions already existed in \l {Qt Quick 1}{QtDeclarative} prior
+to \l {Qt Quick}{Qt Quick 2}; the other functions are all new in \l {Qt Quick}{Qt Quick 2}.
\section1 Qt 5.0 - Additional QML Modules
@@ -406,7 +442,7 @@ documentation for comprehensive details.
\section2 QtQuick.XmlListModel
-This new module contains XmlListModel and associated types, which were previously in the QtQuick
+This new module contains XmlListModel and associated types, which were previously in the \c QtQuick
module. See the \l{QtQuick.XmlListModel 2}{QtQuick.XmlListModel} documentation for details.
\section2 QtQuick.LocalStorage
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index e7546535a1..9c4cef1fe1 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -175,7 +175,6 @@ public:
uint hasTileSize :1;
uint hasCanvasWindow :1;
uint available :1;
- uint contextInitialized :1;
QQuickCanvasItem::RenderTarget renderTarget;
QQuickCanvasItem::RenderStrategy renderStrategy;
QString contextType;
@@ -193,7 +192,6 @@ QQuickCanvasItemPrivate::QQuickCanvasItemPrivate()
, hasTileSize(false)
, hasCanvasWindow(false)
, available(false)
- , contextInitialized(false)
, renderTarget(QQuickCanvasItem::Image)
, renderStrategy(QQuickCanvasItem::Cooperative)
{
@@ -272,7 +270,7 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
requires the pixel data to be exchanged between the system memory and the
graphic card, which is significantly more expensive. Rendering may also be
synchronized with the V-sync signal (to avoid
- \l{en.wikipedia.org/wiki/Screen_tearing}{screen tearing}) which will further
+ \l{http://en.wikipedia.org/wiki/Screen_tearing}{screen tearing}) which will further
impact pixel operations with \c Canvas.FrambufferObject render target.
\section1 Tips for Porting Existing HTML5 Canvas applications
@@ -343,7 +341,7 @@ void QQuickCanvasItem::setContextType(const QString &contextType)
if (contextType.compare(d->contextType, Qt::CaseInsensitive) == 0)
return;
- if (d->contextInitialized) {
+ if (d->context) {
qmlInfo(this) << "Canvas already initialized with a different context type";
return;
}
@@ -368,7 +366,7 @@ void QQuickCanvasItem::setContextType(const QString &contextType)
QQmlV4Handle QQuickCanvasItem::context() const
{
Q_D(const QQuickCanvasItem);
- if (d->contextInitialized)
+ if (d->context)
return QQmlV4Handle(d->context->v4value());
return QQmlV4Handle(QV4::Value::nullValue());
@@ -402,7 +400,7 @@ void QQuickCanvasItem::setCanvasSize(const QSizeF & size)
d->canvasSize = size;
emit canvasSizeChanged();
- if (d->contextInitialized)
+ if (d->context)
polish();
}
}
@@ -437,7 +435,7 @@ void QQuickCanvasItem::setTileSize(const QSize & size)
emit tileSizeChanged();
- if (d->contextInitialized)
+ if (d->context)
polish();
}
}
@@ -470,7 +468,7 @@ void QQuickCanvasItem::setCanvasWindow(const QRectF& rect)
d->hasCanvasWindow = true;
emit canvasWindowChanged();
- if (d->contextInitialized)
+ if (d->context)
polish();
}
}
@@ -502,7 +500,7 @@ void QQuickCanvasItem::setRenderTarget(QQuickCanvasItem::RenderTarget target)
{
Q_D(QQuickCanvasItem);
if (d->renderTarget != target) {
- if (d->contextInitialized) {
+ if (d->context) {
qmlInfo(this) << "Canvas:renderTarget not changeble once context is active.";
return;
}
@@ -546,7 +544,7 @@ void QQuickCanvasItem::setRenderStrategy(QQuickCanvasItem::RenderStrategy strate
{
Q_D(QQuickCanvasItem);
if (d->renderStrategy != strategy) {
- if (d->contextInitialized) {
+ if (d->context) {
qmlInfo(this) << "Canvas:renderStrategy not changeable once context is active.";
return;
}
@@ -651,7 +649,7 @@ void QQuickCanvasItem::updatePolish()
Q_D(QQuickCanvasItem);
- if (d->contextInitialized)
+ if (d->context && d->renderStrategy != QQuickCanvasItem::Cooperative)
d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
if (d->animationCallbacks.size() > 0 && isVisible()) {
@@ -676,7 +674,7 @@ void QQuickCanvasItem::updatePolish()
}
}
- if (d->contextInitialized) {
+ if (d->context) {
if (d->renderStrategy == QQuickCanvasItem::Cooperative)
update();
else
@@ -688,8 +686,10 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
{
Q_D(QQuickCanvasItem);
- if (!d->contextInitialized)
+ if (!d->context || d->canvasWindow.size().isEmpty()) {
+ delete oldNode;
return 0;
+ }
QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode*>(oldNode);
if (!node)
@@ -700,10 +700,13 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
else
node->setFiltering(QSGTexture::Nearest);
- if (d->renderStrategy == QQuickCanvasItem::Cooperative)
+ if (d->renderStrategy == QQuickCanvasItem::Cooperative) {
+ d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
d->context->flush();
+ }
node->setTexture(d->context->texture());
+ node->markDirty(QSGNode::DirtyMaterial);
node->setRect(QRectF(QPoint(0, 0), d->canvasWindow.size()));
return node;
}
@@ -763,7 +766,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
/*!
\qmlmethod long QtQuick2::Canvas::requestAnimationFrame(callback)
- This function schedules callback to be invoked before composing the QtQuick
+ This function schedules callback to be invoked before composing the Qt Quick
scene.
*/
@@ -970,7 +973,7 @@ bool QQuickCanvasItem::isImageLoaded(const QUrl& url) const
QImage QQuickCanvasItem::toImage(const QRectF& rect) const
{
Q_D(const QQuickCanvasItem);
- if (d->contextInitialized) {
+ if (d->context) {
if (rect.isEmpty())
return d->context->toImage(canvasWindow());
else
@@ -1026,7 +1029,7 @@ void QQuickCanvasItem::delayedCreate()
{
Q_D(QQuickCanvasItem);
- if (!d->contextInitialized && !d->contextType.isNull())
+ if (!d->context && !d->contextType.isNull())
createContext(d->contextType);
requestPaint();
@@ -1055,7 +1058,6 @@ void QQuickCanvasItem::initializeContext(QQuickCanvasContext *context, const QVa
d->context = context;
d->context->init(this, args);
d->context->setV8Engine(QQmlEnginePrivate::getV8Engine(qmlEngine(this)));
- d->contextInitialized = true;
connect(d->context, SIGNAL(textureChanged()), SLOT(update()));
connect(d->context, SIGNAL(textureChanged()), SIGNAL(painted()));
emit contextChanged();
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 5011fd45f2..c9ee426565 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -210,9 +210,11 @@ QFont qt_font_from_string(const QString& fontString) {
font.setBold(true);
else if (token.endsWith(QStringLiteral("px"))) {
QString number = token;
- number.remove(QStringLiteral("px"));
- //font.setPointSizeF(number.trimmed().toFloat());
- font.setPixelSize(number.trimmed().toInt());
+ number.remove(QLatin1String("px"));
+ bool ok = false;
+ float pixelSize = number.trimmed().toFloat(&ok);
+ if (ok)
+ font.setPixelSize(int(pixelSize));
} else
font.setFamily(token);
}
@@ -426,50 +428,86 @@ DEFINE_MANAGED_VTABLE(QQuickContext2DStyle);
QImage qt_image_convolute_filter(const QImage& src, const QVector<qreal>& weights, int radius = 0)
{
- int sides = radius ? radius : qRound(qSqrt(weights.size()));
- int half = qFloor(sides/2);
+ // weights 3x3 => delta 1
+ int delta = radius ? radius : qFloor(qSqrt(weights.size()) / qreal(2));
+ int filterDim = 2 * delta + 1;
QImage dst = QImage(src.size(), src.format());
+
int w = src.width();
int h = src.height();
- for (int y = 0; y < dst.height(); ++y) {
- QRgb *dr = (QRgb*)dst.scanLine(y);
- for (int x = 0; x < dst.width(); ++x) {
- unsigned char* dRgb = ((unsigned char*)&dr[x]);
- unsigned char red=0, green=0, blue=0, alpha=0;
- int sy = y;
- int sx = x;
-
- for (int cy=0; cy<sides; cy++) {
- for (int cx=0; cx<sides; cx++) {
- int scy = sy + cy - half;
- int scx = sx + cx - half;
- if (scy >= 0 && scy < w && scx >= 0 && scx < h) {
- const QRgb *sr = (const QRgb*)(src.constScanLine(scy));
- const unsigned char* sRgb = ((const unsigned char*)&sr[scx]);
- qreal wt = radius ? weights[0] : weights[cy*sides+cx];
- red += sRgb[0] * wt;
- green += sRgb[1] * wt;
- blue += sRgb[2] * wt;
- alpha += sRgb[3] * wt;
- }
- }
- }
- dRgb[0] = red;
- dRgb[1] = green;
- dRgb[2] = blue;
- dRgb[3] = alpha;
- }
+
+ const QRgb *sr = (const QRgb *)(src.constBits());
+ int srcStride = src.bytesPerLine() / 4;
+
+ QRgb *dr = (QRgb*)dst.bits();
+ int dstStride = dst.bytesPerLine() / 4;
+
+ for (int y = 0; y < h; ++y) {
+ for (int x = 0; x < w; ++x) {
+ int red = 0;
+ int green = 0;
+ int blue = 0;
+ int alpha = 0;
+
+ qreal redF = 0;
+ qreal greenF = 0;
+ qreal blueF = 0;
+ qreal alphaF = 0;
+
+ int sy = y;
+ int sx = x;
+
+ for (int cy = 0; cy < filterDim; ++cy) {
+ int scy = sy + cy - delta;
+
+ if (scy < 0 || scy >= h)
+ continue;
+
+ const QRgb *sry = sr + scy * srcStride;
+
+ for (int cx = 0; cx < filterDim; ++cx) {
+ int scx = sx + cx - delta;
+
+ if (scx < 0 || scx >= w)
+ continue;
+
+ const QRgb col = sry[scx];
+
+ if (radius) {
+ red += qRed(col);
+ green += qGreen(col);
+ blue += qBlue(col);
+ alpha += qAlpha(col);
+ } else {
+ qreal wt = weights[cy * filterDim + cx];
+
+ redF += qRed(col) * wt;
+ greenF += qGreen(col) * wt;
+ blueF += qBlue(col) * wt;
+ alphaF += qAlpha(col) * wt;
+ }
+ }
+ }
+
+ if (radius)
+ dr[x] = qRgba(qRound(red * weights[0]), qRound(green * weights[0]), qRound(blue * weights[0]), qRound(alpha * weights[0]));
+ else
+ dr[x] = qRgba(qRound(redF), qRound(greenF), qRound(blueF), qRound(alphaF));
+ }
+
+ dr += dstStride;
}
+
return dst;
}
void qt_image_boxblur(QImage& image, int radius, bool quality)
{
int passes = quality? 3: 1;
- for (int i=0; i < passes; i++) {
- image = qt_image_convolute_filter(image, QVector<qreal>() << 1.0/(radius * radius * 1.0), radius);
- }
+ int filterSize = 2 * radius + 1;
+ for (int i = 0; i < passes; ++i)
+ image = qt_image_convolute_filter(image, QVector<qreal>() << 1.0 / (filterSize * filterSize), radius);
}
static QPainter::CompositionMode qt_composite_mode_from_string(const QString &compositeOperator)
@@ -644,7 +682,7 @@ static QV4::Value qt_create_image_data(qreal w, qreal h, QV8Engine* engine, cons
pixelData->image = QImage(w, h, QImage::Format_ARGB32);
pixelData->image.fill(0x00000000);
} else {
- Q_ASSERT(image.width() == w && image.height() == h);
+ Q_ASSERT(image.width() == int(w) && image.height() == int(h));
pixelData->image = image.format() == QImage::Format_ARGB32 ? image : image.convertToFormat(QImage::Format_ARGB32);
}
@@ -2525,7 +2563,11 @@ QV4::Value QQuickJSContext2DPrototype::method_drawImage(QV4::SimpleCallContext *
V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
} else {
- V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
+ QUrl url(ctx->arguments[0].toQString());
+ if (url.isValid())
+ pixmap = r->context->createPixmap(url);
+ else
+ V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
} else {
V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
@@ -2790,7 +2832,7 @@ QV4::Value QQuickJSContext2DPrototype::method_createImageData(QV4::SimpleCallCon
}
/*!
- \qmlmethod CanvasImageData QtQuick2::Canvas::getImageData(real sx, real sy, real sw, real sh)
+ \qmlmethod CanvasImageData QtQuick2::Context2D::getImageData(real sx, real sy, real sw, real sh)
Returns an CanvasImageData object containing the image data for the given rectangle of the canvas.
*/
QV4::Value QQuickJSContext2DPrototype::method_getImageData(QV4::SimpleCallContext *ctx)
@@ -3488,7 +3530,6 @@ QPainterPath QQuickContext2D::createTextGlyphs(qreal x, qreal y, const QString&
QPainterPath textPath;
textPath.addText(x - xoffset, y - yoffset+metrics.ascent(), state.font, text);
- textPath = state.matrix.map(textPath);
return textPath;
}
@@ -3662,7 +3703,7 @@ QImage QQuickContext2D::toImage(const QRectF& bounds)
if (m_texture->thread() == QThread::currentThread())
m_texture->grabImage(bounds);
else if (m_renderStrategy == QQuickCanvasItem::Cooperative) {
- qWarning() << "Pixel read back is not support in Cooperative mode, please try Theaded or Immediate mode";
+ qWarning() << "Pixel readback is not supported in Cooperative mode, please try Threaded or Immediate mode";
return QImage();
} else {
QMetaObject::invokeMethod(m_texture,
@@ -3775,7 +3816,6 @@ void QQuickContext2D::pushState()
void QQuickContext2D::reset()
{
QQuickContext2D::State newState;
- newState.matrix = QTransform();
m_path = QPainterPath();
@@ -3787,28 +3827,6 @@ void QQuickContext2D::reset()
newState.clipPath = defaultClipPath;
newState.clipPath.setFillRule(Qt::WindingFill);
- newState.strokeStyle = QColor("#000000");
- newState.fillStyle = QColor("#000000");
- newState.fillPatternRepeatX = false;
- newState.fillPatternRepeatY = false;
- newState.strokePatternRepeatX = false;
- newState.strokePatternRepeatY = false;
- newState.invertibleCTM = true;
- newState.fillRule = Qt::WindingFill;
- newState.globalAlpha = 1.0;
- newState.lineWidth = 1;
- newState.lineCap = Qt::FlatCap;
- newState.lineJoin = Qt::MiterJoin;
- newState.miterLimit = 10;
- newState.shadowOffsetX = 0;
- newState.shadowOffsetY = 0;
- newState.shadowBlur = 0;
- newState.shadowColor = qRgba(0, 0, 0, 0);
- newState.globalCompositeOperation = QPainter::CompositionMode_SourceOver;
- newState.font = QFont(QStringLiteral("sans-serif"), 10);
- newState.textAlign = QQuickContext2D::Start;
- newState.textBaseline = QQuickContext2D::Alphabetic;
-
m_stateStack.clear();
m_stateStack.push(newState);
popState();
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h
index 0fe8bc6db2..8164108bd3 100644
--- a/src/quick/items/context2d/qquickcontext2d_p.h
+++ b/src/quick/items/context2d/qquickcontext2d_p.h
@@ -131,10 +131,11 @@ public:
, shadowBlur(0)
, shadowColor(qRgba(0, 0, 0, 0))
, globalCompositeOperation(QPainter::CompositionMode_SourceOver)
- , font(QFont(QLatin1String("sans-serif"), 10))
+ , font(QFont(QLatin1String("sans-serif")))
, textAlign(QQuickContext2D::Start)
, textBaseline(QQuickContext2D::Alphabetic)
{
+ font.setPixelSize(10);
}
QTransform matrix;
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
index 7c5841810b..d433efcb69 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
@@ -54,86 +54,136 @@ QT_BEGIN_NAMESPACE
void qt_image_boxblur(QImage& image, int radius, bool quality);
-static QImage makeShadowImage(const QImage& image, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
-{
- QImage shadowImg(image.width() + blur + qAbs(offsetX),
- image.height() + blur + qAbs(offsetY),
- QImage::Format_ARGB32_Premultiplied);
- shadowImg.fill(0);
- QPainter tmpPainter(&shadowImg);
- tmpPainter.setCompositionMode(QPainter::CompositionMode_Source);
- qreal shadowX = offsetX > 0? offsetX : 0;
- qreal shadowY = offsetY > 0? offsetY : 0;
-
- tmpPainter.drawImage(shadowX, shadowY, image);
- tmpPainter.end();
-
- if (blur > 0)
- qt_image_boxblur(shadowImg, blur/2, true);
-
- // blacken the image with shadow color...
- tmpPainter.begin(&shadowImg);
- tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn);
- tmpPainter.fillRect(shadowImg.rect(), color);
- tmpPainter.end();
- return shadowImg;
-}
+namespace {
+ class ShadowImageMaker
+ {
+ public:
+ virtual ~ShadowImageMaker() {}
-static void fillRectShadow(QPainter* p, QRectF shadowRect, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
-{
- QRectF r = shadowRect;
- r.moveTo(0, 0);
+ void paintShapeAndShadow(QPainter *p, qreal offsetX, qreal offsetY, qreal blur, const QColor &color)
+ {
+ QRectF bounds = boundingRect().translated(offsetX, offsetY).adjusted(-2*blur, -2*blur, 2*blur, 2*blur);
+ QRect boundsAligned = bounds.toAlignedRect();
+
+ QImage shadowImage(boundsAligned.size(), QImage::Format_ARGB32_Premultiplied);
+ shadowImage.fill(0);
+
+ QPainter shadowPainter(&shadowImage);
+ shadowPainter.setRenderHints(p->renderHints());
+ shadowPainter.translate(offsetX - boundsAligned.left(), offsetY - boundsAligned.top());
+ paint(&shadowPainter);
+ shadowPainter.end();
+
+ if (blur > 0)
+ qt_image_boxblur(shadowImage, qMax(1, qRound(blur / 2)), true);
+
+ // blacken the image with shadow color...
+ shadowPainter.begin(&shadowImage);
+ shadowPainter.setCompositionMode(QPainter::CompositionMode_SourceIn);
+ shadowPainter.fillRect(shadowImage.rect(), color);
+ shadowPainter.end();
+
+ p->drawImage(boundsAligned.topLeft(), shadowImage);
+ paint(p);
+ }
- QImage shadowImage(r.size().width() + 1, r.size().height() + 1, QImage::Format_ARGB32_Premultiplied);
- QPainter tp;
- tp.begin(&shadowImage);
- tp.fillRect(r, p->brush());
- tp.end();
- shadowImage = makeShadowImage(shadowImage, offsetX, offsetY, blur, color);
+ virtual void paint(QPainter *p) const = 0;
+ virtual QRectF boundingRect() const = 0;
+ };
- qreal dx = shadowRect.left() + (offsetX < 0? offsetX:0);
- qreal dy = shadowRect.top() + (offsetY < 0? offsetY:0);
+ class FillRectShadow : public ShadowImageMaker
+ {
+ public:
+ FillRectShadow(const QRectF &rect, const QBrush &brush)
+ : m_rect(rect.normalized())
+ , m_brush(brush)
+ {
+ }
+
+ void paint(QPainter *p) const { p->fillRect(m_rect, m_brush); }
+ QRectF boundingRect() const { return m_rect; }
- p->drawImage(dx, dy, shadowImage);
- p->fillRect(shadowRect, p->brush());
+ private:
+ QRectF m_rect;
+ QBrush m_brush;
+ };
+
+ class FillPathShadow : public ShadowImageMaker
+ {
+ public:
+ FillPathShadow(const QPainterPath &path, const QBrush &brush)
+ : m_path(path)
+ , m_brush(brush)
+ {
+ }
+
+ void paint(QPainter *p) const { p->fillPath(m_path, m_brush); }
+ QRectF boundingRect() const { return m_path.boundingRect(); }
+
+ private:
+ QPainterPath m_path;
+ QBrush m_brush;
+ };
+
+ class StrokePathShadow : public ShadowImageMaker
+ {
+ public:
+ StrokePathShadow(const QPainterPath &path, const QPen &pen)
+ : m_path(path)
+ , m_pen(pen)
+ {
+ }
+
+ void paint(QPainter *p) const { p->strokePath(m_path, m_pen); }
+
+ QRectF boundingRect() const
+ {
+ qreal d = qMax(qreal(1), m_pen.widthF());
+ return m_path.boundingRect().adjusted(-d, -d, d, d);
+ }
+
+ private:
+ QPainterPath m_path;
+ QPen m_pen;
+ };
+
+ class DrawImageShadow : public ShadowImageMaker
+ {
+ public:
+ DrawImageShadow(const QImage &image, const QPointF &offset)
+ : m_image(image)
+ , m_offset(offset)
+ {
+ }
+
+ void paint(QPainter *p) const { p->drawImage(m_offset, m_image); }
+
+ QRectF boundingRect() const { return QRectF(m_image.rect()).translated(m_offset); }
+
+ private:
+ QImage m_image;
+ QPointF m_offset;
+ };
+}
+
+static void fillRectShadow(QPainter* p, QRectF shadowRect, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
+{
+ FillRectShadow shadowMaker(shadowRect, p->brush());
+ shadowMaker.paintShapeAndShadow(p, offsetX, offsetY, blur, color);
}
static void fillShadowPath(QPainter* p, const QPainterPath& path, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
{
- QRectF r = path.boundingRect();
- QImage img(r.size().width() + r.left() + 1,
- r.size().height() + r.top() + 1,
- QImage::Format_ARGB32_Premultiplied);
- img.fill(0);
- QPainter tp(&img);
- tp.fillPath(path.translated(0, 0), p->brush());
- tp.end();
-
- QImage shadowImage = makeShadowImage(img, offsetX, offsetY, blur, color);
- qreal dx = r.left() + (offsetX < 0? offsetX:0);
- qreal dy = r.top() + (offsetY < 0? offsetY:0);
-
- p->drawImage(dx, dy, shadowImage);
- p->fillPath(path, p->brush());
+ FillPathShadow shadowMaker(path, p->brush());
+ shadowMaker.paintShapeAndShadow(p, offsetX, offsetY, blur, color);
}
static void strokeShadowPath(QPainter* p, const QPainterPath& path, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
{
- QRectF r = path.boundingRect();
- QImage img(r.size().width() + r.left() + 1,
- r.size().height() + r.top() + 1,
- QImage::Format_ARGB32_Premultiplied);
- img.fill(0);
- QPainter tp(&img);
- tp.strokePath(path, p->pen());
- tp.end();
-
- QImage shadowImage = makeShadowImage(img, offsetX, offsetY, blur, color);
- qreal dx = r.left() + (offsetX < 0? offsetX:0);
- qreal dy = r.top() + (offsetY < 0? offsetY:0);
- p->drawImage(dx, dy, shadowImage);
- p->strokePath(path, p->pen());
+ StrokePathShadow shadowMaker(path, p->pen());
+ shadowMaker.paintShapeAndShadow(p, offsetX, offsetY, blur, color);
}
+
static inline void drawRepeatPattern(QPainter* p, const QImage& image, const QRectF& rect, const bool repeatX, const bool repeatY)
{
// Patterns must be painted so that the top left of the first image is anchored at
@@ -259,15 +309,16 @@ static void qt_drawImage(QPainter *p, QQuickContext2D::State& state, QImage imag
if (sw != dw || sh != dh)
image = image.scaled(dw, dh);
- if (shadow) {
- QImage shadow = makeShadowImage(image, state.shadowOffsetX, state.shadowOffsetY, state.shadowBlur, state.shadowColor);
- qreal shadow_dx = dx + (state.shadowOffsetX < 0? state.shadowOffsetY:0);
- qreal shadow_dy = dy + (state.shadowOffsetX < 0? state.shadowOffsetY:0);
- p->drawImage(shadow_dx, shadow_dy, shadow);
- }
//Strange OpenGL painting behavior here, without beginNativePainting/endNativePainting, only the first image is painted.
p->beginNativePainting();
- p->drawImage(dx, dy, image);
+
+ if (shadow) {
+ DrawImageShadow shadowMaker(image, QPointF(dx, dy));
+ shadowMaker.paintShapeAndShadow(p, state.shadowOffsetX, state.shadowOffsetY, state.shadowBlur, state.shadowColor);
+ } else {
+ p->drawImage(dx, dy, image);
+ }
+
p->endNativePainting();
}
@@ -295,12 +346,9 @@ void QQuickContext2DCommandBuffer::replay(QPainter* p, QQuickContext2D::State& s
case QQuickContext2D::ClearRect:
{
QPainter::CompositionMode cm = p->compositionMode();
- qreal alpha = p->opacity();
- p->setCompositionMode(QPainter::CompositionMode_Source);
- p->setOpacity(0);
- p->fillRect(takeRect(), QColor(qRgba(0, 0, 0, 0)));
+ p->setCompositionMode(QPainter::CompositionMode_Clear);
+ p->fillRect(takeRect(), Qt::white);
p->setCompositionMode(cm);
- p->setOpacity(alpha);
break;
}
case QQuickContext2D::FillRect:
diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp
index 729e32e564..84ab5bb8fb 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp
@@ -586,6 +586,7 @@ QQuickCanvasItem::RenderTarget QQuickContext2DImageTexture::renderTarget() const
void QQuickContext2DImageTexture::bind()
{
imageTexture()->bind();
+ updateBindOptions();
}
bool QQuickContext2DImageTexture::updateTexture()
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 0a0fac307c..2025db4fc8 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -156,6 +156,9 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
if (!parent->property("value").isNull()) {
connect(parent, SIGNAL(valueChanged()), this, SLOT(valueChanged()));
}
+ if (!parent->property("cursorPosition").isNull()) {
+ connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
+ }
}
QQuickAccessibleAttached::~QQuickAccessibleAttached()
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 2124356a70..131b379a07 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -142,6 +142,10 @@ public Q_SLOTS:
QAccessibleValueChangeEvent ev(parent(), parent()->property("value"));
QAccessible::updateAccessibility(&ev);
}
+ void cursorPositionChanged() {
+ QAccessibleTextCursorEvent ev(parent(), parent()->property("cursorPosition").toInt());
+ QAccessible::updateAccessibility(&ev);
+ }
Q_SIGNALS:
void roleChanged();
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 55b3e569ef..e828899204 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -114,13 +114,13 @@ public:
\ingroup qtquick-input
\brief For specifying drag and drop events for moved Items
- Using the Drag attached property any Item can made a source of drag and drop
+ Using the Drag attached property any Item can be made a source of drag and drop
events within a scene.
- When a drag is \l active on an item any change in that items position will
- generate a drag events that will be sent to any DropArea that intersects
- the with new position of the item. Other items which implement drag and
- drop event handlers can also receive these events.
+ When a drag is \l active on an item any change in that item's position will
+ generate a drag event that will be sent to any DropArea that intersects
+ with the new position of the item. Other items which implement drag and
+ drop event handlers can also receive these events.
The following snippet shows how an item can be dragged with a MouseArea.
However, dragging is not limited to mouse drags, anything that can move an item
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index f930835bee..659e606ef9 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -400,7 +400,7 @@ QStringList QQuickDropEvent::keys() const
*/
/*!
- \qmlproperty real QtQuick2::DragEvent::accepted
+ \qmlproperty bool QtQuick2::DragEvent::accepted
This property holds whether the drag event was accepted by a handler.
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 469ae9d0e4..6f1b152ad3 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -93,7 +93,7 @@ private:
QKeyEvent event;
};
-// used in QtLocation
+// used in Qt Location
class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject
{
Q_OBJECT
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index ff56bcaa0e..e6b39d5380 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -423,12 +423,16 @@ void QQuickFlickablePrivate::fixupX_callback(void *data)
void QQuickFlickablePrivate::fixupX()
{
Q_Q(QQuickFlickable);
+ if (!q->isComponentComplete())
+ return; //Do not fixup from initialization values
fixup(hData, q->minXExtent(), q->maxXExtent());
}
void QQuickFlickablePrivate::fixupY()
{
Q_Q(QQuickFlickable);
+ if (!q->isComponentComplete())
+ return; //Do not fixup from initialization values
fixup(vData, q->minYExtent(), q->maxYExtent());
}
@@ -913,6 +917,18 @@ void QQuickFlickable::setFlickableDirection(FlickableDirection direction)
}
}
+/*!
+ \qmlproperty bool QtQuick2::Flickable::pixelAligned
+
+ This property sets the alignment of \l contentX and \l contentY to
+ pixels (\c true) or subpixels (\c false).
+
+ Enable pixelAligned to optimize for still content or moving content with
+ high constrast edges, such as one-pixel-wide lines, text or vector graphics.
+ Disable pixelAligned when optimizing for animation quality.
+
+ The default is \c false.
+*/
bool QQuickFlickable::pixelAligned() const
{
Q_D(const QQuickFlickable);
@@ -2265,7 +2281,11 @@ bool QQuickFlickablePrivate::isViewMoving() const
within the timeout, both the press and release will be delivered.
Note that for nested Flickables with pressDelay set, the pressDelay of
- outer Flickables is overridden by the innermost Flickable.
+ outer Flickables is overridden by the innermost Flickable. If the drag
+ exceeds the platform drag threshold, the press event will be delivered
+ regardless of this property.
+
+ \sa QStyleHints
*/
int QQuickFlickable::pressDelay() const
{
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index 513a26e747..0186029fa0 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -101,7 +101,7 @@ public:
AxisData(QQuickFlickablePrivate *fp, void (QQuickFlickablePrivate::*func)(qreal))
: move(fp, func)
, transitionToBounds(0)
- , viewSize(-1), startMargin(0), endMargin(0)
+ , viewSize(-1), lastPos(0), startMargin(0), endMargin(0)
, origin(0)
, transitionTo(0)
, continuousFlickVelocity(0), velocityTime(), vTime(0)
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index e40d21b498..bc71a1c064 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -2564,6 +2564,22 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
\b Note: methods should only be called after the Component has completed.
*/
+
+/*!
+ \qmlmethod QtQuick2::GridView::forceLayout()
+
+ Responding to changes in the model is usually batched to happen only once
+ per frame. This means that inside script blocks it is possible for the
+ underlying model to have changed, but the GridView has not caught up yet.
+
+ This method forces the GridView to immediately respond to any outstanding
+ changes in the model.
+
+ \since QtQuick 2.1
+
+ \b Note: methods should only be called after the Component has completed.
+*/
+
QQuickGridViewAttached *QQuickGridView::qmlAttachedProperties(QObject *obj)
{
return new QQuickGridViewAttached(obj);
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index 9403b7967e..6fe4b39974 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -233,6 +233,8 @@ void QQuickImagePrivate::setImage(const QImage &image)
Image {
width: 120; height: 120
fillMode: Image.Tile
+ horizontalAlignment: Image.AlignLeft
+ verticalAlignment: Image.AlignTop
source: "qtlogo.png"
}
\endqml
@@ -244,6 +246,7 @@ void QQuickImagePrivate::setImage(const QImage &image)
Image {
width: 120; height: 120
fillMode: Image.TileVertically
+ verticalAlignment: Image.AlignTop
source: "qtlogo.png"
}
\endqml
@@ -255,6 +258,7 @@ void QQuickImagePrivate::setImage(const QImage &image)
Image {
width: 120; height: 120
fillMode: Image.TileHorizontally
+ verticalAlignment: Image.AlignLeft
source: "qtlogo.png"
}
\endqml
@@ -460,7 +464,7 @@ qreal QQuickImage::paintedHeight() const
\qmlproperty enumeration QtQuick2::Image::horizontalAlignment
\qmlproperty enumeration QtQuick2::Image::verticalAlignment
- Sets the horizontal and vertical alignment of the image. By default, the image is top-left aligned.
+ Sets the horizontal and vertical alignment of the image. By default, the image is center aligned.
The valid values for \c horizontalAlignment are \c Image.AlignLeft, \c Image.AlignRight and \c Image.AlignHCenter.
The valid values for \c verticalAlignment are \c Image.AlignTop, \c Image.AlignBottom
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 4ce9b15921..d0417c80f3 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -58,6 +58,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qnumeric.h>
+#include <QtGui/qpa/qplatformtheme.h>
#include <private/qqmlglobal_p.h>
#include <private/qqmlengine_p.h>
@@ -1365,7 +1366,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj)
\brief Property used to mirror layout behavior
The LayoutMirroring attached property is used to horizontally mirror \l {anchor-layout}{Item anchors},
- \l{Item Layouts}{positioner} types (such as \l Row and \l Grid)
+ \l{Item Positioners}{positioner} types (such as \l Row and \l Grid)
and views (such as \l GridView and horizontal \l ListView). Mirroring is a visual change: left
anchors become right anchors, and positioner types like \l Grid and \l Row reverse the
horizontal layout of child items.
@@ -1405,7 +1406,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj)
This property holds whether the item's layout is mirrored horizontally. Setting this to true
horizontally reverses \l {anchor-layout}{anchor} settings such that left anchors become right,
- and right anchors become left. For \l{Item Layouts}{positioner} types
+ and right anchors become left. For \l{Item Positioners}{positioner} types
(such as \l Row and \l Grid) and view types (such as \l {GridView}{GridView} and \l {ListView}{ListView})
this also mirrors the horizontal layout direction of the item.
@@ -1573,7 +1574,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
/*!
\class QQuickItem
- \brief The QQuickItem class provides the most basic of all visual items in QtQuick.
+ \brief The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
\inmodule QtQuick
All visual items in Qt Quick inherit from QQuickItem. Although a QQuickItem
@@ -2037,6 +2038,44 @@ QQuickItem::~QQuickItem()
/*!
\internal
+*/
+bool QQuickItemPrivate::qt_tab_all_widgets()
+{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool();
+ return true;
+}
+
+/*!
+ \internal
+*/
+bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item)
+{
+ bool result = true;
+
+ if (!item->window())
+ return false;
+
+ if (item == item->window()->contentItem())
+ return true;
+
+#ifndef QT_NO_ACCESSIBILITY
+ result = false;
+ if (QObject *acc = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false)) {
+ int role = acc->property("role").toInt();
+ if (role == QAccessible::EditableText
+ || role == QAccessible::Table
+ || role == QAccessible::List
+ || role == QAccessible::SpinBox)
+ result = true;
+ }
+#endif
+
+ return result;
+}
+
+/*!
+ \internal
\brief QQuickItemPrivate::focusNextPrev focuses the next/prev item in the tab-focus-chain
\param item The item that currently has the focus
\param forward The direction
@@ -2047,8 +2086,21 @@ QQuickItem::~QQuickItem()
*/
bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward)
{
+ QQuickItem *next = QQuickItemPrivate::nextPrevItemInTabFocusChain(item, forward);
+
+ if (next == item)
+ return false;
+
+ next->forceActiveFocus(forward ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+
+ return true;
+}
+
+QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, bool forward)
+{
Q_ASSERT(item);
- Q_ASSERT(item->activeFocusOnTab());
+
+ bool all = QQuickItemPrivate::qt_tab_all_widgets();
QQuickItem *from = 0;
if (forward) {
@@ -2060,6 +2112,10 @@ bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward)
from = item->parentItem();
}
bool skip = false;
+ const QQuickItem * const contentItem = item->window()->contentItem();
+ const QQuickItem * const originalItem = item;
+ QQuickItem * startItem = item;
+ QQuickItem * firstFromItem = from;
QQuickItem *current = item;
do {
skip = false;
@@ -2110,16 +2166,29 @@ bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward)
skip = true;
}
}
-
from = last;
- } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible());
-
- if (current == item)
- return false;
-
- current->forceActiveFocus(forward ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+ if (current == startItem && from == firstFromItem) {
+ // wrapped around, avoid endless loops
+ if (originalItem == contentItem) {
+#ifdef FOCUS_DEBUG
+ qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return contentItem";
+#endif
+ return item->window()->contentItem();
+ } else {
+#ifdef FOCUS_DEBUG
+ qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return " << startItem;
+#endif
+ return startItem;
+ }
+ }
+ if (!firstFromItem) { //start from root
+ startItem = current;
+ firstFromItem = from;
+ }
+ } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible()
+ || !(all || QQuickItemPrivate::canAcceptTabFocus(current)));
- return true;
+ return current;
}
/*!
@@ -2255,7 +2324,8 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
}
}
- d->resolveLayoutMirror();
+ if (d->parentItem)
+ d->resolveLayoutMirror();
d->itemChange(ItemParentHasChanged, d->parentItem);
@@ -2341,13 +2411,16 @@ void QQuickItem::stackAfter(const QQuickItem *sibling)
QQuickItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged();
}
+/*! \fn void QQuickItem::windowChanged(QQuickWindow *window)
+ This signal is emitted when the item's \a window changes.
+*/
+
/*!
Returns the window in which this item is rendered.
- The item does not have a window until it has been assigned into a scene. To
- get notification about this, reimplement the itemChange() function and
- listen for the ItemSceneChange change. The itemChange() function is called
- both when the item is entered into a scene and when it is removed from a scene.
+ The item does not have a window until it has been assigned into a scene. The
+ \l windowChanged signal provides a notification both when the item is entered
+ into a scene and when it is removed from a scene.
*/
QQuickWindow *QQuickItem::window() const
{
@@ -2498,8 +2571,7 @@ void QQuickItemPrivate::derefWindow()
if (c->cursorItem == q)
c->cursorItem = 0;
#endif
- if ( hoverEnabled )
- c->hoverItems.removeAll(q);
+ c->hoverItems.removeAll(q);
if (itemNodeInstance)
c->cleanup(itemNodeInstance);
if (!parentItem)
@@ -2688,9 +2760,26 @@ void QQuickItemPrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o)
} else {
if (o->inherits("QGraphicsItem"))
qWarning("Cannot add a QtQuick 1.0 item (%s) into a QtQuick 2.0 scene!", o->metaObject()->className());
+ else {
+ QQuickWindow *thisWindow = qmlobject_cast<QQuickWindow *>(o);
+ QQuickItem *item = that;
+ QQuickWindow *itemWindow = that->window();
+ while (!itemWindow && item && item->parentItem()) {
+ item = item->parentItem();
+ itemWindow = item->window();
+ }
+
+ if (thisWindow) {
+ if (itemWindow)
+ thisWindow->setTransientParent(itemWindow);
+ else
+ QObject::connect(item, SIGNAL(windowChanged(QQuickWindow*)),
+ thisWindow, SLOT(setTransientParent_helper(QQuickWindow*)));
+ }
+ o->setParent(that);
+ }
- // XXX todo - do we really want this behavior?
- o->setParent(that);
+ resources_append(prop, o);
}
}
@@ -2768,30 +2857,38 @@ void QQuickItemPrivate::data_clear(QQmlListProperty<QObject> *property)
QObject *QQuickItemPrivate::resources_at(QQmlListProperty<QObject> *prop, int index)
{
- const QObjectList children = prop->object->children();
- if (index < children.count())
- return children.at(index);
- else
- return 0;
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
+ return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.value(index) : 0;
}
-void QQuickItemPrivate::resources_append(QQmlListProperty<QObject> *prop, QObject *o)
+void QQuickItemPrivate::resources_append(QQmlListProperty<QObject> *prop, QObject *object)
{
- // XXX todo - do we really want this behavior?
- o->setParent(prop->object);
+ QQuickItem *quickItem = static_cast<QQuickItem *>(prop->object);
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(quickItem);
+ if (!quickItemPrivate->extra.value().resourcesList.contains(object)) {
+ quickItemPrivate->extra.value().resourcesList.append(object);
+ qmlobject_connect(object, QObject, SIGNAL(destroyed(QObject*)),
+ quickItem, QQuickItem, SLOT(_q_resourceObjectDeleted(QObject*)));
+ }
}
int QQuickItemPrivate::resources_count(QQmlListProperty<QObject> *prop)
{
- return prop->object->children().count();
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
+ return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.count() : 0;
}
void QQuickItemPrivate::resources_clear(QQmlListProperty<QObject> *prop)
{
- // XXX todo - do we really want this behavior?
- const QObjectList children = prop->object->children();
- for (int index = 0; index < children.count(); index++)
- children.at(index)->setParent(0);
+ QQuickItem *quickItem = static_cast<QQuickItem *>(prop->object);
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(quickItem);
+ if (quickItemPrivate->extra.isAllocated()) {//If extra is not allocated resources is empty.
+ foreach (QObject *object, quickItemPrivate->extra->resourcesList) {
+ qmlobject_disconnect(object, QObject, SIGNAL(destroyed(QObject*)),
+ quickItem, QQuickItem, SLOT(_q_resourceObjectDeleted(QObject*)));
+ }
+ quickItemPrivate->extra->resourcesList.clear();
+ }
}
QQuickItem *QQuickItemPrivate::children_at(QQmlListProperty<QQuickItem> *prop, int index)
@@ -2938,6 +3035,12 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
p->dirty(QQuickItemPrivate::Transform);
}
+void QQuickItemPrivate::_q_resourceObjectDeleted(QObject *object)
+{
+ if (extra.isAllocated() && extra->resourcesList.contains(object))
+ extra->resourcesList.removeAll(object);
+}
+
/*!
\qmlproperty AnchorLine QtQuick2::Item::anchors.top
\qmlproperty AnchorLine QtQuick2::Item::anchors.bottom
@@ -3917,6 +4020,28 @@ void QQuickItem::forceActiveFocus(Qt::FocusReason reason)
}
/*!
+ \qmlmethod QtQuick2::Item::nextItemInFocusChain(bool forward)
+
+ \since QtQuick 2.1
+
+ Returns the item in the focus chain which is next to this item.
+ If \a forward is \c true, or not supplied, it is the next item in
+ the forwards direction. If \a forward is \c false, it is the next
+ item in the backwards direction.
+*/
+/*!
+ Returns the item in the focus chain which is next to this item.
+ If \a forward is \c true, or not supplied, it is the next item in
+ the forwards direction. If \a forward is \c false, it is the next
+ item in the backwards direction.
+*/
+
+QQuickItem *QQuickItem::nextItemInFocusChain(bool forward)
+{
+ return QQuickItemPrivate::nextPrevItemInTabFocusChain(this, forward);
+}
+
+/*!
\qmlmethod QtQuick2::Item::childAt(real x, real y)
Returns the first visible child item found at point (\a x, \a y) within
@@ -4280,7 +4405,8 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e)
return;
//only care about KeyPress now
- if (q->activeFocusOnTab() && e->type() == QEvent::KeyPress) {
+ if ((q == q->window()->contentItem() || q->activeFocusOnTab())
+ && e->type() == QEvent::KeyPress) {
bool res = false;
if (!(e->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier?
if (e->key() == Qt::Key_Backtab
@@ -4417,11 +4543,18 @@ void QQuickItemPrivate::deliverDragEvent(QEvent *e)
\a value contains extra information relating to the change, when
applicable.
+
+ If you re-implement this method in a subclass, be sure to call
+ \code
+ QQuickItem::itemChange(change, value);
+ \endcode
+ typically at the end of your implementation, to ensure the
+ \l windowChanged signal will be emitted.
*/
void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value)
{
- Q_UNUSED(change);
- Q_UNUSED(value);
+ if (change == ItemSceneChange)
+ emit windowChanged(value.window);
}
#ifndef QT_NO_IM
@@ -5489,7 +5622,7 @@ void QQuickItem::setActiveFocusOnTab(bool activeFocusOnTab)
return;
if (window()) {
- if ((this == window()->activeFocusItem()) && !activeFocusOnTab) {
+ if ((this == window()->activeFocusItem()) && this != window()->contentItem() && !activeFocusOnTab) {
qWarning("QQuickItem: Cannot set activeFocusOnTab to false once item is the active focus item.");
return;
}
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index 4c99a6a9c5..6ad121fffa 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -324,6 +324,7 @@ public:
Q_INVOKABLE void mapToItem(QQmlV4Function*) const;
Q_INVOKABLE void forceActiveFocus();
Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason);
+ Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true);
Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const;
#ifndef QT_NO_IM
@@ -355,6 +356,7 @@ Q_SIGNALS:
void smoothChanged(bool);
void antialiasingChanged(bool);
void clipChanged(bool);
+ Q_REVISION(1) void windowChanged(QQuickWindow* window);
// XXX todo
void childrenChanged();
@@ -430,6 +432,8 @@ protected:
QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent = 0);
private:
+ Q_PRIVATE_SLOT(d_func(), void _q_resourceObjectDeleted(QObject *))
+
friend class QQuickWindow;
friend class QQuickWindowPrivate;
friend class QSGRenderer;
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 4bd9d82c20..0ffc092a83 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -128,7 +128,7 @@ void QQuickContents::calcGeometry(QQuickItem *changed)
class QQuickTransformPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QQuickTransform);
+ Q_DECLARE_PUBLIC(QQuickTransform)
public:
static QQuickTransformPrivate* get(QQuickTransform *transform) { return transform->d_func(); }
@@ -293,6 +293,8 @@ public:
static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, int);
static void transform_clear(QQmlListProperty<QQuickTransform> *list);
+ void _q_resourceObjectDeleted(QObject *);
+
enum ChangeType {
Geometry = 0x01,
SiblingOrder = 0x02,
@@ -363,6 +365,8 @@ public:
Qt::MouseButtons acceptedMouseButtons;
QQuickItem::TransformOrigin origin:5;
+
+ QObjectList resourcesList;
};
QLazilyAllocated<ExtraData> extra;
@@ -485,6 +489,10 @@ public:
void itemToParentTransform(QTransform &) const;
static bool focusNextPrev(QQuickItem *item, bool forward);
+ static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item, bool forward);
+
+ static bool qt_tab_all_widgets(); //todo: move to QGuiApplication?
+ static bool canAcceptTabFocus(QQuickItem *item);
qreal x;
qreal y;
@@ -886,7 +894,7 @@ QSGNode *QQuickItemPrivate::childContainerNode()
return groupNode;
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes)
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index 741583a95d..6f1edc718a 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -167,6 +167,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickKeyEvent>();
qmlRegisterType<QQuickMouseEvent>();
qmlRegisterType<QQuickWheelEvent>();
+ qmlRegisterType<QQuickCloseEvent>();
qmlRegisterType<QQuickTransform>();
qmlRegisterType<QQuickPathElement>();
qmlRegisterType<QQuickCurve>();
@@ -230,7 +231,13 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickItem, 1>(uri, 2, 1,"Item");
qmlRegisterType<QQuickGrid, 1>(uri, 2, 1, "Grid");
+ qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class"));
+ qmlRegisterType<QQuickListView, 1>(uri, 2, 1, "ListView");
+ qmlRegisterType<QQuickGridView, 1>(uri, 2, 1, "GridView");
qmlRegisterType<QQuickTextEdit, 1>(uri, 2, 1, "TextEdit");
+
+ qmlRegisterType<QQuickText, 2>(uri, 2, 2, "Text");
+ qmlRegisterType<QQuickTextEdit, 2>(uri, 2, 2, "TextEdit");
}
void QQuickItemsModule::defineModule()
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 72f892178f..a6dabee7ba 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -249,7 +249,6 @@ QQuickItemView::~QQuickItemView()
QQuickItem *QQuickItemView::currentItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->currentItem ? d->currentItem->item : 0;
}
@@ -379,14 +378,12 @@ int QQuickItemView::count() const
Q_D(const QQuickItemView);
if (!d->model)
return 0;
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->model->count();
}
int QQuickItemView::currentIndex() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->currentIndex;
}
@@ -496,7 +493,6 @@ QQmlComponent *QQuickItemView::header() const
QQuickItem *QQuickItemView::headerItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->header ? d->header->item : 0;
}
@@ -532,7 +528,6 @@ QQmlComponent *QQuickItemView::footer() const
QQuickItem *QQuickItemView::footerItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->footer ? d->footer->item : 0;
}
@@ -559,7 +554,6 @@ void QQuickItemView::setFooter(QQmlComponent *footerComponent)
QQmlComponent *QQuickItemView::highlight() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->highlightComponent;
}
@@ -579,7 +573,6 @@ void QQuickItemView::setHighlight(QQmlComponent *highlightComponent)
QQuickItem *QQuickItemView::highlightItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->highlight ? d->highlight->item : 0;
}
@@ -965,6 +958,12 @@ QQuickItem *QQuickItemView::itemAt(qreal x, qreal y) const
return 0;
}
+void QQuickItemView::forceLayout()
+{
+ Q_D(QQuickItemView);
+ d->applyPendingChanges();
+}
+
void QQuickItemViewPrivate::applyPendingChanges()
{
Q_Q(QQuickItemView);
@@ -2205,7 +2204,7 @@ FxViewItem *QQuickItemViewPrivate::createItem(int modelIndex, bool asynchronous)
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << q->tr("Delegate must be of Item type");
+ qmlInfo(delegate ? delegate : q) << QQuickItemView::tr("Delegate must be of Item type");
}
}
inRequest = false;
@@ -2260,8 +2259,10 @@ void QQuickItemView::destroyingItem(QObject *object)
{
Q_D(QQuickItemView);
QQuickItem* item = qmlobject_cast<QQuickItem*>(object);
- item->setParentItem(0);
- d->unrequestedItems.remove(item);
+ if (item) {
+ item->setParentItem(0);
+ d->unrequestedItems.remove(item);
+ }
}
bool QQuickItemViewPrivate::releaseItem(FxViewItem *item)
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index b0f910680a..d7812bcdad 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -202,6 +202,7 @@ public:
Q_INVOKABLE QQuickItem *itemAt(qreal x, qreal y) const;
Q_INVOKABLE void positionViewAtBeginning();
Q_INVOKABLE void positionViewAtEnd();
+ Q_REVISION(1) Q_INVOKABLE void forceLayout();
virtual void setContentX(qreal pos);
virtual void setContentY(qreal pos);
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 53dc715469..4d42c9ece1 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -1659,7 +1659,7 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
A ListView displays data from models created from built-in QML types like ListModel
and XmlListModel, or custom model classes defined in C++ that inherit from
- QAbstractListModel.
+ QAbstractItemModel or QAbstractListModel.
A ListView has a \l model, which defines the data to be displayed, and
a \l delegate, which defines how the data should be displayed. Items in a
@@ -2185,7 +2185,7 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
each section.
- \snippet quick/views/listview/sections.qml 0
+ \snippet views/listview/sections.qml 0
\image qml-listview-sections-example.png
@@ -3108,6 +3108,21 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
\b Note: methods should only be called after the Component has completed.
*/
+/*!
+ \qmlmethod QtQuick2::ListView::forceLayout()
+
+ Responding to changes in the model is usually batched to happen only once
+ per frame. This means that inside script blocks it is possible for the
+ underlying model to have changed, but the ListView has not caught up yet.
+
+ This method forces the ListView to immediately respond to any outstanding
+ changes in the model.
+
+ \since QtQuick 2.1
+
+ \b Note: methods should only be called after the Component has completed.
+*/
+
QQuickListViewAttached *QQuickListView::qmlAttachedProperties(QObject *obj)
{
return new QQuickListViewAttached(obj);
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index af766ac294..8f4dc0bd17 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -264,7 +264,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
\c event.accepted to \c true so that the event is not propagated to the
parent \l Rectangle.
- Since QtQuick 2.0 Loader can also load non-visual components.
+ Since \c {QtQuick 2.0}, Loader can also load non-visual components.
\section2 Using a Loader within a view delegate
@@ -376,7 +376,7 @@ void QQuickLoader::setActive(bool newVal)
\qmlproperty url QtQuick2::Loader::source
This property holds the URL of the QML component to instantiate.
- Since QtQuick 2.0 Loader is able to load any type of object; it
+ Since \c {QtQuick 2.0}, Loader is able to load any type of object; it
is not restricted to Item types.
To unload the currently loaded object, set this property to an empty string,
@@ -451,7 +451,7 @@ void QQuickLoader::loadFromSource()
To unload the currently loaded object, set this property to an empty string
or \c undefined.
- Since QtQuick 2.0 Loader is able to load any type of object; it
+ Since \c {QtQuick 2.0}, Loader is able to load any type of object; it
is not restricted to Item types.
\sa source, progress
@@ -903,7 +903,7 @@ void QQuickLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
\qmlproperty object QtQuick2::Loader::item
This property holds the top-level object that is currently loaded.
- Since QtQuick 2.0 Loader can load any object type.
+ Since \c {QtQuick 2.0}, Loader can load any object type.
*/
QObject *QQuickLoader::item() const
{
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index ad0a265035..a8786585da 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -773,11 +773,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
// ### we should skip this if these signals aren't used
// ### can GV handle this for us?
- const bool isInside = contains(d->lastPos);
- if (d->hovered && !isInside)
- setHovered(false);
- else if (!d->hovered && isInside)
- setHovered(true);
+ setHovered(contains(d->lastPos));
#ifndef QT_NO_DRAGANDDROP
if (d->drag && d->drag->target()) {
@@ -958,7 +954,8 @@ void QQuickMouseArea::ungrabMouse()
emit canceled();
emit pressedChanged();
emit pressedButtonsChanged();
- if (d->hovered) {
+
+ if (d->hovered && !isUnderMouse()) {
d->hovered = false;
emit hoveredChanged();
}
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index ad15167b10..fa32f32b65 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -123,7 +123,7 @@ private:
class QQuickMouseAreaPrivate;
class QQuickWheelEvent;
-// used in QtLocation
+// used in Qt Location
class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem
{
Q_OBJECT
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 384c1c7ac8..d6b00cee14 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -47,6 +47,7 @@
#include <QMouseEvent>
#include <math.h>
#include <QDebug>
+#include <qpa/qplatformnativeinterface.h>
QT_BEGIN_NAMESPACE
@@ -322,6 +323,7 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)
: QQuickItem(parent),
+ _currentWindow(0),
_minimumTouchPoints(0),
_maximumTouchPoints(INT_MAX),
_stealMouse(false)
@@ -331,6 +333,9 @@ QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)
if (qmlVisualTouchDebugging()) {
setFlag(QQuickItem::ItemHasContents);
}
+#ifdef Q_OS_MAC
+ connect(this, &QQuickItem::windowChanged, this, &QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow);
+#endif
}
QQuickMultiPointTouchArea::~QQuickMultiPointTouchArea()
@@ -542,6 +547,29 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p)
_pressedTouchPoints.append(dtp);
}
+void QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow(QWindow *window)
+{
+#ifdef Q_OS_MAC
+ // Resolve function for enabling touch events from the (cocoa) platform plugin.
+ typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);
+ RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(
+ QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));
+ if (!registerTouchWindow)
+ return; // Not necessarily an error, Qt migh be using a different platform plugin.
+
+ // Disable touch on the old window, enable on the new window.
+ if (_currentWindow)
+ registerTouchWindow(_currentWindow, false);
+ if (window)
+ registerTouchWindow(window, true);
+ // Save the current window, setTouchEventsEnabledForWindow will be called
+ // with a null window on disable.
+ _currentWindow = window;
+#else // Q_OS_MAC
+ Q_UNUSED(window)
+#endif
+}
+
void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype)
{
int id = _touchPrototypes.count();
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h
index e2ae5ed24e..afe7d4b77b 100644
--- a/src/quick/items/qquickmultipointtoucharea_p.h
+++ b/src/quick/items/qquickmultipointtoucharea_p.h
@@ -251,6 +251,9 @@ protected:
void grabGesture();
virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+protected slots:
+ void setTouchEventsEnabledForWindow(QWindow *window);
+
private:
void ungrab();
QMap<int,QQuickTouchPoint*> _touchPrototypes; //TouchPoints defined in QML
@@ -258,6 +261,7 @@ private:
QList<QObject*> _releasedTouchPoints;
QList<QObject*> _pressedTouchPoints;
QList<QObject*> _movedTouchPoints;
+ QWindow *_currentWindow;
int _minimumTouchPoints;
int _maximumTouchPoints;
bool _stealMouse;
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index e9aa6985fc..7798641fcd 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -159,7 +159,7 @@ QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async)
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << q->tr("Delegate must be of Item type");
+ qmlInfo(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type");
}
}
} else {
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 0e47b61319..434eaa8723 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -45,6 +45,7 @@
#include <QtGui/qevent.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qstylehints.h>
+#include <qpa/qplatformnativeinterface.h>
#include <float.h>
#include <math.h>
@@ -246,11 +247,15 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
QQuickPinchArea::QQuickPinchArea(QQuickItem *parent)
: QQuickItem(*(new QQuickPinchAreaPrivate), parent)
+ , _currentWindow(0)
{
Q_D(QQuickPinchArea);
d->init();
setAcceptedMouseButtons(Qt::LeftButton);
setFiltersChildMouseEvents(true);
+#ifdef Q_OS_MAC
+ connect(this, &QQuickItem::windowChanged, this, &QQuickPinchArea::setTouchEventsEnabledForWindow);
+#endif
}
QQuickPinchArea::~QQuickPinchArea()
@@ -539,6 +544,29 @@ QQuickPinch *QQuickPinchArea::pinch()
return d->pinch;
}
+void QQuickPinchArea::setTouchEventsEnabledForWindow(QWindow *window)
+{
+#ifdef Q_OS_MAC
+ // Resolve function for enabling touch events from the (cocoa) platform plugin.
+ typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);
+ RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(
+ QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));
+ if (!registerTouchWindow)
+ return; // Not necessarily an error, Qt migh be using a different platform plugin.
+
+ // Disable touch on the old window, enable on the new window.
+ if (_currentWindow)
+ registerTouchWindow(_currentWindow, false);
+ if (window)
+ registerTouchWindow(window, true);
+ // Save the current window, setTouchEventsEnabledForWindow will be called
+ // with a null window on disable.
+ _currentWindow = window;
+#else // Q_OS_MAC
+ Q_UNUSED(window)
+#endif
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h
index 4fc77d7f9c..60c2dc742e 100644
--- a/src/quick/items/qquickpincharea_p.h
+++ b/src/quick/items/qquickpincharea_p.h
@@ -283,12 +283,16 @@ protected:
const QRectF &oldGeometry);
virtual void itemChange(ItemChange change, const ItemChangeData& value);
+private slots:
+ void setTouchEventsEnabledForWindow(QWindow *window);
+
private:
void updatePinch();
void handlePress();
void handleRelease();
private:
+ QWindow *_currentWindow;
Q_DISABLE_COPY(QQuickPinchArea)
Q_DECLARE_PRIVATE(QQuickPinchArea)
};
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index 4a74c0bfba..b07a38cdaf 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -452,7 +452,6 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp
QQuickPositionerAttached *prevLastProperty = 0;
QQuickPositionerAttached *lastProperty = 0;
- int visibleItemIndex = 0;
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
if (!child.item)
@@ -468,28 +467,47 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp
property = static_cast<QQuickPositionerAttached *>(qmlAttachedPropertiesObject<QQuickBasePositioner>(child.item, false));
}
- if (child.isVisible) {
- if (property) {
- property->setIndex(visibleItemIndex);
- property->setIsFirstItem(visibleItemIndex == 0);
+ if (property) {
+ property->setIndex(ii);
+ property->setIsFirstItem(ii == 0);
- if (property->isLastItem())
+ if (property->isLastItem()) {
+ if (prevLastProperty)
+ prevLastProperty->setIsLastItem(false); // there can be only one last property
prevLastProperty = property;
}
-
- lastProperty = property;
- ++visibleItemIndex;
- } else if (property) {
- property->setIndex(-1);
- property->setIsFirstItem(false);
- property->setIsLastItem(false);
}
+
+ lastProperty = property;
}
if (prevLastProperty && prevLastProperty != lastProperty)
prevLastProperty->setIsLastItem(false);
if (lastProperty)
lastProperty->setIsLastItem(true);
+
+ // clear attached properties for unpositioned items
+ for (int ii = 0; ii < unpositionedItems.count(); ++ii) {
+ const PositionedItem &child = unpositionedItems.at(ii);
+ if (!child.item)
+ continue;
+
+ QQuickPositionerAttached *property = 0;
+
+ if (specificProperty) {
+ if (specificPropertyOwner == child.item) {
+ property = specificProperty;
+ }
+ } else {
+ property = static_cast<QQuickPositionerAttached *>(qmlAttachedPropertiesObject<QQuickBasePositioner>(child.item, false));
+ }
+
+ if (property) {
+ property->setIndex(-1);
+ property->setIsFirstItem(false);
+ property->setIsLastItem(false);
+ }
+ }
}
/*!
@@ -608,7 +626,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
more information about its position within the Column.
For more information on using Column and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
\section1 Using Transitions
@@ -626,7 +644,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
\image verticalpositioner_transition.gif
- \sa Row, Grid, Flow, Positioner, {qml/positioners}{Positioners example}
+ \sa Row, Grid, Flow, Positioner, ColumnLayout, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Column::populate
@@ -639,7 +657,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Column::add
@@ -661,7 +679,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Column::move
@@ -682,11 +700,11 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{Qt Quick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty real QtQuick2::Column::spacing
@@ -777,10 +795,10 @@ void QQuickColumn::reportConflictingAnchors()
more information about its position within the Row.
For more information on using Row and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
- \sa Column, Grid, Flow, Positioner, {qml/positioners}{Positioners example}
+ \sa Column, Grid, Flow, Positioner, RowLayout, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Row::populate
@@ -793,7 +811,7 @@ void QQuickColumn::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Row::add
@@ -815,7 +833,7 @@ void QQuickColumn::reportConflictingAnchors()
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Row::move
@@ -836,11 +854,11 @@ void QQuickColumn::reportConflictingAnchors()
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty real QtQuick2::Row::spacing
@@ -869,7 +887,7 @@ QQuickRow::QQuickRow(QQuickItem *parent)
the right anchor remains to the right of the row.
\endlist
- \sa Grid::layoutDirection, Flow::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example}
+ \sa Grid::layoutDirection, Flow::layoutDirection, {Qt Quick Examples - Right to Left}
*/
Qt::LayoutDirection QQuickRow::layoutDirection() const
@@ -1010,10 +1028,10 @@ void QQuickRow::reportConflictingAnchors()
or anchor itself with any of the \l {Item::anchors}{anchor} properties.
For more information on using Grid and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
- \sa Flow, Row, Column, Positioner, {qml/positioners}{Positioners example}
+ \sa Flow, Row, Column, Positioner, GridLayout, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Grid::populate
@@ -1026,7 +1044,7 @@ void QQuickRow::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Grid::add
@@ -1048,7 +1066,7 @@ void QQuickRow::reportConflictingAnchors()
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Grid::move
@@ -1069,11 +1087,11 @@ void QQuickRow::reportConflictingAnchors()
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty qreal QtQuick2::Grid::spacing
@@ -1230,7 +1248,7 @@ void QQuickGrid::setColumnSpacing(const qreal columnSpacing)
\l Grid::flow property.
\endlist
- \sa Flow::layoutDirection, Row::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example}
+ \sa Flow::layoutDirection, Row::layoutDirection, {Qt Quick Examples - Right to Left}
*/
Qt::LayoutDirection QQuickGrid::layoutDirection() const
{
@@ -1552,9 +1570,9 @@ void QQuickGrid::reportConflictingAnchors()
or anchor itself with any of the \l {Item::anchors}{anchor} properties.
For more information on using Flow and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
- \sa Column, Row, Grid, Positioner, {qml/positioners}{Positioners example}
+ \sa Column, Row, Grid, Positioner, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Flow::populate
@@ -1567,7 +1585,7 @@ void QQuickGrid::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Flow::add
@@ -1589,7 +1607,7 @@ void QQuickGrid::reportConflictingAnchors()
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Flow::move
@@ -1610,11 +1628,11 @@ void QQuickGrid::reportConflictingAnchors()
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty real QtQuick2::Flow::spacing
@@ -1692,7 +1710,7 @@ void QQuickFlow::setFlow(Flow flow)
\l Flow::flow property.
\endlist
- \sa Grid::layoutDirection, Row::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example}
+ \sa Grid::layoutDirection, Row::layoutDirection, {Qt Quick Examples - Right to Left}
*/
Qt::LayoutDirection QQuickFlow::layoutDirection() const
diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp
index 3c3bd8897b..c9f37930e2 100644
--- a/src/quick/items/qquickrectangle.cpp
+++ b/src/quick/items/qquickrectangle.cpp
@@ -302,7 +302,7 @@ int QQuickRectanglePrivate::doUpdateSlotIdx = -1;
\clearfloat
\section1 Performance
- Using the \l antialiasing property improves the appearance of a rounded rectangle at
+ Using the \l Item::antialiasing property improves the appearance of a rounded rectangle at
the cost of rendering performance. You should consider unsetting this property
for rectangles in motion, and only set it when they are stationary.
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 35e37d1246..d92b3b43d8 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -217,7 +217,7 @@ void QQuickRepeater::setModel(const QVariant &model)
d->model = new QQmlDelegateModel(qmlContext(this));
d->ownModel = true;
if (isComponentComplete())
- static_cast<QQmlDelegateModel *>(d->model)->componentComplete();
+ static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
}
if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model))
dataModel->setModel(model);
@@ -329,7 +329,7 @@ void QQuickRepeater::componentComplete()
{
Q_D(QQuickRepeater);
if (d->model && d->ownModel)
- static_cast<QQmlDelegateModel *>(d->model)->componentComplete();
+ static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
QQuickItem::componentComplete();
regenerate();
if (d->model && d->model->count())
@@ -351,11 +351,12 @@ void QQuickRepeater::clear()
if (d->model) {
for (int i = 0; i < d->deletables.count(); ++i) {
- QQuickItem *item = d->deletables.at(i);
- if (complete)
- emit itemRemoved(i, item);
- item->setParentItem(0);
- d->model->release(item);
+ if (QQuickItem *item = d->deletables.at(i)) {
+ if (complete)
+ emit itemRemoved(i, item);
+ item->setParentItem(0);
+ d->model->release(item);
+ }
}
}
d->deletables.clear();
@@ -395,7 +396,7 @@ void QQuickRepeaterPrivate::createItems()
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << q->tr("Delegate must be of Item type");
+ qmlInfo(delegate ? delegate : q) << QQuickRepeater::tr("Delegate must be of Item type");
}
}
createFrom = ii;
diff --git a/src/quick/items/qquickrepeater_p_p.h b/src/quick/items/qquickrepeater_p_p.h
index f220eb4fcb..a642f6479a 100644
--- a/src/quick/items/qquickrepeater_p_p.h
+++ b/src/quick/items/qquickrepeater_p_p.h
@@ -73,7 +73,7 @@ public:
private:
void createItems();
- QQmlInstanceModel *model;
+ QPointer<QQmlInstanceModel> model;
QVariant dataSource;
QQmlGuard<QObject> dataSourceAsObject;
bool ownModel : 1;
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 33a831acad..80080d8b88 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
To use this type, you will need to import the module with the following line:
\code
- import QtQuick.Window 2.0
+ import QtQuick.Window 2.1
\endcode
It is a separate import in order to allow you to have a QML environment
without access to window system features.
@@ -80,6 +80,13 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \qmlattachedproperty String QtQuick.Window2::Screen::name
+ \readonly
+ \since Qt 5.1
+
+ The name of the screen.
+*/
+/*!
\qmlattachedproperty int QtQuick.Window2::Screen::width
\readonly
@@ -92,6 +99,43 @@ QT_BEGIN_NAMESPACE
This contains the height of the screen in pixels.
*/
/*!
+ \qmlattachedproperty int QtQuick.Window2::Screen::desktopAvailableWidth
+ \readonly
+ \since Qt 5.1
+
+ This contains the available width of the collection of screens which make
+ up the virtual desktop, in pixels, excluding window manager reserved areas
+ such as task bars and system menus. If you want to position a Window at
+ the right of the desktop, you can bind to it like this:
+
+ \qml
+ x: Screen.desktopAvailableWidth - width
+ \endqml
+*/
+/*!
+ \qmlattachedproperty int QtQuick.Window2::Screen::desktopAvailableHeight
+ \readonly
+ \since Qt 5.1
+
+ This contains the available height of the collection of screens which make
+ up the virtual desktop, in pixels, excluding window manager reserved areas
+ such as task bars and system menus. If you want to position a Window at
+ the bottom of the desktop, you can bind to it like this:
+
+ \qml
+ y: Screen.desktopAvailableHeight - height
+ \endqml
+*/
+/*!
+ \qmlattachedproperty real QtQuick.Window2::Screen::logicalPixelDensity
+ \readonly
+ \since Qt 5.1
+
+ The number of logical pixels per millimeter. Logical pixels are the
+ usual units in QML; on some systems they may be different than physical
+ pixels.
+*/
+/*!
\qmlattachedproperty Qt::ScreenOrientation QtQuick.Window2::Screen::primaryOrientation
\readonly
@@ -147,6 +191,13 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
}
}
+QString QQuickScreenAttached::name() const
+{
+ if (!m_screen)
+ return QString();
+ return m_screen->name();
+}
+
int QQuickScreenAttached::width() const
{
if (!m_screen)
@@ -161,6 +212,27 @@ int QQuickScreenAttached::height() const
return m_screen->size().height();
}
+int QQuickScreenAttached::desktopAvailableWidth() const
+{
+ if (!m_screen)
+ return 0;
+ return m_screen->availableVirtualSize().width();
+}
+
+int QQuickScreenAttached::desktopAvailableHeight() const
+{
+ if (!m_screen)
+ return 0;
+ return m_screen->availableVirtualSize().height();
+}
+
+qreal QQuickScreenAttached::logicalPixelDensity() const
+{
+ if (!m_screen)
+ return 0.0;
+ return m_screen->logicalDotsPerInch() / 25.4;
+}
+
Qt::ScreenOrientation QQuickScreenAttached::primaryOrientation() const
{
if (!m_screen)
@@ -209,12 +281,16 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
emit widthChanged();
emit heightChanged();
}
-
+ if (!oldScreen || screen->name() != oldScreen->name())
+ emit nameChanged();
if (!oldScreen || screen->orientation() != oldScreen->orientation())
emit orientationChanged();
if (!oldScreen || screen->primaryOrientation() != oldScreen->primaryOrientation())
emit primaryOrientationChanged();
-
+ if (!oldScreen || screen->availableVirtualGeometry() != oldScreen->availableVirtualGeometry())
+ emit desktopGeometryChanged();
+ if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch())
+ emit logicalPixelDensityChanged();
connect(screen, SIGNAL(geometryChanged(QRect)),
this, SIGNAL(widthChanged()));
@@ -224,6 +300,10 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
this, SIGNAL(orientationChanged()));
connect(screen, SIGNAL(primaryOrientationChanged(Qt::ScreenOrientation)),
this, SIGNAL(primaryOrientationChanged()));
+ connect(screen, SIGNAL(virtualGeometryChanged(const QRect &)),
+ this, SIGNAL(desktopGeometryChanged()));
+ connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)),
+ this, SIGNAL(logicalPixelDensityChanged()));
}
}
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 98f38b7154..b35fd04e58 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -58,16 +58,24 @@ class Q_AUTOTEST_EXPORT QQuickScreenAttached : public QObject
{
Q_OBJECT
+ Q_PROPERTY(QString name READ name NOTIFY nameChanged REVISION 1);
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
+ Q_PROPERTY(int desktopAvailableWidth READ desktopAvailableWidth NOTIFY desktopGeometryChanged REVISION 1)
+ Q_PROPERTY(int desktopAvailableHeight READ desktopAvailableHeight NOTIFY desktopGeometryChanged REVISION 1)
+ Q_PROPERTY(qreal logicalPixelDensity READ logicalPixelDensity NOTIFY logicalPixelDensityChanged REVISION 1)
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
public:
QQuickScreenAttached(QObject* attachee);
+ QString name() const;
int width() const;
int height() const;
+ int desktopAvailableWidth() const;
+ int desktopAvailableHeight() const;
+ qreal logicalPixelDensity() const;
Qt::ScreenOrientation primaryOrientation() const;
Qt::ScreenOrientation orientation() const;
@@ -77,8 +85,11 @@ public:
void windowChanged(QQuickWindow*);
Q_SIGNALS:
+ Q_REVISION(1) void nameChanged();
void widthChanged();
void heightChanged();
+ Q_REVISION(1) void desktopGeometryChanged();
+ Q_REVISION(1) void logicalPixelDensityChanged();
void primaryOrientationChanged();
void orientationChanged();
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 102066704b..f39a15070c 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -912,8 +912,8 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
{
QQuickShaderEffectNode *node = static_cast<QQuickShaderEffectNode *>(oldNode);
- // In the case of a bad vertex shader, don't try to create a node...
- if (m_common.attributes.isEmpty()) {
+ // In the case of zero-size or a bad vertex shader, don't try to create a node...
+ if (m_common.attributes.isEmpty() || width() <= 0 || height() <= 0) {
if (node)
delete node;
return 0;
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index 59b788643a..9debfe35b3 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -468,7 +468,7 @@ QImage QQuickShaderEffectTexture::toImage() const
\since QtQuick 2.0
\inherits Item
\ingroup qtquick-effects
- \brief Renders a QtQuick item into a texture and displays it
+ \brief Renders a \l {Qt Quick} item into a texture and displays it
The ShaderEffectSource type renders \l sourceItem into a texture and
displays it in the scene. \l sourceItem is drawn into the texture as though
@@ -478,7 +478,7 @@ QImage QQuickShaderEffectTexture::toImage() const
ShaderEffectSource can be used as:
\list
\li a texture source in a \l ShaderEffect.
- This allows you to apply custom shader effects to any QtQuick item.
+ This allows you to apply custom shader effects to any \l {Qt Quick} item.
\li a cache for a complex item.
The complex item can be rendered once into the texture, which can
then be animated freely without the need to render the complex item
@@ -942,7 +942,7 @@ void QQuickShaderEffectSource::releaseResources()
QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
- if (!m_sourceItem || m_sourceItem->width() == 0 || m_sourceItem->height() == 0) {
+ if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) {
if (m_texture)
m_texture->setItem(0);
delete oldNode;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 9a90b408c3..cc2cbb3cb3 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -107,6 +107,7 @@ void QQuickTextPrivate::init()
Q_Q(QQuickText);
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFlag(QQuickItem::ItemHasContents);
+ q->setAcceptHoverEvents(true);
}
QQuickTextDocumentWithImageResources::QQuickTextDocumentWithImageResources(QQuickItem *parent)
@@ -313,7 +314,8 @@ qreal QQuickTextPrivate::getImplicitHeight() const
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
- On HighDpi "retina" displays this property is ignored and QtRendering is always used.
+ On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored
+ and QtRendering is always used.
*/
QQuickText::RenderType QQuickText::renderType() const
{
@@ -953,7 +955,10 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
// Create the remainder of the unwrapped lines up to maxLineCount to get the
// implicit width.
- if (line.isValid() && layoutText.at(line.textStart() + line.textLength()) != QChar::LineSeparator)
+ const int eol = line.isValid()
+ ? line.textStart() + line.textLength()
+ : layoutText.length();
+ if (eol < layoutText.length() && layoutText.at(eol) != QChar::LineSeparator)
line = layout.createLine();
for (; line.isValid() && unwrappedLineCount <= maxLineCount; ++unwrappedLineCount)
line = layout.createLine();
@@ -1334,10 +1339,10 @@ QQuickText::~QQuickText()
\snippet qml/text/onLinkActivated.qml 0
The example code will display the text
- "The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}."
+ "See the \l{http://qt-project.org}{Qt Project website}."
Clicking on the highlighted link will output
- \tt{http://qt.nokia.com link activated} to the console.
+ \tt{http://qt-project.org link activated} to the console.
*/
/*!
@@ -1988,6 +1993,7 @@ void QQuickText::setTextFormat(TextFormat format)
d->rightToLeftText = d->extra->doc->toPlainText().isRightToLeft();
} else {
d->rightToLeftText = d->text.isRightToLeft();
+ d->textHasChanged = true;
}
d->determineHorizontalAlignment();
}
@@ -2150,9 +2156,10 @@ void QQuickText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeo
if ((!widthChanged && !heightChanged) || d->internalWidthUpdate)
goto geomChangeDone;
- if (effectiveHAlign() != QQuickText::AlignLeft && widthChanged) {
+ if ((effectiveHAlign() != QQuickText::AlignLeft && widthChanged)
+ || vAlign() != QQuickText::AlignTop && heightChanged) {
// If the width has changed and we're not left aligned do an update so the text is
- // repositioned even if a full layout isn't required.
+ // repositioned even if a full layout isn't required. And the same for vertical.
d->updateType = QQuickTextPrivate::UpdatePaintNode;
update();
}
@@ -2575,4 +2582,83 @@ void QQuickText::mouseReleaseEvent(QMouseEvent *event)
QQuickItem::mouseReleaseEvent(event);
}
+bool QQuickTextPrivate::isLinkHoveredConnected()
+{
+ Q_Q(QQuickText);
+ IS_SIGNAL_CONNECTED(q, QQuickText, linkHovered, (const QString &));
+}
+
+/*!
+ \qmlsignal QtQuick2::Text::onLinkHovered(string link)
+ \since QtQuick 2.2
+
+ This handler is called when the user hovers a link embedded in the
+ text. The link must be in rich text or HTML format and the \a link
+ string provides access to the particular link.
+
+ \sa hoveredLink
+*/
+
+/*!
+ \qmlproperty string QtQuick2::Text::hoveredLink
+ \since QtQuick 2.2
+
+ This property contains the link string when user hovers a link
+ embedded in the text. The link must be in rich text or HTML format
+ and the \a hoveredLink string provides access to the particular link.
+
+ \sa onLinkHovered
+*/
+
+QString QQuickText::hoveredLink() const
+{
+ Q_D(const QQuickText);
+ if (const_cast<QQuickTextPrivate *>(d)->isLinkHoveredConnected()) {
+ if (d->extra.isAllocated())
+ return d->extra->hoveredLink;
+ } else {
+#ifndef QT_NO_CURSOR
+ if (QQuickWindow *wnd = window()) {
+ QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0));
+ return d->anchorAt(pos);
+ }
+#endif // QT_NO_CURSOR
+ }
+ return QString();
+}
+
+void QQuickTextPrivate::processHoverEvent(QHoverEvent *event)
+{
+ Q_Q(QQuickText);
+ QString link;
+ if (event->type() != QEvent::HoverLeave)
+ link = anchorAt(event->posF());
+
+ if ((!extra.isAllocated() && !link.isEmpty()) || (extra.isAllocated() && extra->hoveredLink != link)) {
+ extra.value().hoveredLink = link;
+ emit q->linkHovered(extra->hoveredLink);
+ }
+}
+
+void QQuickText::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickText);
+ if (d->isLinkHoveredConnected())
+ d->processHoverEvent(event);
+}
+
+void QQuickText::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickText);
+ if (d->isLinkHoveredConnected())
+ d->processHoverEvent(event);
+}
+
+void QQuickText::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickText);
+ if (d->isLinkHoveredConnected())
+ d->processHoverEvent(event);
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h
index 03b436b3fb..f34cf17e5d 100644
--- a/src/quick/items/qquicktext_p.h
+++ b/src/quick/items/qquicktext_p.h
@@ -90,6 +90,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickText : public QQuickImplicitSizeItem
Q_PROPERTY(int minimumPointSize READ minimumPointSize WRITE setMinimumPointSize NOTIFY minimumPointSizeChanged)
Q_PROPERTY(FontSizeMode fontSizeMode READ fontSizeMode WRITE setFontSizeMode NOTIFY fontSizeModeChanged)
Q_PROPERTY(RenderType renderType READ renderType WRITE setRenderType NOTIFY renderTypeChanged)
+ Q_PROPERTY(QString hoveredLink READ hoveredLink NOTIFY linkHovered REVISION 2)
public:
QQuickText(QQuickItem *parent=0);
@@ -207,9 +208,12 @@ public:
RenderType renderType() const;
void setRenderType(RenderType renderType);
+ QString hoveredLink() const;
+
Q_SIGNALS:
void textChanged(const QString &text);
void linkActivated(const QString &link);
+ Q_REVISION(2) void linkHovered(const QString &link);
void fontChanged(const QFont &font);
void colorChanged();
void linkColorChanged();
@@ -243,6 +247,10 @@ protected:
void updatePolish();
+ void hoverEnterEvent(QHoverEvent *event);
+ void hoverMoveEvent(QHoverEvent *event);
+ void hoverLeaveEvent(QHoverEvent *event);
+
private Q_SLOTS:
void q_imagesLoaded();
void triggerPreprocess();
diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h
index ff6b0f20be..7a31e77ae4 100644
--- a/src/quick/items/qquicktext_p_p.h
+++ b/src/quick/items/qquicktext_p_p.h
@@ -87,6 +87,8 @@ public:
QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const;
void elideFormats(int start, int length, int offset, QList<QTextLayout::FormatRange> *elidedFormats);
+ void processHoverEvent(QHoverEvent *event);
+
QRectF layedOutTextRect;
struct ExtraData {
@@ -95,6 +97,7 @@ public:
qreal lineHeight;
QQuickTextDocumentWithImageResources *doc;
QString activeLink;
+ QString hoveredLink;
int minimumPixelSize;
int minimumPointSize;
int nbActiveDownloads;
@@ -167,6 +170,7 @@ public:
QRectF setupTextLayout(qreal * const baseline);
void setupCustomLineGeometry(QTextLine &line, qreal &height, int lineOffset = 0);
bool isLinkActivatedConnected();
+ bool isLinkHoveredConnected();
static QString anchorAt(const QTextLayout *layout, const QPointF &mousePos);
QString anchorAt(const QPointF &pos) const;
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index 9625aa5d5e..fce5e02b4d 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -298,6 +298,8 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &
bool previousUndoRedoState = doc->isUndoRedoEnabled();
doc->setUndoRedoEnabled(false);
+ const int oldCursorPos = cursor.position();
+
// avoid multiple textChanged() signals being emitted
qmlobject_disconnect(doc, QTextDocument, SIGNAL(contentsChanged()), q, QQuickTextControl, SIGNAL(textChanged()));
@@ -341,7 +343,8 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &
doc->setModified(false);
q->updateCursorRectangle(true);
- emit q->cursorPositionChanged();
+ if (cursor.position() != oldCursorPos)
+ emit q->cursorPositionChanged();
}
void QQuickTextControlPrivate::setCursorPosition(const QPointF &pos)
@@ -698,6 +701,9 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)
case QEvent::KeyPress:
d->keyPressEvent(static_cast<QKeyEvent *>(e));
break;
+ case QEvent::KeyRelease:
+ d->keyReleaseEvent(static_cast<QKeyEvent *>(e));
+ break;
case QEvent::MouseButtonPress: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mousePressEvent(ev, matrix.map(ev->localPos()));
@@ -714,6 +720,12 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mouseDoubleClickEvent(ev, matrix.map(ev->localPos()));
break; }
+ case QEvent::HoverEnter:
+ case QEvent::HoverMove:
+ case QEvent::HoverLeave: {
+ QHoverEvent *ev = static_cast<QHoverEvent *>(e);
+ d->hoverEvent(ev, matrix.map(ev->posF()));
+ break; }
#ifndef QT_NO_IM
case QEvent::InputMethod:
d->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
@@ -809,9 +821,25 @@ void QQuickTextControl::setHtml(const QString &text)
d->setContent(Qt::RichText, text);
}
+
+void QQuickTextControlPrivate::keyReleaseEvent(QKeyEvent *e)
+{
+ if (e->key() == Qt::Key_Back) {
+ e->ignore();
+ return;
+ }
+ return;
+}
+
void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)
{
Q_Q(QQuickTextControl);
+
+ if (e->key() == Qt::Key_Back) {
+ e->ignore();
+ return;
+ }
+
#ifndef QT_NO_SHORTCUT
if (e == QKeySequence::SelectAll) {
e->accept();
@@ -1381,6 +1409,20 @@ void QQuickTextControlPrivate::focusEvent(QFocusEvent *e)
}
}
+void QQuickTextControlPrivate::hoverEvent(QHoverEvent *e, const QPointF &pos)
+{
+ Q_Q(QQuickTextControl);
+
+ QString link;
+ if (e->type() != QEvent::HoverLeave)
+ link = q->anchorAt(pos);
+
+ if (hoveredLink != link) {
+ hoveredLink = link;
+ emit q->linkHovered(link);
+ }
+}
+
bool QQuickTextControl::hasImState() const
{
Q_D(const QQuickTextControl);
@@ -1416,6 +1458,12 @@ QRectF QQuickTextControl::cursorRect() const
return cursorRect(d->cursor);
}
+QString QQuickTextControl::hoveredLink() const
+{
+ Q_D(const QQuickTextControl);
+ return d->hoveredLink;
+}
+
QString QQuickTextControl::anchorAt(const QPointF &pos) const
{
Q_D(const QQuickTextControl);
diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h
index 7ec8a68b4c..bc5371b0c3 100644
--- a/src/quick/items/qquicktextcontrol_p.h
+++ b/src/quick/items/qquicktextcontrol_p.h
@@ -103,6 +103,7 @@ public:
QRectF selectionRect(const QTextCursor &cursor) const;
QRectF selectionRect() const;
+ QString hoveredLink() const;
QString anchorAt(const QPointF &pos) const;
void setCursorWidth(int width);
@@ -151,6 +152,7 @@ Q_SIGNALS:
void updateRequest();
void cursorRectangleChanged();
void linkActivated(const QString &link);
+ void linkHovered(const QString &link);
public:
virtual void processEvent(QEvent *e, const QMatrix &matrix);
diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h
index fbb88bd255..e0bcbc2191 100644
--- a/src/quick/items/qquicktextcontrol_p_p.h
+++ b/src/quick/items/qquicktextcontrol_p_p.h
@@ -108,6 +108,7 @@ public:
QRectF rectForPosition(int position) const;
void keyPressEvent(QKeyEvent *e);
+ void keyReleaseEvent(QKeyEvent *e);
void mousePressEvent(QMouseEvent *event, const QPointF &pos);
void mouseMoveEvent(QMouseEvent *event, const QPointF &pos);
void mouseReleaseEvent(QMouseEvent *event, const QPointF &pos);
@@ -117,6 +118,7 @@ public:
#ifndef QT_NO_IM
void inputMethodEvent(QInputMethodEvent *);
#endif
+ void hoverEvent(QHoverEvent *e, const QPointF &pos);
void activateLinkUnderCursor(QString href = QString());
@@ -137,6 +139,7 @@ public:
QTextCursor selectedBlockOnTripleClick;
QString anchorOnMousePress;
QString linkToCopy;
+ QString hoveredLink;
QBasicTimer cursorBlinkTimer;
QBasicTimer tripleClickTimer;
diff --git a/src/quick/items/qquicktextdocument.h b/src/quick/items/qquicktextdocument.h
index 25d3bbeaf0..7c22c01d5a 100644
--- a/src/quick/items/qquicktextdocument.h
+++ b/src/quick/items/qquicktextdocument.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
The class has to be used from C++ directly, using the property of the \l TextEdit.
- Warning: The QTextDocument provided is used internally by QtQuick elements to provide text manipulation primitives.
+ Warning: The QTextDocument provided is used internally by \l {Qt Quick} elements to provide text manipulation primitives.
You are not allowed to perform any modification of the internal state of the QTextDocument. If you do, the element
in question may stop functioning or crash.
*/
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index dde3587018..6e2262831d 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -55,6 +55,7 @@
#include <QtGui/qevent.h>
#include <QtGui/qpainter.h>
#include <QtGui/qtextobject.h>
+#include <QtGui/qtexttable.h>
#include <QtCore/qmath.h>
#include <QtCore/qalgorithms.h>
@@ -271,6 +272,12 @@ QString QQuickTextEdit::text() const
The text to display. If the text format is AutoText the text edit will
automatically determine whether the text should be treated as
rich text. This determination is made using Qt::mightBeRichText().
+
+ The text-property is mostly suitable for setting the initial content and
+ handling modifications to relatively small text content. The append(),
+ insert() and remove() methods provide more fine-grained control and
+ remarkably better performance for modifying especially large rich text
+ content.
*/
void QQuickTextEdit::setText(const QString &text)
{
@@ -380,7 +387,8 @@ void QQuickTextEdit::setTextFormat(TextFormat format)
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
- On HighDpi "retina" displays this property is ignored and QtRendering is always used.
+ On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored
+ and QtRendering is always used.
*/
QQuickTextEdit::RenderType QQuickTextEdit::renderType() const
{
@@ -1709,6 +1717,13 @@ static bool comesBefore(TextNode* n1, TextNode* n2)
return n1->startPos() < n2->startPos();
}
+static inline void updateNodeTransform(QQuickTextNode* node, const QPointF &topLeft)
+{
+ QMatrix4x4 transformMatrix;
+ transformMatrix.translate(topLeft.x(), topLeft.y());
+ node->setMatrix(transformMatrix);
+}
+
QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
{
Q_UNUSED(updatePaintNodeData);
@@ -1749,17 +1764,12 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
rootNode->removeChildNode(d->frameDecorationsNode);
delete d->frameDecorationsNode;
}
- d->frameDecorationsNode = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
- d->frameDecorationsNode->initEngine(QColor(), QColor(), QColor());
-
-
- QQuickTextNode *node = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
- node->setUseNativeRenderer(d->renderType == NativeRendering && d->window->devicePixelRatio() <= 1);
- node->initEngine(d->color, d->selectedTextColor, d->selectionColor);
+ d->frameDecorationsNode = d->createTextNode();
+ QQuickTextNode *node = 0;
- int sizeCounter = 0;
- int prevBlockStart = firstDirtyPos;
+ int currentNodeSize = 0;
+ int nodeStart = firstDirtyPos;
QPointF basePosition(d->xoff, d->yoff);
QPointF nodeOffset;
TextNode *firstCleanNode = (nodeIterator != d->textNodeMap.end()) ? *nodeIterator : 0;
@@ -1772,16 +1782,14 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
frames.append(textFrame->childFrames());
d->frameDecorationsNode->m_engine->addFrameDecorations(d->document, textFrame);
+
+ if (textFrame->lastPosition() < firstDirtyPos || (firstCleanNode && textFrame->firstPosition() >= firstCleanNode->startPos()))
+ continue;
+ node = d->createTextNode();
+
if (textFrame->firstPosition() > textFrame->lastPosition()
&& textFrame->frameFormat().position() != QTextFrameFormat::InFlow) {
- QRectF rect = d->document->documentLayout()->frameBoundingRect(textFrame);
-
- if (!node->m_engine->hasContents()) {
- nodeOffset = rect.topLeft();
- QMatrix4x4 transformMatrix;
- transformMatrix.translate(nodeOffset.x(), nodeOffset.y());
- node->setMatrix(transformMatrix);
- }
+ updateNodeTransform(node, d->document->documentLayout()->frameBoundingRect(textFrame).topLeft());
const int pos = textFrame->firstPosition() - 1;
ProtectedLayoutAccessor *a = static_cast<ProtectedLayoutAccessor *>(d->document->documentLayout());
QTextCharFormat format = a->formatAccessor(pos);
@@ -1789,10 +1797,23 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
node->m_engine->setCurrentLine(block.layout()->lineForTextPosition(pos - block.position()));
node->m_engine->addTextObject(QPointF(0, 0), format, QQuickTextNodeEngine::Unselected, d->document,
pos, textFrame->frameFormat().position());
+ nodeStart = pos;
+ } else if (qobject_cast<QTextTable*>(textFrame)) { // To keep things simple, map text tables as one text node
+ QTextFrame::iterator it = textFrame->begin();
+ nodeOffset = d->document->documentLayout()->frameBoundingRect(textFrame).topLeft();
+ updateNodeTransform(node, nodeOffset);
+ while (!it.atEnd())
+ node->m_engine->addTextBlock(d->document, (it++).currentBlock(), basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
+ nodeStart = textFrame->firstPosition();
} else {
+ // Having nodes spanning across frame boundaries will break the current bookkeeping mechanism. We need to prevent that.
+ QList<int> frameBoundaries;
+ frameBoundaries.reserve(frames.size());
+ Q_FOREACH (QTextFrame *frame, frames)
+ frameBoundaries.append(frame->firstPosition());
+ std::sort(frameBoundaries.begin(), frameBoundaries.end());
QTextFrame::iterator it = textFrame->begin();
-
while (!it.atEnd()) {
QTextBlock block = it.currentBlock();
++it;
@@ -1801,35 +1822,27 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
if (!node->m_engine->hasContents()) {
nodeOffset = d->document->documentLayout()->blockBoundingRect(block).topLeft();
- QMatrix4x4 transformMatrix;
- transformMatrix.translate(nodeOffset.x(), nodeOffset.y());
- node->setMatrix(transformMatrix);
+ updateNodeTransform(node, nodeOffset);
+ nodeStart = block.position();
}
node->m_engine->addTextBlock(d->document, block, basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
- sizeCounter += block.length();
+ currentNodeSize += block.length();
- if ((it.atEnd() && frames.isEmpty()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the last frame
+ if ((it.atEnd()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the frame
break;
- if (sizeCounter > nodeBreakingSize) {
- sizeCounter = 0;
- node->m_engine->addToSceneGraph(node, QQuickText::Normal, QColor());
- nodeIterator = d->textNodeMap.insert(nodeIterator, new TextNode(prevBlockStart, node));
- ++nodeIterator;
- rootNode->appendChildNode(node);
- prevBlockStart = block.next().position();
- node = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
- node->setUseNativeRenderer(d->renderType == NativeRendering && d->window->devicePixelRatio() <= 1);
- node->initEngine(d->color, d->selectedTextColor, d->selectionColor);
+ QList<int>::const_iterator lowerBound = qLowerBound(frameBoundaries, block.next().position());
+ if (currentNodeSize > nodeBreakingSize || *lowerBound > nodeStart) {
+ currentNodeSize = 0;
+ d->addCurrentTextNodeToRoot(rootNode, node, nodeIterator, nodeStart);
+ node = d->createTextNode();
+ nodeStart = block.next().position();
}
}
}
+ d->addCurrentTextNodeToRoot(rootNode, node, nodeIterator, nodeStart);
}
- node->m_engine->addToSceneGraph(node, QQuickText::Normal, QColor());
- nodeIterator = d->textNodeMap.insert(nodeIterator, new TextNode(prevBlockStart, node));
- ++nodeIterator;
- rootNode->appendChildNode(node);
d->frameDecorationsNode->m_engine->addToSceneGraph(d->frameDecorationsNode, QQuickText::Normal, QColor());
// Now prepend the frame decorations since we want them rendered first, with the text nodes and cursor in front.
rootNode->prependChildNode(d->frameDecorationsNode);
@@ -1848,6 +1861,10 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
}
}
+
+ // Since we iterate over blocks from different text frames that are potentially not sorted
+ // we need to ensure that our list of nodes is sorted again:
+ std::sort(d->textNodeMap.begin(), d->textNodeMap.end(), &comesBefore);
}
if (d->cursorComponent == 0 && !isReadOnly()) {
@@ -1942,6 +1959,8 @@ void QQuickTextEditPrivate::init()
#endif
q->setFlag(QQuickItem::ItemHasContents);
+ q->setAcceptHoverEvents(true);
+
document = new QQuickTextDocumentWithImageResources(q);
control = new QQuickTextControl(document, q);
@@ -1956,6 +1975,7 @@ void QQuickTextEditPrivate::init()
qmlobject_connect(control, QQuickTextControl, SIGNAL(cursorPositionChanged()), q, QQuickTextEdit, SIGNAL(cursorPositionChanged()));
qmlobject_connect(control, QQuickTextControl, SIGNAL(cursorRectangleChanged()), q, QQuickTextEdit, SLOT(moveCursorDelegate()));
qmlobject_connect(control, QQuickTextControl, SIGNAL(linkActivated(QString)), q, QQuickTextEdit, SIGNAL(linkActivated(QString)));
+ qmlobject_connect(control, QQuickTextControl, SIGNAL(linkHovered(QString)), q, QQuickTextEdit, SIGNAL(linkHovered(QString)));
qmlobject_connect(control, QQuickTextControl, SIGNAL(textChanged()), q, QQuickTextEdit, SLOT(q_textChanged()));
#ifndef QT_NO_CLIPBOARD
qmlobject_connect(QGuiApplication::clipboard(), QClipboard, SIGNAL(dataChanged()), q, QQuickTextEdit, SLOT(q_canPasteChanged()));
@@ -1994,11 +2014,16 @@ void QQuickTextEdit::markDirtyNodesForRange(int start, int end, int charDelta)
Q_D(QQuickTextEdit);
if (start == end)
return;
+
TextNode dummyNode(start, 0);
TextNodeIterator it = qLowerBound(d->textNodeMap.begin(), d->textNodeMap.end(), &dummyNode, &comesBefore);
- // qLowerBound gives us the first node past the start of the affected portion, rewind by one if we can.
- if (it != d->textNodeMap.begin())
+ // qLowerBound gives us the first node past the start of the affected portion, rewind to the first node
+ // that starts at the last position before the edit position. (there might be several because of images)
+ if (it != d->textNodeMap.begin()) {
--it;
+ TextNode otherDummy((*it)->startPos(), 0);
+ it = qLowerBound(d->textNodeMap.begin(), d->textNodeMap.end(), &otherDummy, &comesBefore);
+ }
// mark the affected nodes as dirty
while (it != d->textNodeMap.constEnd()) {
@@ -2148,8 +2173,10 @@ void QQuickTextEdit::updateSize()
if (d->inLayout) // probably the result of a binding loop, but by letting it
return; // get this far we'll get a warning to that effect.
}
- if (d->document->textWidth() != width())
+ if (d->document->textWidth() != width()) {
d->document->setTextWidth(width());
+ newWidth = d->document->idealWidth();
+ }
//### need to confirm cost of always setting these
} else if (d->wrapMode == NoWrap && d->document->textWidth() != newWidth) {
d->document->setTextWidth(newWidth); // ### Text does not align if width is not set or the idealWidth exceeds the textWidth (QTextDoc bug)
@@ -2305,6 +2332,23 @@ void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event)
}
}
+void QQuickTextEditPrivate::addCurrentTextNodeToRoot(QSGTransformNode *root, QQuickTextNode *node, TextNodeIterator &it, int startPos)
+{
+ node->m_engine->addToSceneGraph(node, QQuickText::Normal, QColor());
+ it = textNodeMap.insert(it, new TextNode(startPos, node));
+ ++it;
+ root->appendChildNode(node);
+}
+
+QQuickTextNode *QQuickTextEditPrivate::createTextNode()
+{
+ Q_Q(QQuickTextEdit);
+ QQuickTextNode* node = new QQuickTextNode(QQuickItemPrivate::get(q)->sceneGraphContext(), q);
+ node->setUseNativeRenderer(renderType == QQuickTextEdit::NativeRendering && window->devicePixelRatio() <= 1);
+ node->initEngine(color, selectedTextColor, selectionColor);
+ return node;
+}
+
void QQuickTextEdit::q_canPasteChanged()
{
Q_D(QQuickTextEdit);
@@ -2433,4 +2477,102 @@ QQuickTextDocument *QQuickTextEdit::textDocument()
return d->quickDocument;
}
+bool QQuickTextEditPrivate::isLinkHoveredConnected()
+{
+ Q_Q(QQuickTextEdit);
+ IS_SIGNAL_CONNECTED(q, QQuickTextEdit, linkHovered, (const QString &));
+}
+
+/*!
+ \qmlsignal QtQuick2::TextEdit::onLinkHovered(string link)
+ \since QtQuick 2.2
+
+ This handler is called when the user hovers a link embedded in the text.
+ The link must be in rich text or HTML format and the
+ \a link string provides access to the particular link.
+
+ \sa hoveredLink
+*/
+
+/*!
+ \qmlproperty string QtQuick2::TextEdit::hoveredLink
+ \since QtQuick 2.2
+
+ This property contains the link string when user hovers a link
+ embedded in the text. The link must be in rich text or HTML format
+ and the link string provides access to the particular link.
+
+ \sa onLinkHovered
+*/
+
+QString QQuickTextEdit::hoveredLink() const
+{
+ Q_D(const QQuickTextEdit);
+ if (const_cast<QQuickTextEditPrivate *>(d)->isLinkHoveredConnected()) {
+ return d->control->hoveredLink();
+ } else {
+#ifndef QT_NO_CURSOR
+ if (QQuickWindow *wnd = window()) {
+ QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0));
+ return d->control->anchorAt(pos);
+ }
+#endif // QT_NO_CURSOR
+ }
+ return QString();
+}
+
+void QQuickTextEdit::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextEdit);
+ if (d->isLinkHoveredConnected())
+ d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+}
+
+void QQuickTextEdit::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextEdit);
+ if (d->isLinkHoveredConnected())
+ d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+}
+
+void QQuickTextEdit::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextEdit);
+ if (d->isLinkHoveredConnected())
+ d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+}
+
+/*!
+ \qmlmethod void QtQuick2::TextEdit::append(string text)
+ \since QtQuick 2.2
+
+ Appends a new paragraph with \a text to the end of the TextEdit.
+
+ In order to append without inserting a new paragraph,
+ call \c myTextEdit.insert(myTextEdit.length, text) instead.
+*/
+void QQuickTextEdit::append(const QString &text)
+{
+ Q_D(QQuickTextEdit);
+ QTextCursor cursor(d->document);
+ cursor.beginEditBlock();
+ cursor.movePosition(QTextCursor::End);
+
+ if (!d->document->isEmpty())
+ cursor.insertBlock();
+
+#ifndef QT_NO_TEXTHTMLPARSER
+ if (d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text))) {
+ cursor.insertHtml(text);
+ } else {
+ cursor.insertText(text);
+ }
+#else
+ cursor.insertText(text);
+#endif // QT_NO_TEXTHTMLPARSER
+
+ cursor.endEditBlock();
+ d->control->updateCursorRectangle(false);
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h
index 4e09eafcac..69ffad7e70 100644
--- a/src/quick/items/qquicktextedit_p.h
+++ b/src/quick/items/qquicktextedit_p.h
@@ -102,6 +102,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem
Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl RESET resetBaseUrl NOTIFY baseUrlChanged)
Q_PROPERTY(RenderType renderType READ renderType WRITE setRenderType NOTIFY renderTypeChanged)
Q_PROPERTY(QQuickTextDocument *textDocument READ textDocument FINAL REVISION 1)
+ Q_PROPERTY(QString hoveredLink READ hoveredLink NOTIFY linkHovered REVISION 2)
public:
QQuickTextEdit(QQuickItem *parent=0);
@@ -255,6 +256,8 @@ public:
QQuickTextDocument *textDocument();
+ QString hoveredLink() const;
+
Q_SIGNALS:
void textChanged();
void contentSizeChanged();
@@ -282,6 +285,7 @@ Q_SIGNALS:
void selectByMouseChanged(bool selectByMouse);
void mouseSelectionModeChanged(SelectionMode mode);
void linkActivated(const QString &link);
+ Q_REVISION(2) void linkHovered(const QString &link);
void canPasteChanged();
void canUndoChanged();
void canRedoChanged();
@@ -310,6 +314,7 @@ public Q_SLOTS:
void redo();
void insert(int position, const QString &text);
void remove(int start, int end);
+ Q_REVISION(2) void append(const QString &text);
private Q_SLOTS:
void q_textChanged();
@@ -338,6 +343,10 @@ protected:
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
+ void hoverEnterEvent(QHoverEvent *event);
+ void hoverMoveEvent(QHoverEvent *event);
+ void hoverLeaveEvent(QHoverEvent *event);
+
// mouse filter?
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h
index feb7e98873..ec3cf1cec5 100644
--- a/src/quick/items/qquicktextedit_p_p.h
+++ b/src/quick/items/qquicktextedit_p_p.h
@@ -87,6 +87,7 @@ public:
QQuickTextNode* m_node;
bool m_dirty;
};
+ typedef QList<Node*>::iterator TextNodeIterator;
QQuickTextEditPrivate()
@@ -123,9 +124,12 @@ public:
void mirrorChange();
qreal getImplicitWidth() const;
Qt::LayoutDirection textDirection(const QString &text) const;
+ bool isLinkHoveredConnected();
void setNativeCursorEnabled(bool enabled) { control->setCursorWidth(enabled ? 1 : 0); }
void handleFocusEvent(QFocusEvent *event);
+ void addCurrentTextNodeToRoot(QSGTransformNode *, QQuickTextNode*, TextNodeIterator&, int startPos);
+ QQuickTextNode* createTextNode();
#ifndef QT_NO_IM
Qt::InputMethodHints effectiveInputMethodHints() const;
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 989c0db3ab..2bd3a3da37 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -155,7 +155,8 @@ void QQuickTextInput::setText(const QString &s)
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
- On HighDpi "retina" displays this property is ignored and QtRendering is always used.
+ On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored
+ and QtRendering is always used.
*/
QQuickTextInput::RenderType QQuickTextInput::renderType() const
{
@@ -778,7 +779,10 @@ QRectF QQuickTextInput::cursorRectangle() const
QTextLine l = d->m_textLayout.lineForTextPosition(c);
if (!l.isValid())
return QRectF();
- return QRectF(l.cursorToX(c) - d->hscroll, l.y() - d->vscroll, 1, l.height());
+ qreal x = l.cursorToX(c) - d->hscroll;
+ qreal y = l.y() - d->vscroll;
+ qreal height = l.ascent() + l.descent();
+ return QRectF(x, y, 1, height);
}
/*!
@@ -1227,10 +1231,11 @@ Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const
Specifies how the text should be displayed in the TextInput.
\list
\li TextInput.Normal - Displays the text as it is. (Default)
- \li TextInput.Password - Displays asterisks instead of characters.
+ \li TextInput.Password - Displays platform-dependent password mask
+ characters instead of the actual characters.
\li TextInput.NoEcho - Displays nothing.
\li TextInput.PasswordEchoOnEdit - Displays characters as they are entered
- while editing, otherwise displays asterisks.
+ while editing, otherwise identical to \c TextInput.Password.
\endlist
*/
QQuickTextInput::EchoMode QQuickTextInput::echoMode() const
@@ -1372,9 +1377,12 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const
pos += d->preeditAreaText().length();
#endif
QTextLine l = d->m_textLayout.lineForTextPosition(pos);
- return l.isValid()
- ? QRectF(l.cursorToX(pos) - d->hscroll, l.y() - d->vscroll, 1, l.height())
- : QRectF();
+ if (!l.isValid())
+ return QRectF();
+ qreal x = l.cursorToX(pos) - d->hscroll;
+ qreal y = l.y() - d->vscroll;
+ qreal height = l.ascent() + l.descent();
+ return QRectF(x, y, 1, height);
}
/*!
@@ -1465,7 +1473,7 @@ void QQuickTextInput::keyPressEvent(QKeyEvent* ev)
int cursorPosition = d->m_cursor;
if (cursorPosition == 0)
ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Left : Qt::Key_Right);
- if (!ignore && cursorPosition == text().length())
+ if (!ignore && cursorPosition == d->m_text.length())
ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Right : Qt::Key_Left);
}
if (ignore) {
@@ -2194,7 +2202,8 @@ void QQuickTextInput::selectWord()
\qmlproperty string QtQuick2::TextInput::passwordCharacter
This is the character displayed when echoMode is set to Password or
- PasswordEchoOnEdit. By default it is an asterisk.
+ PasswordEchoOnEdit. By default it is the password character used by
+ the platform theme.
If this property is set to a string with more than one character,
the first character is used. If the string is empty, the value
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 57eff175a2..11096cfa1d 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -110,7 +110,7 @@ public:
, updateType(UpdatePaintNode)
, mouseSelectionMode(QQuickTextInput::SelectCharacters)
, m_layoutDirection(Qt::LayoutDirectionAuto)
- , m_passwordCharacter(QLatin1Char('*'))
+ , m_passwordCharacter(qApp->styleHints()->passwordMaskCharacter())
, focusOnPress(true)
, cursorVisible(false)
, cursorPending(false)
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 4952a37082..d8040a1110 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -176,7 +176,7 @@ void QQuickTextNode::setCursor(const QRectF &rect, const QColor &color)
appendChildNode(m_cursorNode);
}
-void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedTextColor, const QColor& selectionColor, const QColor& anchorColor)
+void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedTextColor, const QColor& selectionColor, const QColor& anchorColor, const QPointF &position)
{
m_engine.reset(new QQuickTextNodeEngine);
m_engine->m_hasContents = false;
@@ -184,6 +184,7 @@ void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedT
m_engine->setSelectedTextColor(selectedTextColor);
m_engine->setSelectionColor(selectionColor);
m_engine->setAnchorColor(anchorColor);
+ m_engine->setPosition(position);
}
void QQuickTextNode::addImage(const QRectF &rect, const QImage &image)
@@ -249,8 +250,7 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay
int selectionStart, int selectionEnd,
int lineStart, int lineCount)
{
- Q_UNUSED(position);
- initEngine(color, selectedTextColor, selectionColor, anchorColor);
+ initEngine(color, selectedTextColor, selectionColor, anchorColor, position);
#ifndef QT_NO_IM
int preeditLength = textLayout->preeditAreaText().length();
diff --git a/src/quick/items/qquicktextnode_p.h b/src/quick/items/qquicktextnode_p.h
index 16da3ce685..f5de6cc9b6 100644
--- a/src/quick/items/qquicktextnode_p.h
+++ b/src/quick/items/qquicktextnode_p.h
@@ -107,8 +107,8 @@ public:
void setUseNativeRenderer(bool on) { m_useNativeRenderer = on; }
private:
- void initEngine(const QColor &textColor, const QColor &selectedTextColor, const QColor &selectionColor, const QColor& anchorColor = QColor());
-
+ void initEngine(const QColor &textColor, const QColor &selectedTextColor, const QColor &selectionColor, const QColor& anchorColor = QColor()
+ , const QPointF &position = QPointF());
QSGContext *m_context;
QSGSimpleRectNode *m_cursorNode;
@@ -118,6 +118,7 @@ private:
QScopedPointer<QQuickTextNodeEngine> m_engine;
friend class QQuickTextEdit;
+ friend class QQuickTextEditPrivate;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 65343cdc52..cc32c40aa3 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -494,7 +494,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj)
<< "loaded has 'import QtQuick 1.0' or 'import Qt 4.7', this error will occur." << endl
<< endl
<< "To load files with 'import QtQuick 1.0' or 'import Qt 4.7', use the" << endl
- << "QDeclarativeView class in the qtquick1 module." << endl;
+ << "QDeclarativeView class in the Qt Quick 1 module." << endl;
delete obj;
root = 0;
}
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 4789314e01..619c72afb8 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -72,6 +72,10 @@
QT_BEGIN_NAMESPACE
+extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
+
+bool QQuickWindowPrivate::defaultAlphaBuffer(0);
+
void QQuickWindowPrivate::updateFocusItemTransform()
{
Q_Q(QQuickWindow);
@@ -85,44 +89,49 @@ void QQuickWindowPrivate::updateFocusItemTransform()
#endif
}
-
class QQuickWindowIncubationController : public QObject, public QQmlIncubationController
{
Q_OBJECT
public:
- QQuickWindowIncubationController(const QQuickWindow *window)
- : m_window(QQuickWindowPrivate::get(const_cast<QQuickWindow *>(window)))
+ QQuickWindowIncubationController(QSGRenderLoop *loop)
+ : m_renderLoop(loop), m_timer(0)
{
// Allow incubation for 1/3 of a frame.
m_incubation_time = qMax(1, int(1000 / QGuiApplication::primaryScreen()->refreshRate()) / 3);
- m_animation_driver = m_window->windowManager->animationDriver();
+ m_animation_driver = m_renderLoop->animationDriver();
if (m_animation_driver) {
connect(m_animation_driver, SIGNAL(stopped()), this, SLOT(animationStopped()));
- connect(window, SIGNAL(frameSwapped()), this, SLOT(incubate()));
+ connect(m_renderLoop, SIGNAL(timeToIncubate()), this, SLOT(incubate()));
}
}
protected:
- virtual bool event(QEvent *e)
+ void timerEvent(QTimerEvent *)
{
- if (e->type() == QEvent::User) {
- incubate();
- return true;
+ killTimer(m_timer);
+ m_timer = 0;
+ incubate();
+ }
+
+ void incubateAgain() {
+ if (m_timer == 0) {
+ // Wait for a while before processing the next batch. Using a
+ // timer to avoid starvation of system events.
+ m_timer = startTimer(m_incubation_time);
}
- return QObject::event(e);
}
public slots:
void incubate() {
if (incubatingObjectCount()) {
- if (m_animation_driver && m_animation_driver->isRunning()) {
+ if (m_renderLoop->interleaveIncubation()) {
incubateFor(m_incubation_time);
} else {
incubateFor(m_incubation_time * 2);
if (incubatingObjectCount())
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
+ incubateAgain();
}
}
}
@@ -132,14 +141,15 @@ public slots:
protected:
virtual void incubatingObjectCountChanged(int count)
{
- if (count && (!m_animation_driver || !m_animation_driver->isRunning()))
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
+ if (count && !m_renderLoop->interleaveIncubation())
+ incubateAgain();
}
private:
- QQuickWindowPrivate *m_window;
+ QSGRenderLoop *m_renderLoop;
int m_incubation_time;
QAnimationDriver *m_animation_driver;
+ int m_timer;
};
#include "qquickwindow.moc"
@@ -149,8 +159,6 @@ private:
/*!
Returns an accessibility interface for this window, or 0 if such an
interface cannot be created.
-
- \warning The caller is responsible for deleting the returned interface.
*/
QAccessibleInterface *QQuickWindow::accessibleRoot() const
{
@@ -258,29 +266,6 @@ void QQuickWindowPrivate::polishItems()
updateFocusItemTransform();
}
-/**
- * This parameter enables that this window can be rendered without
- * being shown on screen. This feature is very limited in what it supports.
- *
- * For this feature to be useful one needs to hook into beforeRender()
- * and set the render target.
- *
- */
-void QQuickWindowPrivate::setRenderWithoutShowing(bool render)
-{
- if (render == renderWithoutShowing)
- return;
-
- Q_Q(QQuickWindow);
- renderWithoutShowing = render;
-
- if (render)
- windowManager->show(q);
- else
- windowManager->hide(q);
-}
-
-
/*!
* Schedules the window to render another frame.
*
@@ -361,7 +346,6 @@ QQuickWindowPrivate::QQuickWindowPrivate()
#endif
, touchMouseId(-1)
, touchMousePressTimestamp(0)
- , renderWithoutShowing(false)
, dirtyItemList(0)
, context(0)
, renderer(0)
@@ -371,6 +355,7 @@ QQuickWindowPrivate::QQuickWindowPrivate()
, persistentGLContext(true)
, persistentSceneGraph(true)
, lastWheelEventAccepted(false)
+ , componentCompleted(true)
, renderTarget(0)
, renderTargetId(0)
, incubationController(0)
@@ -414,7 +399,10 @@ void QQuickWindowPrivate::init(QQuickWindow *c)
QQmlListProperty<QObject> QQuickWindowPrivate::data()
{
initContentItem();
- return QQuickItemPrivate::get(contentItem)->data();
+ return QQmlListProperty<QObject>(q_func(), 0, QQuickWindowPrivate::data_append,
+ QQuickWindowPrivate::data_count,
+ QQuickWindowPrivate::data_at,
+ QQuickWindowPrivate::data_clear);
}
void QQuickWindowPrivate::initContentItem()
@@ -432,7 +420,7 @@ static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::Touc
{
// The touch point local position and velocity are not yet transformed.
QMouseEvent *me = new QMouseEvent(type, transformNeeded ? item->mapFromScene(p.scenePos()) : p.pos(), p.scenePos(), p.screenPos(),
- Qt::LeftButton, Qt::LeftButton, event->modifiers());
+ Qt::LeftButton, (type == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton), event->modifiers());
me->setAccepted(true);
me->setTimestamp(event->timestamp());
QVector2D transformedVelocity = p.velocity();
@@ -838,15 +826,34 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
\ingroup qtquick-visual
\brief Creates a new top-level window
- The Window object creates a new top-level window for a QtQuick scene. It automatically sets up the
- window for use with QtQuick 2.x graphical types.
+ The Window object creates a new top-level window for a Qt Quick scene. It automatically sets up the
+ window for use with \c {QtQuick 2.x} graphical types.
To use this type, you will need to import the module with the following line:
\code
import QtQuick.Window 2.1
\endcode
- Restricting this import will allow you to have a QML environment without access to window system features.
+ Omitting this import will allow you to have a QML environment without
+ access to window system features.
+
+ A Window can be declared inside an Item or inside another Window; in that
+ case the inner Window will automatically become "transient for" the outer
+ Window: that is, most platforms will show it centered upon the outer window
+ by default, and there may be other platform-dependent behaviors, depending
+ also on the \l flags. If the nested window is intended to be a dialog in
+ your application, you should also set \l flags to Qt.Dialog, because some
+ window managers will not provide the centering behavior without that flag.
+ You can also declare multiple windows inside a top-level \l QtObject, in which
+ case the windows will have no transient relationship.
+
+ Alternatively you can set or bind \l x and \l y to position the Window
+ explicitly on the screen.
+
+ When the user attempts to close a window, the \a closing signal will be
+ emitted. You can force the window to stay open (for example to prompt the
+ user to save changes) by writing an onClosing handler and setting
+ close.accepted = false.
*/
/*!
\class QQuickWindow
@@ -1094,7 +1101,10 @@ QQuickItem *QQuickWindow::contentItem() const
}
/*!
- Returns the item which currently has active focus.
+ \property QQuickWindow::activeFocusItem
+
+ \brief The item which currently has active focus or \c null if there is
+ no item with active focus.
*/
QQuickItem *QQuickWindow::activeFocusItem() const
{
@@ -1178,6 +1188,14 @@ bool QQuickWindow::event(QEvent *e)
case QEvent::WindowDeactivate:
contentItem()->windowDeactivateEvent();
break;
+ case QEvent::Close: {
+ // TOOD Qt 6 (binary incompatible)
+ // closeEvent(static_cast<QCloseEvent *>(e));
+ QQuickCloseEvent qev;
+ qev.setAccepted(e->isAccepted());
+ emit closing(&qev);
+ e->setAccepted(qev.isAccepted());
+ } break;
case QEvent::FocusAboutToChange:
#ifndef QT_NO_IM
if (d->activeFocusItem)
@@ -2037,16 +2055,68 @@ bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent
return overThreshold;
}
+/*!
+ \qmlproperty list<Object> QtQuick.Window2::Window::data
+ \default
+
+ The data property allows you to freely mix visual children, resources
+ and other Windows in a Window.
+
+ If you assign another Window to the data list, the nested window will
+ become "transient for" the outer Window.
+
+ If you assign an \l Item to the data list, it becomes a child of the
+ Window's \l contentItem, so that it appears inside the window. The item's
+ parent will be the window's contentItem, which is the root of the Item
+ ownership tree within that Window.
+
+ If you assign any other object type, it is added as a resource.
+
+ It should not generally be necessary to refer to the \c data property,
+ as it is the default property for Window and thus all child items are
+ automatically assigned to this property.
+
+ \sa QWindow::transientParent()
+ */
+
+void QQuickWindowPrivate::data_append(QQmlListProperty<QObject> *property, QObject *o)
+{
+ if (!o)
+ return;
+ QQuickWindow *that = static_cast<QQuickWindow *>(property->object);
+ if (QQuickWindow *window = qmlobject_cast<QQuickWindow *>(o))
+ window->setTransientParent(that);
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(that->contentItem())->data();
+ itemProperty.append(&itemProperty, o);
+}
+
+int QQuickWindowPrivate::data_count(QQmlListProperty<QObject> *property)
+{
+ QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
+ if (!win || !win->contentItem() || !QQuickItemPrivate::get(win->contentItem())->data().count)
+ return 0;
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
+ return itemProperty.count(&itemProperty);
+}
+
+QObject *QQuickWindowPrivate::data_at(QQmlListProperty<QObject> *property, int i)
+{
+ QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
+ return itemProperty.at(&itemProperty, i);
+}
+
+void QQuickWindowPrivate::data_clear(QQmlListProperty<QObject> *property)
+{
+ QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
+ itemProperty.clear(&itemProperty);
+}
+
bool QQuickWindowPrivate::isRenderable() const
{
- const QQuickWindow *q = q_func();
- QRect geom = q->geometry();
- if (geom.width() <= 0 || geom.height() <= 0)
- return false;
- // Change to be applied after the visibility property is integrated in qtbase:
-// return visibility != QWindow::Hidden || (renderWithoutShowing && platformWindow);
- // Temporary version which is implementation-agnostic but slightly less efficient:
- return q->isVisible() || (renderWithoutShowing && platformWindow);
+ Q_Q(const QQuickWindow);
+ return q->isExposed() && q->isVisible() && q->geometry().isValid();
}
/*!
@@ -2456,6 +2526,13 @@ void QQuickWindow::cleanupSceneGraph()
d->renderer = 0;
}
+void QQuickWindow::setTransientParent_helper(QQuickWindow *window)
+{
+ setTransientParent(window);
+ disconnect(sender(), SIGNAL(windowChanged(QQuickWindow*)),
+ this, SLOT(setTransientParent_helper(QQuickWindow*)));
+}
+
/*!
Returns the opengl context used for rendering.
@@ -2503,6 +2580,57 @@ QOpenGLContext *QQuickWindow::openglContext() const
This signal will be emitted from the scene graph rendering thread.
*/
+/*!
+ \class QQuickCloseEvent
+ \internal
+ \since QtQuick 2.1
+
+ \inmodule QtQuick.Window
+
+ \brief Notification that a \l QQuickWindow is about to be closed
+*/
+/*!
+ \qmltype CloseEvent
+ \instantiates QQuickCloseEvent
+ \inqmlmodule QtQuick.Window 2
+ \ingroup qtquick-visual
+ \brief Notification that a \l Window is about to be closed
+ \since Qt 5.1
+
+ Notification that a window is about to be closed by the windowing system
+ (e.g. the user clicked the titlebar close button). The CloseEvent contains
+ an accepted property which can be set to false to abort closing the window.
+
+ \sa Window.closing()
+*/
+
+/*!
+ \qmlproperty bool QtQuick.Window2::CloseEvent::accepted
+
+ This property indicates whether the application will allow the user to
+ close the window. It is true by default.
+*/
+
+/*!
+ \fn void QQuickWindow::closing()
+ \since QtQuick 2.1
+
+ This signal is emitted when the window receives a QCloseEvent from the
+ windowing system.
+*/
+
+/*!
+ \qmlsignal QtQuick.Window2::closing(CloseEvent close)
+ \since Qt 5.1
+
+ This signal is emitted when the user tries to close the window.
+
+ This signal includes a closeEvent parameter. The \a close \l accepted
+ property is true by default so that the window is allowed to close; but you
+ can implement an onClosing() handler and set close.accepted = false if
+ you need to do something else before the window can be closed.
+ */
+
/*!
Sets the render target for this window to be \a fbo.
@@ -2600,7 +2728,10 @@ QOpenGLFramebufferObject *QQuickWindow::renderTarget() const
/*!
Grabs the contents of the window and returns it as an image.
- This function might not work if the window is not visible.
+ It is possible to call the grabWindow() function when the window is not
+ visible. This requires that the window is \l{QWindow::create} {created}
+ and has a valid size and that no other QQuickWindow instances are rendering
+ in the same process.
\warning Calling this function will cause performance problems.
@@ -2609,6 +2740,36 @@ QOpenGLFramebufferObject *QQuickWindow::renderTarget() const
QImage QQuickWindow::grabWindow()
{
Q_D(QQuickWindow);
+ if (!isVisible()) {
+
+ if (d->context->isReady()) {
+ qWarning("QQuickWindow::grabWindow: scene graph already in use");
+ return QImage();
+ }
+
+ if (!handle() || !size().isValid()) {
+ qWarning("QQuickWindow::grabWindow: window must be created and have a valid size");
+ return QImage();
+ }
+
+ QOpenGLContext context;
+ context.setFormat(requestedFormat());
+ context.create();
+ context.makeCurrent(this);
+ d->context->initialize(&context);
+
+ d->polishItems();
+ d->syncSceneGraph();
+ d->renderSceneGraph(size());
+
+ QImage image = qt_gl_read_framebuffer(size(), false, false);
+ d->cleanupNodesOnShutdown();
+ d->context->invalidate();
+ context.doneCurrent();
+
+ return image;
+ }
+
return d->windowManager->grab(this);
}
@@ -2625,7 +2786,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const
Q_D(const QQuickWindow);
if (!d->incubationController)
- d->incubationController = new QQuickWindowIncubationController(this);
+ d->incubationController = new QQuickWindowIncubationController(d->windowManager);
return d->incubationController;
}
@@ -2817,7 +2978,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create
Setting the clear color has no effect when clearing is disabled.
By default, the clear color is white.
- \sa setClearBeforeRendering()
+ \sa setClearBeforeRendering(), setDefaultAlphaBuffer()
*/
void QQuickWindow::setColor(const QColor &color)
@@ -2827,7 +2988,7 @@ void QQuickWindow::setColor(const QColor &color)
return;
if (color.alpha() != d->clearColor.alpha()) {
- QSurfaceFormat fmt = format();
+ QSurfaceFormat fmt = requestedFormat();
if (color.alpha() < 255)
fmt.setAlphaBufferSize(8);
else
@@ -2845,6 +3006,31 @@ QColor QQuickWindow::color() const
}
/*!
+ \brief Returns whether to use alpha transparency on newly created windows.
+
+ \since Qt 5.1
+ \sa setDefaultAlphaBuffer()
+ */
+bool QQuickWindow::hasDefaultAlphaBuffer()
+{
+ return QQuickWindowPrivate::defaultAlphaBuffer;
+}
+
+/*!
+ \brief \a useAlpha specifies whether to use alpha transparency on newly created windows.
+ \since Qt 5.1
+
+ In any application which expects to create translucent windows, it's
+ necessary to set this to true before creating the first QQuickWindow,
+ because all windows will share the same \l QOpenGLContext. The default
+ value is false.
+ */
+void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha)
+{
+ QQuickWindowPrivate::defaultAlphaBuffer = useAlpha;
+}
+
+/*!
\qmlproperty string QtQuick.Window2::Window::title
The window's title in the windowing system.
@@ -2994,6 +3180,22 @@ QColor QQuickWindow::color() const
no item with active focus.
*/
+/*!
+ \qmlproperty QtQuick.Window2::Window::active
+ \since Qt 5.1
+
+ The active status of the window.
+
+ \sa requestActivate()
+ */
+
+/*!
+ \qmlmethod QtQuick2::Window::requestActivate()
+ \since QtQuick 2.1
+
+ Requests the window to be activated, i.e. receive keyboard focus.
+ */
+
#include "moc_qquickwindow.cpp"
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index a2ba9e9fe0..a0bc832334 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -57,6 +57,7 @@ class QQuickWindowPrivate;
class QOpenGLFramebufferObject;
class QQmlIncubationController;
class QInputMethodEvent;
+class QQuickCloseEvent;
class Q_QUICK_EXPORT QQuickWindow : public QWindow
{
@@ -114,6 +115,9 @@ public:
void setColor(const QColor &color);
QColor color() const;
+ static bool hasDefaultAlphaBuffer();
+ static void setDefaultAlphaBuffer(bool useAlpha);
+
void setPersistentOpenGLContext(bool persistent);
bool isPersistentOpenGLContext() const;
@@ -129,6 +133,7 @@ Q_SIGNALS:
void beforeSynchronizing();
void beforeRendering();
void afterRendering();
+ Q_REVISION(1) void closing(QQuickCloseEvent *close);
void colorChanged(const QColor &);
Q_REVISION(1) void activeFocusItemChanged();
@@ -144,6 +149,7 @@ protected:
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
+ // TODO Qt 6: reimplement QWindow::closeEvent to emit closing
virtual void focusInEvent(QFocusEvent *);
virtual void focusOutEvent(QFocusEvent *);
@@ -162,6 +168,7 @@ protected:
private Q_SLOTS:
void maybeUpdate();
void cleanupSceneGraph();
+ void setTransientParent_helper(QQuickWindow *window);
private:
friend class QQuickItem;
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index ab772ca2bc..2dddd9ab68 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -178,9 +178,6 @@ public:
bool isRenderable() const;
- bool renderWithoutShowing;
- void setRenderWithoutShowing(bool enabled);
-
QQuickItem::UpdatePaintNodeData updatePaintNodeData;
QQuickItem *dirtyItemList;
@@ -212,6 +209,7 @@ public:
uint persistentSceneGraph : 1;
uint lastWheelEventAccepted : 1;
+ bool componentCompleted : 1;
QOpenGLFramebufferObject *renderTarget;
uint renderTargetId;
@@ -222,15 +220,40 @@ public:
mutable QQuickWindowIncubationController *incubationController;
+ static bool defaultAlphaBuffer;
+
static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event);
+ // data property
+ static void data_append(QQmlListProperty<QObject> *, QObject *);
+ static int data_count(QQmlListProperty<QObject> *);
+ static QObject *data_at(QQmlListProperty<QObject> *, int);
+ static void data_clear(QQmlListProperty<QObject> *);
+
private:
static void cleanupNodesOnShutdown(QQuickItem *);
};
+class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
+
+public:
+ QQuickCloseEvent()
+ : _accepted(true) {}
+
+ bool isAccepted() { return _accepted; }
+ void setAccepted(bool accepted) { _accepted = accepted; }
+
+private:
+ bool _accepted;
+};
Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickWindowPrivate::FocusOptions)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickCloseEvent)
+
#endif // QQUICKWINDOW_P_H
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index f826a53a29..b91edc2fd5 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -42,18 +42,40 @@
#include "qquickwindowmodule_p.h"
#include "qquickscreen_p.h"
#include <QtQuick/QQuickWindow>
+#include <QtCore/QCoreApplication>
+#include <QtQml/QQmlEngine>
QT_BEGIN_NAMESPACE
+class QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus
+{
+ Q_INTERFACES(QQmlParserStatus)
+ Q_OBJECT
+protected:
+ void classBegin() {
+ //Give QQuickView behavior when created from QML with QQmlApplicationEngine
+ if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) {
+ QQmlEngine* e = qmlEngine(this);
+ if (e && !e->incubationController())
+ e->setIncubationController(incubationController());
+ }
+ }
+
+ void componentComplete() {}
+};
+
void QQuickWindowModule::defineModule()
{
const char uri[] = "QtQuick.Window";
qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window");
qmlRegisterRevision<QWindow,1>(uri, 2, 1);
- qmlRegisterType<QQuickWindow,1>(uri, 2, 1, "Window");
+ qmlRegisterRevision<QQuickWindow,1>(uri, 2, 1);//Type moved to a subclass, but also has new members
+ qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window");
qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property."));
}
+#include "qquickwindowmodule.moc"
+
QT_END_NAMESPACE
diff --git a/src/quick/quick.pro b/src/quick/quick.pro
index 393fe34e89..057f3d5db5 100644
--- a/src/quick/quick.pro
+++ b/src/quick/quick.pro
@@ -14,8 +14,15 @@ exists("qqml_enable_gcov") {
QMAKE_DOCS = $$PWD/doc/qtquick.qdocconf
+ANDROID_LIB_DEPENDENCIES = \
+ lib/libQt5QuickParticles.so
ANDROID_LIB_DEPENDENCY_REPLACEMENTS = \
"plugins/platforms/android/libqtforandroid.so:plugins/platforms/android/libqtforandroidGL.so"
+MODULE_PLUGIN_TYPES = \
+ accessible
+ANDROID_BUNDLED_FILES += \
+ qml \
+ lib/libQt5QuickParticles.so
load(qt_module)
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index 818b9b26aa..7f09af4da3 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -332,42 +332,42 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
/*!
\fn const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() const
- Convenience function to access the vertex data as an immuatble
+ Convenience function to access the vertex data as an immutable
array of QSGGeometry::ColoredPoint2D.
*/
/*!
\fn QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D()
- Convenience function to access the vertex data as a muatble
+ Convenience function to access the vertex data as a mutable
array of QSGGeometry::ColoredPoint2D.
*/
/*!
\fn const QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() const
- Convenience function to access the vertex data as an immuatble
+ Convenience function to access the vertex data as an immutable
array of QSGGeometry::TexturedPoint2D.
*/
/*!
\fn QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D()
- Convenience function to access the vertex data as a muatble
+ Convenience function to access the vertex data as a mutable
array of QSGGeometry::TexturedPoint2D.
*/
/*!
\fn const QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() const
- Convenience function to access the vertex data as an immuatble
+ Convenience function to access the vertex data as an immutable
array of QSGGeometry::Point2D.
*/
/*!
\fn QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D()
- Convenience function to access the vertex data as a muatble
+ Convenience function to access the vertex data as a mutable
array of QSGGeometry::Point2D.
*/
@@ -705,7 +705,8 @@ void QSGGeometry::updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect,
The default is AlwaysUploadPattern. When set to anything other than
the default, the user must call markIndexDataDirty() after changing
- the index data.
+ the index data, in addition to calling QSGNode::markDirty() with
+ QSGNode::DirtyGeometry.
*/
void QSGGeometry::setIndexDataPattern(DataPattern p)
@@ -728,7 +729,8 @@ void QSGGeometry::setIndexDataPattern(DataPattern p)
The default is AlwaysUploadPattern. When set to anything other than
the default, the user must call markVertexDataDirty() after changing
- the vertex data.
+ the vertex data, in addition to calling QSGNode::markDirty() with
+ QSGNode::DirtyGeometry.
*/
void QSGGeometry::setVertexDataPattern(DataPattern p)
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index c0794d0d69..9346236db9 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -556,6 +556,7 @@ static void qt_print_material_count()
QSGMaterial::QSGMaterial()
: m_flags(0)
+ , m_reserved(0)
{
#ifndef QT_NO_DEBUG
if (qsg_leak_check) {
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h
index ee8889deac..20ab21ad28 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.h
@@ -133,6 +133,7 @@ public:
void setFlag(Flags flags, bool on = true);
private:
+ friend class QSGContext;
Flags m_flags;
void *m_reserved;
Q_DISABLE_COPY(QSGMaterial)
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 6a22e0e7f9..25f8f342c9 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qsgnode.h"
+#include "qsgnode_p.h"
#include "qsgrenderer_p.h"
#include "qsgnodeupdater_p.h"
#include "qsgmaterial.h"
@@ -128,12 +129,12 @@ static void qt_print_node_count()
before rendering starts.
\value OwnsGeometry Only valid for QSGGeometryNode and QSGClipNode.
The node has ownership over the QSGGeometry instance and will
- delete it when the node is destroyed.
+ delete it when the node is destroyed or a geometry is assigned.
\value OwnsMaterial Only valid for QSGGeometryNode. The node has ownership
- over the material and will delete it when the node is destroyed.
+ over the material and will delete it when the node is destroyed or a material is assigned.
\value OwnsOpaqueMaterial Only valid for QSGGeometryNode. The node has
ownership over the opaque material and will delete it when the node is
- destroyed.
+ destroyed or a material is assigned.
*/
/*!
@@ -267,6 +268,26 @@ QSGNode::QSGNode(NodeType type)
}
/*!
+ * Constructs a new node with the given node type.
+ *
+ * \internal
+ */
+QSGNode::QSGNode(QSGNodePrivate &dd, NodeType type)
+ : m_parent(0)
+ , m_type(type)
+ , m_firstChild(0)
+ , m_lastChild(0)
+ , m_nextSibling(0)
+ , m_previousSibling(0)
+ , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
+ , m_nodeFlags(OwnedByParent)
+ , m_dirtyState(0)
+ , d_ptr(&dd)
+{
+ init();
+}
+
+/*!
* \internal
*/
void QSGNode::init()
@@ -678,6 +699,18 @@ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type)
/*!
+ \internal
+ */
+QSGBasicGeometryNode::QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type)
+ : QSGNode(dd, type)
+ , m_geometry(0)
+ , m_matrix(0)
+ , m_clip_list(0)
+{
+}
+
+
+/*!
Deletes this QSGBasicGeometryNode.
If the node has the flag QSGNode::OwnsGeometry set, it will also delete the
@@ -808,6 +841,19 @@ QSGGeometryNode::QSGGeometryNode()
/*!
+ \internal
+ */
+QSGGeometryNode::QSGGeometryNode(QSGGeometryNodePrivate &dd)
+ : QSGBasicGeometryNode(dd, GeometryNodeType)
+ , m_render_order(0)
+ , m_material(0)
+ , m_opaque_material(0)
+ , m_opacity(1)
+{
+}
+
+
+/*!
Deletes this geometry node.
The flags QSGNode::OwnsMaterial, QSGNode::OwnsOpaqueMaterial and
diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h
index 3fa2f7fc04..d83e6bcc81 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.h
+++ b/src/quick/scenegraph/coreapi/qsgnode.h
@@ -58,6 +58,9 @@ class QSGRootNode;
class QSGGeometryNode;
class QSGTransformNode;
class QSGClipNode;
+class QSGNodePrivate;
+class QSGBasicGeometryNodePrivate;
+class QSGGeometryNodePrivate;
class Q_QUICK_EXPORT QSGNode
{
@@ -149,6 +152,7 @@ public:
protected:
QSGNode(NodeType type);
+ QSGNode(QSGNodePrivate &dd, NodeType type);
private:
friend class QSGRootNode;
@@ -167,7 +171,8 @@ private:
Flags m_nodeFlags;
DirtyState m_dirtyState;
- void *m_reserved;
+protected:
+ QScopedPointer<QSGNodePrivate> d_ptr;
};
class Q_QUICK_EXPORT QSGBasicGeometryNode : public QSGNode
@@ -184,6 +189,7 @@ public:
protected:
QSGBasicGeometryNode(NodeType type);
+ QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type);
private:
friend class QSGNodeUpdater;
@@ -218,6 +224,9 @@ public:
void setInheritedOpacity(qreal opacity);
qreal inheritedOpacity() const { return m_opacity; }
+protected:
+ QSGGeometryNode(QSGGeometryNodePrivate &dd);
+
private:
friend class QSGNodeUpdater;
diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h
new file mode 100644
index 0000000000..b0d8088af2
--- /dev/null
+++ b/src/quick/scenegraph/coreapi/qsgnode_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSGNODE_P_H
+#define QSGNODE_P_H
+
+#include <qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSGNodePrivate
+{
+public:
+ QSGNodePrivate() {}
+ virtual ~QSGNodePrivate() {}
+};
+
+
+class QSGBasicGeometryNodePrivate : public QSGNodePrivate
+{
+public:
+ QSGBasicGeometryNodePrivate()
+ : QSGNodePrivate()
+ {}
+};
+
+
+class QSGGeometryNodePrivate: public QSGBasicGeometryNodePrivate
+{
+public:
+ QSGGeometryNodePrivate()
+ : QSGBasicGeometryNodePrivate()
+ {}
+};
+
+QT_END_NAMESPACE
+
+#endif // QSGNODE_P_H
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index b46d45be57..805cfaad0d 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -53,6 +53,8 @@
#include <qdatetime.h>
+#include <private/qqmlprofilerservice_p.h>
+
QT_BEGIN_NAMESPACE
//#define RENDERER_DEBUG
@@ -62,9 +64,9 @@ QT_BEGIN_NAMESPACE
#ifndef QSG_NO_RENDER_TIMING
static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
-static QTime frameTimer;
-static int preprocessTime;
-static int updatePassTime;
+static QElapsedTimer frameTimer;
+static qint64 preprocessTime;
+static qint64 updatePassTime;
#endif
void QSGBindable::clear(QSGRenderer::ClearMode mode) const
@@ -238,10 +240,11 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
frameTimer.start();
- int bindTime = 0;
- int renderTime = 0;
+ qint64 bindTime = 0;
+ qint64 renderTime = 0;
#endif
m_bindable = &bindable;
@@ -249,8 +252,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
bindable.bind();
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- bindTime = frameTimer.elapsed();
+ if (profileFrames)
+ bindTime = frameTimer.nsecsElapsed();
#endif
#ifndef QT_NO_DEBUG
@@ -270,8 +273,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
render();
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- renderTime = frameTimer.elapsed();
+ if (profileFrames)
+ renderTime = frameTimer.nsecsElapsed();
#endif
glDisable(GL_SCISSOR_TEST);
@@ -292,12 +295,22 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing) {
printf(" - Breakdown of render time: preprocess=%d, updates=%d, binding=%d, render=%d, total=%d\n",
- preprocessTime,
- updatePassTime - preprocessTime,
- bindTime - updatePassTime,
- renderTime - bindTime,
- renderTime);
+ int(preprocessTime / 1000000),
+ int((updatePassTime - preprocessTime) / 1000000),
+ int((bindTime - updatePassTime) / 1000000),
+ int((renderTime - bindTime) / 1000000),
+ int(renderTime / 1000000));
+ }
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRendererFrame,
+ preprocessTime,
+ updatePassTime - preprocessTime,
+ bindTime - updatePassTime,
+ renderTime - bindTime);
}
+
#endif
}
@@ -380,16 +393,17 @@ void QSGRenderer::preprocess()
}
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- preprocessTime = frameTimer.elapsed();
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
+ preprocessTime = frameTimer.nsecsElapsed();
#endif
nodeUpdater()->setToplevelOpacity(context()->renderAlpha());
nodeUpdater()->updateStates(m_root_node);
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- updatePassTime = frameTimer.elapsed();
+ if (profileFrames)
+ updatePassTime = frameTimer.nsecsElapsed();
#endif
}
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 1d534e3563..3536975e94 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -48,6 +48,7 @@
#include <QtGui/qguiapplication.h>
#include <qdir.h>
+#include <private/qqmlprofilerservice_p.h>
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
@@ -162,7 +163,8 @@ void QSGDistanceFieldGlyphCache::update()
return;
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
qsg_render_timer.start();
#endif
@@ -176,10 +178,10 @@ void QSGDistanceFieldGlyphCache::update()
}
#ifndef QSG_NO_RENDER_TIMING
- int renderTime = 0;
+ qint64 renderTime = 0;
int count = m_pendingGlyphs.size();
- if (qsg_render_timing)
- renderTime = qsg_render_timer.elapsed();
+ if (profileFrames)
+ renderTime = qsg_render_timer.nsecsElapsed();
#endif
m_pendingGlyphs.reset();
@@ -190,11 +192,18 @@ void QSGDistanceFieldGlyphCache::update()
if (qsg_render_timing) {
printf(" - glyphs: count=%d, render=%d, store=%d, total=%d\n",
count,
- renderTime,
- (int) qsg_render_timer.elapsed() - renderTime,
+ int(renderTime/1000000),
+ (int) qsg_render_timer.elapsed() - int(renderTime/1000000),
(int) qsg_render_timer.elapsed());
}
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphAdaptationLayerFrame,
+ count,
+ renderTime,
+ qsg_render_timer.nsecsElapsed() - renderTime);
+ }
#endif
}
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 8d36fce481..866d678412 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -47,13 +47,16 @@
#include <QtQuick/private/qsgdefaultimagenode_p.h>
#include <QtQuick/private/qsgdefaultglyphnode_p.h>
#include <QtQuick/private/qsgdistancefieldglyphnode_p.h>
+#include <QtQuick/private/qsgdistancefieldglyphnode_p_p.h>
#include <QtQuick/private/qsgshareddistancefieldglyphcache_p.h>
+#include <QtQuick/QSGFlatColorMaterial>
#include <QtQuick/private/qsgtexture_p.h>
#include <QtQuick/private/qquickpixmapcache_p.h>
#include <QGuiApplication>
#include <QOpenGLContext>
+#include <QQuickWindow>
#include <QtGui/qopenglframebufferobject.h>
#include <private/qqmlglobal_p.h>
@@ -67,6 +70,8 @@
#include <private/qobject_p.h>
#include <qmutex.h>
+#include <private/qqmlprofilerservice_p.h>
+
DEFINE_BOOL_CONFIG_OPTION(qmlFlashMode, QML_FLASH_MODE)
DEFINE_BOOL_CONFIG_OPTION(qmlTranslucentMode, QML_TRANSLUCENT_MODE)
DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
@@ -157,15 +162,13 @@ QSGContext::QSGContext(QObject *parent) :
QObject(*(new QSGContextPrivate), parent)
{
Q_D(QSGContext);
- static bool doSubpixel = qApp->arguments().contains(QLatin1String("--text-subpixel-antialiasing"));
- static bool doLowQualSubpixel = qApp->arguments().contains(QLatin1String("--text-subpixel-antialiasing-lowq"));
- static bool doGray = qApp->arguments().contains(QLatin1String("--text-gray-antialiasing"));
- if (doSubpixel)
+ QByteArray mode = qgetenv("QSG_DISTANCEFIELD_ANTIALIASING");
+ if (mode == "subpixel")
d->distanceFieldAntialiasing = QSGGlyphNode::HighQualitySubPixelAntialiasing;
- else if (doLowQualSubpixel)
+ else if (mode == "subpixel-lowq")
d->distanceFieldAntialiasing = QSGGlyphNode::LowQualitySubPixelAntialiasing;
- else if (doGray)
- d->distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing;
+ else if (mode == "gray")
+ d->distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing;
}
@@ -260,9 +263,35 @@ void QSGContext::initialize(QOpenGLContext *context)
Q_ASSERT(!d->gl);
d->gl = context;
+ precompileMaterials();
+
emit initialized();
}
+#define QSG_PRECOMPILE_MATERIAL(name) { name m; prepareMaterial(&m); }
+
+/*
+ * Some glsl compilers take their time compiling materials, and
+ * the way the scene graph is being processed, these materials
+ * get compiled when they are first taken into use. This can
+ * easily lead to skipped frames. By precompiling the most
+ * common materials, we potentially add a few milliseconds to the
+ * start up, and reduce the chance of avoiding skipped frames
+ * later on.
+ */
+void QSGContext::precompileMaterials()
+{
+ if (qEnvironmentVariableIsEmpty("QSG_NO_MATERIAL_PRELOADING")) {
+ QSG_PRECOMPILE_MATERIAL(QSGVertexColorMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGFlatColorMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGOpaqueTextureMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGTextureMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGSmoothTextureMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGSmoothColorMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGDistanceFieldTextMaterial);
+ }
+}
+
/*!
Returns if the scene graph context is ready or not, meaning that it has a valid
@@ -354,7 +383,11 @@ QSGDistanceFieldGlyphCache *QSGContext::distanceFieldGlyphCache(const QRawFont &
*/
QSGGlyphNode *QSGContext::createNativeGlyphNode()
{
+#if defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2_ANGLE)
+ return createGlyphNode();
+#else
return new QSGDefaultGlyphNode;
+#endif
}
/*!
@@ -392,6 +425,8 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
+ if (QQuickWindow::hasDefaultAlphaBuffer())
+ format.setAlphaBufferSize(8);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
return format;
}
@@ -472,17 +507,24 @@ QSGDepthStencilBufferManager *QSGContext::depthStencilBufferManager()
QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material)
{
Q_D(QSGContext);
+
+ if (material->m_reserved)
+ return reinterpret_cast<QSGMaterialShader *>(material->m_reserved);
+
QSGMaterialType *type = material->type();
QSGMaterialShader *shader = d->materials.value(type);
- if (shader)
+ if (shader) {
+ material->m_reserved = shader;
return shader;
+ }
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ if (qsg_render_timing || QQmlProfilerService::enabled)
qsg_renderer_timer.start();
#endif
shader = material->createShader();
+ material->m_reserved = shader;
shader->compile();
shader->initialize();
d->materials[type] = shader;
@@ -490,6 +532,12 @@ QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material)
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing)
printf(" - compiling material: %dms\n", (int) qsg_renderer_timer.elapsed());
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphContextFrame,
+ qsg_renderer_timer.nsecsElapsed());
+ }
#endif
return shader;
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index b069c53dd3..bbc42674c6 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -90,6 +90,7 @@ public:
bool isReady() const;
+ virtual void precompileMaterials();
QSGMaterialShader *prepareMaterial(QSGMaterial *material);
virtual void renderNextFrame(QSGRenderer *renderer, GLuint fboId);
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 419062d025..f5a461f19e 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -95,7 +95,8 @@ const char *QSGTextMaskMaterialData::fragmentShader() const {
"uniform sampler2D texture; \n"
"uniform lowp vec4 color; \n"
"void main() { \n"
- " gl_FragColor = vec4(texture2D(texture, sampleCoord).rgb * color.a, 1.0); \n"
+ " lowp vec4 glyph = texture2D(texture, sampleCoord); \n"
+ " gl_FragColor = vec4(glyph.rgb * color.a, glyph.a); \n"
"}";
}
@@ -162,7 +163,7 @@ void QSGTextMaskMaterialData::updateState(const RenderState &state, QSGMaterial
state.context()->functions()->glBlendColor(c.redF(),
c.greenF(),
c.blueF(),
- 1.0f);
+ c.alphaF());
}
}
@@ -520,7 +521,7 @@ int QSGTextMaskMaterial::compare(const QSGMaterial *o) const
Q_ASSERT(o && type() == o->type());
const QSGTextMaskMaterial *other = static_cast<const QSGTextMaskMaterial *>(o);
if (m_glyphCache != other->m_glyphCache)
- return m_glyphCache - other->m_glyphCache;
+ return m_glyphCache.data() < other->m_glyphCache.data() ? -1 : 1;
QRgb c1 = m_color.rgba();
QRgb c2 = other->m_color.rgba();
return int(c2 < c1) - int(c1 < c2);
diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp
index cadd18e833..aed69913fa 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp
@@ -87,24 +87,24 @@ protected:
};
-SmoothTextureMaterial::SmoothTextureMaterial()
+QSGSmoothTextureMaterial::QSGSmoothTextureMaterial()
{
setFlag(RequiresFullMatrixExceptTranslate, true);
setFlag(Blending, true);
}
-void SmoothTextureMaterial::setTexture(QSGTexture *texture)
+void QSGSmoothTextureMaterial::setTexture(QSGTexture *texture)
{
m_texture = texture;
}
-QSGMaterialType *SmoothTextureMaterial::type() const
+QSGMaterialType *QSGSmoothTextureMaterial::type() const
{
static QSGMaterialType type;
return &type;
}
-QSGMaterialShader *SmoothTextureMaterial::createShader() const
+QSGMaterialShader *QSGSmoothTextureMaterial::createShader() const
{
return new SmoothTextureMaterialShader;
}
diff --git a/src/quick/scenegraph/qsgdefaultimagenode_p.h b/src/quick/scenegraph/qsgdefaultimagenode_p.h
index 7d299faee3..723943fd71 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode_p.h
+++ b/src/quick/scenegraph/qsgdefaultimagenode_p.h
@@ -48,10 +48,10 @@
QT_BEGIN_NAMESPACE
-class SmoothTextureMaterial : public QSGTextureMaterial
+class Q_QUICK_PRIVATE_EXPORT QSGSmoothTextureMaterial : public QSGTextureMaterial
{
public:
- SmoothTextureMaterial();
+ QSGSmoothTextureMaterial();
void setTexture(QSGTexture *texture);
@@ -60,7 +60,7 @@ protected:
virtual QSGMaterialShader *createShader() const;
};
-class QSGDefaultImageNode : public QSGImageNode
+class Q_QUICK_PRIVATE_EXPORT QSGDefaultImageNode : public QSGImageNode
{
public:
QSGDefaultImageNode();
@@ -90,7 +90,7 @@ private:
QSGOpaqueTextureMaterial m_material;
QSGTextureMaterial m_materialO;
- SmoothTextureMaterial m_smoothMaterial;
+ QSGSmoothTextureMaterial m_smoothMaterial;
uint m_antialiasing : 1;
uint m_mirror : 1;
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
index f642ca8d16..76fbbb4209 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
@@ -211,24 +211,24 @@ const char *SmoothColorMaterialShader::fragmentShader() const
"}";
}
-SmoothColorMaterial::SmoothColorMaterial()
+QSGSmoothColorMaterial::QSGSmoothColorMaterial()
{
setFlag(RequiresFullMatrixExceptTranslate, true);
setFlag(Blending, true);
}
-int SmoothColorMaterial::compare(const QSGMaterial *) const
+int QSGSmoothColorMaterial::compare(const QSGMaterial *) const
{
return 0;
}
-QSGMaterialType *SmoothColorMaterial::type() const
+QSGMaterialType *QSGSmoothColorMaterial::type() const
{
static QSGMaterialType type;
return &type;
}
-QSGMaterialShader *SmoothColorMaterial::createShader() const
+QSGMaterialShader *QSGSmoothColorMaterial::createShader() const
{
return new SmoothColorMaterialShader;
}
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
index 24bdbb3d34..1994e015e9 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
@@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE
class QSGContext;
-class SmoothColorMaterial : public QSGMaterial
+class Q_QUICK_PRIVATE_EXPORT QSGSmoothColorMaterial : public QSGMaterial
{
public:
- SmoothColorMaterial();
+ QSGSmoothColorMaterial();
int compare(const QSGMaterial *other) const;
@@ -63,7 +63,7 @@ protected:
virtual QSGMaterialShader *createShader() const;
};
-class QSGDefaultRectangleNode : public QSGRectangleNode
+class Q_QUICK_PRIVATE_EXPORT QSGDefaultRectangleNode : public QSGRectangleNode
{
public:
QSGDefaultRectangleNode();
@@ -83,7 +83,7 @@ private:
void updateGradientTexture();
QSGVertexColorMaterial m_material;
- SmoothColorMaterial m_smoothMaterial;
+ QSGSmoothColorMaterial m_smoothMaterial;
QRectF m_rect;
QGradientStops m_gradient_stops;
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
index 86c3356d58..bdbce6165b 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -144,8 +144,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
if (oldMaterial == 0
|| material->color() != oldMaterial->color()
|| state.isOpacityDirty()) {
- QColor c = material->color();
- QVector4D color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
+ QVector4D color = material->color();
color *= state.opacity();
program()->setUniformValue(m_color_id, color);
}
@@ -206,10 +205,10 @@ QSGMaterialType *QSGDistanceFieldTextMaterial::type() const
void QSGDistanceFieldTextMaterial::setColor(const QColor &color)
{
- m_color = QColor::fromRgbF(color.redF() * color.alphaF(),
- color.greenF() * color.alphaF(),
- color.blueF() * color.alphaF(),
- color.alphaF());
+ m_color = QVector4D(color.redF() * color.alphaF(),
+ color.greenF() * color.alphaF(),
+ color.blueF() * color.alphaF(),
+ color.alphaF());
}
QSGMaterialShader *QSGDistanceFieldTextMaterial::createShader() const
@@ -239,10 +238,8 @@ int QSGDistanceFieldTextMaterial::compare(const QSGMaterial *o) const
if (m_fontScale != other->m_fontScale) {
return int(other->m_fontScale < m_fontScale) - int(m_fontScale < other->m_fontScale);
}
- QRgb c1 = m_color.rgba();
- QRgb c2 = other->m_color.rgba();
- if (c1 != c2)
- return int(c2 < c1) - int(c1 < c2);
+ if (m_color != other->m_color)
+ return &m_color < &other->m_color ? -1 : 1;
int t0 = m_texture ? m_texture->textureId : -1;
int t1 = other->m_texture ? other->m_texture->textureId : -1;
return t0 - t1;
@@ -284,8 +281,7 @@ void DistanceFieldStyledTextMaterialShader::updateState(const RenderState &state
if (oldMaterial == 0
|| material->styleColor() != oldMaterial->styleColor()
|| (state.isOpacityDirty())) {
- QColor c = material->styleColor();
- QVector4D color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
+ QVector4D color = material->styleColor();
color *= state.opacity();
program()->setUniformValue(m_styleColor_id, color);
}
@@ -302,21 +298,18 @@ QSGDistanceFieldStyledTextMaterial::~QSGDistanceFieldStyledTextMaterial()
void QSGDistanceFieldStyledTextMaterial::setStyleColor(const QColor &color)
{
- m_styleColor = QColor::fromRgbF(color.redF() * color.alphaF(),
- color.greenF() * color.alphaF(),
- color.blueF() * color.alphaF(),
- color.alphaF());
+ m_styleColor = QVector4D(color.redF() * color.alphaF(),
+ color.greenF() * color.alphaF(),
+ color.blueF() * color.alphaF(),
+ color.alphaF());
}
int QSGDistanceFieldStyledTextMaterial::compare(const QSGMaterial *o) const
{
Q_ASSERT(o && type() == o->type());
const QSGDistanceFieldStyledTextMaterial *other = static_cast<const QSGDistanceFieldStyledTextMaterial *>(o);
- if (m_styleColor != other->m_styleColor) {
- QRgb c1 = m_styleColor.rgba();
- QRgb c2 = other->m_styleColor.rgba();
- return int(c2 < c1) - int(c1 < c2);
- }
+ if (m_styleColor != other->m_color)
+ return &m_styleColor < &other->m_styleColor ? -1 : 1;
return QSGDistanceFieldTextMaterial::compare(o);
}
@@ -657,8 +650,8 @@ void QSGHiQSubPixelDistanceFieldTextMaterialShader::updateState(const RenderStat
QSGDistanceFieldTextMaterial *oldMaterial = static_cast<QSGDistanceFieldTextMaterial *>(oldEffect);
if (oldMaterial == 0 || material->color() != oldMaterial->color()) {
- QColor c = material->color();
- state.context()->functions()->glBlendColor(c.redF(), c.greenF(), c.blueF(), 1.0f);
+ QVector4D c = material->color();
+ state.context()->functions()->glBlendColor(c.x(), c.y(), c.z(), 1.0f);
}
if (oldMaterial == 0 || material->fontScale() != oldMaterial->fontScale())
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
index 7fea8f65dc..54d4146ddb 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
@@ -59,7 +59,7 @@ public:
virtual int compare(const QSGMaterial *other) const;
virtual void setColor(const QColor &color);
- const QColor &color() const { return m_color; }
+ const QVector4D &color() const { return m_color; }
void setGlyphCache(QSGDistanceFieldGlyphCache *a) { m_glyph_cache = a; }
QSGDistanceFieldGlyphCache *glyphCache() const { return m_glyph_cache; }
@@ -76,7 +76,7 @@ public:
protected:
QSize m_size;
- QColor m_color;
+ QVector4D m_color;
QSGDistanceFieldGlyphCache *m_glyph_cache;
const QSGDistanceFieldGlyphCache::Texture *m_texture;
qreal m_fontScale;
@@ -93,10 +93,10 @@ public:
virtual int compare(const QSGMaterial *other) const;
void setStyleColor(const QColor &color);
- const QColor &styleColor() const { return m_styleColor; }
+ const QVector4D &styleColor() const { return m_styleColor; }
protected:
- QColor m_styleColor;
+ QVector4D m_styleColor;
};
class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldOutlineTextMaterial : public QSGDistanceFieldStyledTextMaterial
@@ -130,7 +130,7 @@ class Q_QUICK_PRIVATE_EXPORT QSGHiQSubPixelDistanceFieldTextMaterial : public QS
public:
virtual QSGMaterialType *type() const;
virtual QSGMaterialShader *createShader() const;
- void setColor(const QColor &color) { m_color = color; }
+ void setColor(const QColor &color) { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
};
class Q_QUICK_PRIVATE_EXPORT QSGLoQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
@@ -138,7 +138,7 @@ class Q_QUICK_PRIVATE_EXPORT QSGLoQSubPixelDistanceFieldTextMaterial : public QS
public:
virtual QSGMaterialType *type() const;
virtual QSGMaterialShader *createShader() const;
- void setColor(const QColor &color) { m_color = color; }
+ void setColor(const QColor &color) { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 33a99d1506..e099d94a53 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -41,6 +41,7 @@
#include "qsgrenderloop_p.h"
#include "qsgthreadedrenderloop_p.h"
+#include "qsgwindowsrenderloop_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QTime>
@@ -55,6 +56,7 @@
#include <QtQuick/QQuickWindow>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qsgcontext_p.h>
+#include <private/qqmlprofilerservice_p.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +82,7 @@ QSGRenderLoop::~QSGRenderLoop()
{
}
-class QSGGuiThreadRenderLoop : public QObject, public QSGRenderLoop
+class QSGGuiThreadRenderLoop : public QSGRenderLoop
{
Q_OBJECT
public:
@@ -130,15 +132,6 @@ QSGRenderLoop *QSGRenderLoop::instance()
s_instance = QSGContext::createWindowManager();
bool bufferQueuing = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::BufferQueueingOpenGL);
-#ifdef Q_OS_WIN
- bool fancy = false; // QTBUG-28037
-#else
- bool fancy = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL);
-#endif
- if (qmlNoThreadedRenderer())
- fancy = false;
- else if (qmlForceThreadedRenderer())
- fancy = true;
// Enable fixed animation steps...
QByteArray fixed = qgetenv("QML_FIXED_ANIMATION_STEP");
@@ -151,9 +144,45 @@ QSGRenderLoop *QSGRenderLoop::instance()
QUnifiedTimer::instance(true)->setConsistentTiming(true);
if (!s_instance) {
- s_instance = fancy
- ? (QSGRenderLoop*) new QSGThreadedRenderLoop
- : (QSGRenderLoop*) new QSGGuiThreadRenderLoop;
+
+ enum RenderLoopType {
+ BasicRenderLoop,
+ ThreadedRenderLoop,
+ WindowsRenderLoop
+ };
+
+ RenderLoopType loopType = BasicRenderLoop;
+
+#ifdef Q_OS_WIN
+ loopType = WindowsRenderLoop;
+#else
+ if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL))
+ loopType = ThreadedRenderLoop;
+#endif
+ if (qmlNoThreadedRenderer())
+ loopType = BasicRenderLoop;
+ else if (qmlForceThreadedRenderer())
+ loopType = ThreadedRenderLoop;
+
+ const QByteArray loopName = qgetenv("QSG_RENDER_LOOP");
+ if (loopName == QByteArrayLiteral("windows"))
+ loopType = WindowsRenderLoop;
+ else if (loopName == QByteArrayLiteral("basic"))
+ loopType = BasicRenderLoop;
+ else if (loopName == QByteArrayLiteral("threaded"))
+ loopType = ThreadedRenderLoop;
+
+ switch (loopType) {
+ case ThreadedRenderLoop:
+ s_instance = new QSGThreadedRenderLoop();
+ break;
+ case WindowsRenderLoop:
+ s_instance = new QSGWindowsRenderLoop();
+ break;
+ default:
+ s_instance = new QSGGuiThreadRenderLoop();
+ break;
+ }
}
}
return s_instance;
@@ -215,49 +244,25 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
{
- bool renderWithoutShowing = QQuickWindowPrivate::get(window)->renderWithoutShowing;
- if ((!window->isExposed() && !renderWithoutShowing) || !m_windows.contains(window))
+ if (!QQuickWindowPrivate::get(window)->isRenderable() || !m_windows.contains(window))
return;
WindowData &data = const_cast<WindowData &>(m_windows[window]);
- QQuickWindow *masterWindow = 0;
- if (!window->isVisible() && !renderWithoutShowing) {
- // Find a "proper surface" to bind...
- for (QHash<QQuickWindow *, WindowData>::const_iterator it = m_windows.constBegin();
- it != m_windows.constEnd() && !masterWindow; ++it) {
- if (it.key()->isVisible())
- masterWindow = it.key();
- }
- } else {
- masterWindow = window;
- }
-
- if (!masterWindow)
- return;
-
- if (!QQuickWindowPrivate::get(masterWindow)->isRenderable()) {
- qWarning().nospace()
- << "Unable to find a renderable master window "
- << masterWindow << "when trying to render"
- << window << " (" << window->geometry() << ").";
- return;
- }
-
bool current = false;
if (!gl) {
gl = new QOpenGLContext();
- gl->setFormat(masterWindow->requestedFormat());
+ gl->setFormat(window->requestedFormat());
if (!gl->create()) {
delete gl;
gl = 0;
}
- current = gl->makeCurrent(masterWindow);
+ current = gl->makeCurrent(window);
if (current)
sg->initialize(gl);
} else {
- current = gl->makeCurrent(masterWindow);
+ current = gl->makeCurrent(window);
}
bool alsoSwap = data.updatePending;
@@ -269,20 +274,21 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
cd->polishItems();
- int renderTime = 0, syncTime = 0;
- QTime renderTimer;
- if (qsg_render_timing())
+ qint64 renderTime = 0, syncTime = 0;
+ QElapsedTimer renderTimer;
+ bool profileFrames = qsg_render_timing() || QQmlProfilerService::enabled;
+ if (profileFrames)
renderTimer.start();
cd->syncSceneGraph();
- if (qsg_render_timing())
- syncTime = renderTimer.elapsed();
+ if (profileFrames)
+ syncTime = renderTimer.nsecsElapsed();
cd->renderSceneGraph(window->size());
- if (qsg_render_timing())
- renderTime = renderTimer.elapsed() - syncTime;
+ if (profileFrames)
+ renderTime = renderTimer.nsecsElapsed() - syncTime;
if (data.grabOnly) {
grabContent = qt_gl_read_framebuffer(window->size(), false, false);
@@ -294,17 +300,29 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
cd->fireFrameSwapped();
}
+ qint64 swapTime = 0;
+ if (profileFrames) {
+ swapTime = renderTimer.nsecsElapsed() - renderTime - syncTime;
+ }
+
if (qsg_render_timing()) {
static QTime lastFrameTime = QTime::currentTime();
- const int swapTime = renderTimer.elapsed() - renderTime - syncTime;
- qDebug() << "- Breakdown of frame time; sync:" << syncTime
- << "ms render:" << renderTime << "ms swap:" << swapTime
- << "ms total:" << swapTime + renderTime + syncTime
+ qDebug() << "- Breakdown of frame time; sync:" << syncTime/1000000
+ << "ms render:" << renderTime/1000000 << "ms swap:" << swapTime/1000000
+ << "ms total:" << (swapTime + renderTime + syncTime)/1000000
<< "ms time since last frame:" << (lastFrameTime.msecsTo(QTime::currentTime()))
<< "ms";
lastFrameTime = QTime::currentTime();
}
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRenderLoopFrame,
+ syncTime,
+ renderTime,
+ swapTime);
+ }
+
// Might have been set during syncSceneGraph()
if (data.updatePending)
maybeUpdate(window);
diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h
index b18e6f00ad..6ff9c4c5f9 100644
--- a/src/quick/scenegraph/qsgrenderloop_p.h
+++ b/src/quick/scenegraph/qsgrenderloop_p.h
@@ -51,8 +51,10 @@ class QQuickWindow;
class QSGContext;
class QAnimationDriver;
-class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop
+class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop : public QObject
{
+ Q_OBJECT
+
public:
virtual ~QSGRenderLoop();
@@ -77,6 +79,11 @@ public:
static QSGRenderLoop *instance();
static void setInstance(QSGRenderLoop *instance);
+ virtual bool interleaveIncubation() const { return false; }
+
+signals:
+ void timeToIncubate();
+
private:
static QSGRenderLoop *s_instance;
};
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index b01d816661..3ab7d2fb30 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -56,6 +56,8 @@
#include "qsgthreadedrenderloop_p.h"
+#include <private/qqmlprofilerservice_p.h>
+
/*
Overall design:
@@ -139,10 +141,10 @@ static inline int qsgrl_animation_interval() {
#ifndef QSG_NO_RENDER_TIMING
static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
-static QTime threadTimer;
-static int syncTime;
-static int renderTime;
-static int sinceLastTime;
+static QElapsedTimer threadTimer;
+static qint64 syncTime;
+static qint64 renderTime;
+static qint64 sinceLastTime;
#endif
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
@@ -329,9 +331,9 @@ public:
QEventLoop eventLoop;
- uint pendingUpdate : 2;
- uint sleeping : 1;
- uint syncResultedInChanges : 1;
+ uint pendingUpdate;
+ uint sleeping;
+ uint syncResultedInChanges;
volatile bool guiIsLocked;
volatile bool shouldExit;
@@ -516,7 +518,6 @@ void QSGRenderThread::sync()
mutex.lock();
Q_ASSERT_X(guiIsLocked, "QSGRenderThread::sync()", "sync triggered on bad terms as gui is not already locked...");
- pendingUpdate = 0;
for (int i=0; i<m_windows.size(); ++i) {
Window &w = const_cast<Window &>(m_windows.at(i));
@@ -547,8 +548,11 @@ void QSGRenderThread::sync()
void QSGRenderThread::syncAndRender()
{
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- sinceLastTime = threadTimer.restart();
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames) {
+ sinceLastTime = threadTimer.nsecsElapsed();
+ threadTimer.start();
+ }
#endif
QElapsedTimer waitTimer;
waitTimer.start();
@@ -558,8 +562,10 @@ void QSGRenderThread::syncAndRender()
syncResultedInChanges = false;
bool repaintRequested = pendingUpdate & RepaintRequest;
+ bool syncRequested = pendingUpdate & SyncRequest;
+ pendingUpdate = 0;
- if (pendingUpdate & SyncRequest) {
+ if (syncRequested) {
RLDEBUG(" Render: - update pending, doing sync");
sync();
}
@@ -569,12 +575,13 @@ void QSGRenderThread::syncAndRender()
int waitTime = vsyncDelta - (int) waitTimer.elapsed();
if (waitTime > 0)
msleep(waitTime);
+ emit wm->timeToIncubate();
return;
}
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- syncTime = threadTimer.elapsed();
+ if (profileFrames)
+ syncTime = threadTimer.nsecsElapsed();
#endif
RLDEBUG(" Render: - rendering starting");
@@ -588,21 +595,30 @@ void QSGRenderThread::syncAndRender()
gl->makeCurrent(w.window);
d->renderSceneGraph(w.size);
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing && i == 0)
- renderTime = threadTimer.elapsed();
+ if (profileFrames && i == 0)
+ renderTime = threadTimer.nsecsElapsed();
#endif
gl->swapBuffers(w.window);
d->fireFrameSwapped();
}
RLDEBUG(" Render: - rendering done");
+ emit wm->timeToIncubate();
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing)
qDebug("window Time: sinceLast=%d, sync=%d, first render=%d, after final swap=%d",
- sinceLastTime,
- syncTime,
- renderTime - syncTime,
- threadTimer.elapsed() - renderTime);
+ int(sinceLastTime/1000000),
+ int(syncTime/1000000),
+ int((renderTime - syncTime)/1000000),
+ int(threadTimer.elapsed() - renderTime/1000000));
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRenderLoopFrame,
+ syncTime,
+ renderTime - syncTime,
+ threadTimer.nsecsElapsed() - renderTime);
+ }
#endif
}
@@ -710,7 +726,7 @@ QSGContext *QSGThreadedRenderLoop::sceneGraphContext() const
return m_thread->sg;
}
-bool QSGThreadedRenderLoop::anyoneShowing()
+bool QSGThreadedRenderLoop::anyoneShowing() const
{
for (int i=0; i<m_windows.size(); ++i) {
QQuickWindow *c = m_windows.at(i).window;
@@ -720,6 +736,11 @@ bool QSGThreadedRenderLoop::anyoneShowing()
return false;
}
+bool QSGThreadedRenderLoop::interleaveIncubation() const
+{
+ return m_animation_driver->isRunning() && anyoneShowing();
+}
+
void QSGThreadedRenderLoop::animationStarted()
{
RLDEBUG("GUI: animationStarted()");
@@ -950,10 +971,11 @@ void QSGThreadedRenderLoop::polishAndSync()
#ifndef QSG_NO_RENDER_TIMING
QElapsedTimer timer;
- int polishTime = 0;
- int waitTime = 0;
- int syncTime;
- if (qsg_render_timing)
+ qint64 polishTime = 0;
+ qint64 waitTime = 0;
+ qint64 syncTime = 0;
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
timer.start();
#endif
@@ -964,8 +986,8 @@ void QSGThreadedRenderLoop::polishAndSync()
d->polishItems();
}
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- polishTime = timer.elapsed();
+ if (profileFrames)
+ polishTime = timer.nsecsElapsed();
#endif
m_sync_triggered_update = false;
@@ -977,8 +999,8 @@ void QSGThreadedRenderLoop::polishAndSync()
RLDEBUG("GUI: - wait for sync...");
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- waitTime = timer.elapsed();
+ if (profileFrames)
+ waitTime = timer.nsecsElapsed();
#endif
m_thread->waitCondition.wait(&m_thread->mutex);
m_thread->guiIsLocked = false;
@@ -986,8 +1008,8 @@ void QSGThreadedRenderLoop::polishAndSync()
RLDEBUG("GUI: - unlocked after sync...");
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- syncTime = timer.elapsed();
+ if (profileFrames)
+ syncTime = timer.nsecsElapsed();
#endif
killTimer(m_update_timer);
@@ -997,7 +1019,6 @@ void QSGThreadedRenderLoop::polishAndSync()
RLDEBUG("GUI: - animations advancing");
m_animation_driver->advance();
RLDEBUG("GUI: - animations done");
-
// We need to trigger another sync to keep animations running...
maybePostPolishRequest();
} else if (m_sync_triggered_update) {
@@ -1006,7 +1027,20 @@ void QSGThreadedRenderLoop::polishAndSync()
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing)
- qDebug(" - polish=%d, wait=%d, sync=%d -- animations=%d", polishTime, waitTime - polishTime, syncTime - waitTime, int(timer.elapsed() - syncTime));
+ qDebug(" - polish=%d, wait=%d, sync=%d -- animations=%d",
+ int(polishTime/1000000),
+ int((waitTime - polishTime)/1000000),
+ int((syncTime - waitTime)/1000000),
+ int((timer.nsecsElapsed() - syncTime)/1000000));
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphPolishAndSync,
+ polishTime,
+ waitTime - polishTime,
+ syncTime - waitTime,
+ timer.nsecsElapsed() - syncTime);
+ }
#endif
}
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
index aab0e8726f..6ff5cabf43 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h
+++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
class QSGRenderThread;
-class QSGThreadedRenderLoop : public QObject, public QSGRenderLoop
+class QSGThreadedRenderLoop : public QSGRenderLoop
{
Q_OBJECT
public:
@@ -79,7 +79,7 @@ public:
bool event(QEvent *);
- void wakeup();
+ bool interleaveIncubation() const;
public slots:
void animationStarted();
@@ -91,7 +91,7 @@ private:
void releaseResources(QQuickWindow *window, bool inDestructor);
bool checkAndResetForceUpdate(QQuickWindow *window);
- bool anyoneShowing();
+ bool anyoneShowing() const;
void initialize();
void maybePostPolishRequest();
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
new file mode 100644
index 0000000000..8e97f65ea5
--- /dev/null
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -0,0 +1,469 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsgwindowsrenderloop_p.h"
+
+#include <QtCore/QCoreApplication>
+
+#include <QtGui/QScreen>
+#include <QtGui/QGuiApplication>
+
+#include <QtQuick/private/qsgcontext_p.h>
+#include <QtQuick/private/qquickwindow_p.h>
+
+#include <QtQuick/QQuickWindow>
+
+#include <private/qqmlprofilerservice_p.h>
+
+QT_BEGIN_NAMESPACE
+
+extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
+
+// #define QSG_RENDER_LOOP_DEBUG
+
+#ifdef QSG_RENDER_LOOP_DEBUG
+static QElapsedTimer qsg_debug_timer;
+# define RLDEBUG(x) printf("(%6d) %s : %4d - %s\n", (int) qsg_debug_timer.elapsed(), __FILE__, __LINE__, x)
+#else
+# define RLDEBUG(x)
+#endif
+
+#ifndef QSG_NO_RENDER_TIMING
+static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
+static QElapsedTimer qsg_render_timer;
+#define QSG_RENDER_TIMING_SAMPLE(sampleName) qint64 sampleName = 0; if (qsg_render_timing || QQmlProfilerService::enabled) sampleName = qsg_render_timer.nsecsElapsed()
+#else
+#define QSG_RENDER_TIMING_SAMPLE(sampleName)
+#endif
+
+
+QSGWindowsRenderLoop::QSGWindowsRenderLoop()
+ : m_gl(0)
+ , m_sg(QSGContext::createDefaultContext())
+ , m_updateTimer(0)
+ , m_animationTimer(0)
+{
+#ifdef QSG_RENDER_LOOP_DEBUG
+ qsg_debug_timer.start();
+#endif
+
+ m_animationDriver = m_sg->createAnimationDriver(m_sg);
+ m_animationDriver->install();
+
+ connect(m_animationDriver, SIGNAL(started()), this, SLOT(started()));
+ connect(m_animationDriver, SIGNAL(stopped()), this, SLOT(stopped()));
+
+ m_vsyncDelta = 1000 / QGuiApplication::primaryScreen()->refreshRate();
+ if (m_vsyncDelta <= 0)
+ m_vsyncDelta = 16;
+
+ RLDEBUG("Windows Render Loop created");
+
+#ifndef QSG_NO_RENDER_TIMIMG
+ qsg_render_timer.start();
+#endif
+}
+
+bool QSGWindowsRenderLoop::interleaveIncubation() const
+{
+ return m_animationDriver->isRunning() && anyoneShowing();
+}
+
+QSGWindowsRenderLoop::WindowData *QSGWindowsRenderLoop::windowData(QQuickWindow *window)
+{
+ for (int i=0; i<m_windows.size(); ++i) {
+ WindowData &wd = m_windows[i];
+ if (wd.window == window)
+ return &wd;
+ }
+ return 0;
+}
+
+void QSGWindowsRenderLoop::maybePostUpdateTimer()
+{
+ if (!m_updateTimer) {
+ RLDEBUG(" - posting event");
+ m_updateTimer = startTimer(m_vsyncDelta / 3);
+ }
+}
+
+/*
+ * If no windows are showing, start ticking animations using a timer,
+ * otherwise, start rendering
+ */
+void QSGWindowsRenderLoop::started()
+{
+ RLDEBUG("Animations started...");
+ if (!anyoneShowing()) {
+ if (m_animationTimer == 0) {
+ RLDEBUG(" - starting non-visual animation timer");
+ m_animationTimer = startTimer(m_vsyncDelta);
+ }
+ } else {
+ maybePostUpdateTimer();
+ }
+}
+
+void QSGWindowsRenderLoop::stopped()
+{
+ RLDEBUG("Animations stopped...");
+ if (m_animationTimer) {
+ RLDEBUG(" - stopping non-visual animation timer");
+ killTimer(m_animationTimer);
+ m_animationTimer = 0;
+ }
+}
+
+void QSGWindowsRenderLoop::show(QQuickWindow *window)
+{
+ RLDEBUG("show");
+ if (windowData(window) != 0)
+ return;
+
+ // This happens before the platform window is shown, but after
+ // it is created. Creating the GL context takes a lot of time
+ // (hundreds of milliseconds) and will prevent us from rendering
+ // the first frame in time for the initial show on screen.
+ // By preparing the GL context here, it is feasible (if the app
+ // is quick enough) to have a perfect first frame.
+ if (!m_gl) {
+ QSG_RENDER_TIMING_SAMPLE(time_start);
+
+ RLDEBUG(" - creating GL context");
+ m_gl = new QOpenGLContext();
+ m_gl->setFormat(window->requestedFormat());
+ m_gl->create();
+ QSG_RENDER_TIMING_SAMPLE(time_created);
+ RLDEBUG(" - making current");
+ m_gl->makeCurrent(window);
+ RLDEBUG(" - initializing SG");
+ QSG_RENDER_TIMING_SAMPLE(time_current);
+ m_sg->initialize(m_gl);
+
+#ifndef QSG_NO_RENDER_TIMING
+ if (qsg_render_timing) {
+ qDebug("WindowsRenderLoop: GL=%d ms, makeCurrent=%d ms, SG=%d ms",
+ int((time_created - time_start)/1000000),
+ int((time_current - time_created)/1000000),
+ int((qsg_render_timer.nsecsElapsed() - time_current)/1000000));
+ }
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphWindowsRenderShow,
+ time_created - time_start,
+ time_current - time_created,
+ qsg_render_timer.nsecsElapsed() - time_current);
+ }
+#endif
+
+ }
+
+ WindowData data;
+ data.window = window;
+ data.pendingUpdate = false;
+ m_windows << data;
+
+ RLDEBUG(" - done with show");
+}
+
+void QSGWindowsRenderLoop::hide(QQuickWindow *window)
+{
+ RLDEBUG("hide");
+
+ for (int i=0; i<m_windows.size(); ++i) {
+ if (m_windows.at(i).window == window) {
+ m_windows.removeAt(i);
+ break;
+ }
+ }
+
+ // The expose event is queued while hide is sent synchronously, so
+ // the value might not be updated yet. (plus that the windows plugin
+ // sends exposed=true when it goes to hidden, so it is doubly broken)
+ // The check is made here, after the removal from m_windows, so
+ // anyoneShowing will report the right value.
+ if (window->isExposed())
+ handleObscurity();
+
+ QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
+ cd->cleanupNodesOnShutdown();
+
+ // If this is the last tracked window, check for persistent SG and GL and
+ // potentially clean up.
+ if (m_windows.size() == 0) {
+ if (!cd->persistentSceneGraph) {
+ m_sg->invalidate();
+ if (!cd->persistentGLContext) {
+ delete m_gl;
+ m_gl = 0;
+ }
+ }
+ }
+}
+
+void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
+{
+ RLDEBUG("windowDestroyed");
+ hide(window);
+
+ // If this is the last tracked window, clean up SG and GL.
+ if (m_windows.size() == 0) {
+ m_sg->invalidate();
+ delete m_gl;
+ m_gl = 0;
+ }
+}
+
+bool QSGWindowsRenderLoop::anyoneShowing() const
+{
+ foreach (const WindowData &wd, m_windows)
+ if (wd.window->isExposed() && wd.window->size().isValid())
+ return true;
+ return false;
+}
+
+void QSGWindowsRenderLoop::exposureChanged(QQuickWindow *window)
+{
+
+ if (windowData(window) == 0)
+ return;
+
+ if (window->isExposed()) {
+
+ // Stop non-visual animation timer as we now have a window rendering
+ if (m_animationTimer && anyoneShowing()) {
+ RLDEBUG(" - stopping non-visual animation timer");
+ killTimer(m_animationTimer);
+ m_animationTimer = 0;
+ }
+
+ RLDEBUG("exposureChanged - exposed");
+ WindowData *wd = windowData(window);
+ wd->pendingUpdate = true;
+
+ // If we have a pending timer and we get an expose, we need to stop it.
+ // Otherwise we get two frames and two animation ticks in the same time-interval.
+ if (m_updateTimer) {
+ RLDEBUG(" - killing pending update timer");
+ killTimer(m_updateTimer);
+ m_updateTimer = 0;
+ }
+ render();
+ } else {
+ handleObscurity();
+ }
+}
+
+void QSGWindowsRenderLoop::handleObscurity()
+{
+ RLDEBUG("handleObscurity");
+ // Potentially start the non-visual animation timer if nobody is rendering
+ if (m_animationDriver->isRunning() && !anyoneShowing() && !m_animationTimer) {
+ RLDEBUG(" - starting non-visual animation timer");
+ m_animationTimer = startTimer(m_vsyncDelta);
+ }
+}
+
+QImage QSGWindowsRenderLoop::grab(QQuickWindow *window)
+{
+ RLDEBUG("grab");
+ if (!m_gl)
+ return QImage();
+
+ m_gl->makeCurrent(window);
+
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+ d->polishItems();
+ d->syncSceneGraph();
+ d->renderSceneGraph(window->size());
+
+ QImage image = qt_gl_read_framebuffer(window->size(), false, false);
+ return image;
+}
+
+void QSGWindowsRenderLoop::update(QQuickWindow *window)
+{
+ RLDEBUG("update");
+ maybeUpdate(window);
+}
+
+void QSGWindowsRenderLoop::maybeUpdate(QQuickWindow *window)
+{
+ RLDEBUG("maybeUpdate");
+
+ WindowData *wd = windowData(window);
+ if (!wd || !anyoneShowing())
+ return;
+
+ wd->pendingUpdate = true;
+ maybePostUpdateTimer();
+}
+
+bool QSGWindowsRenderLoop::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::Timer: {
+ QTimerEvent *te = static_cast<QTimerEvent *>(event);
+ if (te->timerId() == m_animationTimer) {
+ RLDEBUG("event : animation tick while nothing is showing");
+ m_animationDriver->advance();
+ } else if (te->timerId() == m_updateTimer) {
+ RLDEBUG("event : update");
+ killTimer(m_updateTimer);
+ m_updateTimer = 0;
+ render();
+ }
+ return true; }
+ default:
+ break;
+ }
+
+ return QObject::event(event);
+}
+
+/*
+ * Go through all windows we control and render them in turn.
+ * Then tick animations if active.
+ */
+void QSGWindowsRenderLoop::render()
+{
+ RLDEBUG("render");
+ foreach (const WindowData &wd, m_windows) {
+ if (wd.pendingUpdate) {
+ const_cast<WindowData &>(wd).pendingUpdate = false;
+ renderWindow(wd.window);
+ }
+ }
+
+ if (m_animationDriver->isRunning()) {
+ RLDEBUG("advancing animations");
+ QSG_RENDER_TIMING_SAMPLE(time_start);
+ m_animationDriver->advance();
+ RLDEBUG("animations advanced");
+
+#ifndef QSG_NO_RENDER_TIMING
+ if (qsg_render_timing) {
+ qDebug("WindowsRenderLoop: animations=%d ms",
+ int((qsg_render_timer.nsecsElapsed() - time_start)/1000000));
+ }
+ if (QQmlProfilerService::Enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphWindowsAnimations,
+ qsg_render_timer.nsecsElapsed() - time_start);
+ }
+#endif
+
+ // It is not given that animations triggered another maybeUpdate()
+ // and thus another render pass, so to keep things running,
+ // make sure there is another frame pending.
+ maybePostUpdateTimer();
+
+ emit timeToIncubate();
+ }
+}
+
+/*
+ * Render the contents of this window. First polish, then sync, render
+ * then finally swap.
+ *
+ * Note: This render function does not implement aborting
+ * the render call when sync step results in no scene graph changes,
+ * like the threaded renderer does.
+ */
+void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
+{
+ RLDEBUG("renderWindow");
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+
+ if (!d->isRenderable())
+ return;
+
+ if (!m_gl->makeCurrent(window))
+ return;
+
+ QSG_RENDER_TIMING_SAMPLE(time_start);
+
+ RLDEBUG(" - polishing");
+ d->polishItems();
+ QSG_RENDER_TIMING_SAMPLE(time_polished);
+
+ RLDEBUG(" - syncing");
+ d->syncSceneGraph();
+ QSG_RENDER_TIMING_SAMPLE(time_synced);
+
+ RLDEBUG(" - rendering");
+ d->renderSceneGraph(window->size());
+ QSG_RENDER_TIMING_SAMPLE(time_rendered);
+
+ RLDEBUG(" - swapping");
+ m_gl->swapBuffers(window);
+ QSG_RENDER_TIMING_SAMPLE(time_swapped);
+
+ RLDEBUG(" - frameDone");
+ d->fireFrameSwapped();
+
+#ifndef QSG_NO_RENDER_TIMING
+ if (qsg_render_timing) {
+ qDebug("WindowsRenderLoop(t=%d): window=%p, polish=%d ms, sync=%d ms, render=%d ms, swap=%d ms",
+ int(qsg_render_timer.elapsed()),
+ window,
+ int((time_polished - time_start)/1000000),
+ int((time_synced - time_polished)/1000000),
+ int((time_rendered - time_synced)/1000000),
+ int((time_swapped - time_rendered)/1000000));
+ }
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphWindowsPolishFrame,
+ time_polished - time_start
+ );
+
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRenderLoopFrame,
+ time_synced - time_polished,
+ time_rendered - time_synced,
+ time_swapped - time_rendered
+ );
+ }
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop_p.h b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
new file mode 100644
index 0000000000..218e18c3e2
--- /dev/null
+++ b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSGWINDOWSRENDERLOOP_P_H
+#define QSGWINDOWSRENDERLOOP_P_H
+
+#include <QtCore/QObject>
+#include <QtCore/QElapsedTimer>
+
+#include <QtGui/QOpenGLContext>
+
+#include "qsgrenderloop_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QSGWindowsRenderLoop : public QSGRenderLoop
+{
+ Q_OBJECT
+public:
+ explicit QSGWindowsRenderLoop();
+
+ void show(QQuickWindow *window);
+ void hide(QQuickWindow *window);
+
+ void windowDestroyed(QQuickWindow *window);
+
+ void exposureChanged(QQuickWindow *window);
+ QImage grab(QQuickWindow *window);
+
+ void update(QQuickWindow *window);
+ void maybeUpdate(QQuickWindow *window);
+
+ QAnimationDriver *animationDriver() const { return m_animationDriver; }
+
+ QSGContext *sceneGraphContext() const { return m_sg; }
+
+ void releaseResources(QQuickWindow *) { }
+
+ void render();
+ void renderWindow(QQuickWindow *window);
+
+ void resize(QQuickWindow *, const QSize &) { }
+
+ bool event(QEvent *event);
+ bool anyoneShowing() const;
+
+ bool interleaveIncubation() const;
+
+public slots:
+ void started();
+ void stopped();
+
+private:
+ struct WindowData {
+ QQuickWindow *window;
+ bool pendingUpdate;
+ };
+
+ void handleObscurity();
+ void maybePostUpdateTimer();
+ WindowData *windowData(QQuickWindow *window);
+
+ QList<WindowData> m_windows;
+
+ QOpenGLContext *m_gl;
+ QSGContext *m_sg;
+
+ QAnimationDriver *m_animationDriver;
+
+ int m_updateTimer;
+ int m_animationTimer;
+
+ int m_vsyncDelta;
+};
+
+QT_END_NAMESPACE
+
+#endif // QSGWINDOWSRENDERLOOP_P_H
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index 8c87e23ac9..34432ffd9c 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -6,6 +6,7 @@ HEADERS += \
$$PWD/coreapi/qsggeometry.h \
$$PWD/coreapi/qsgmaterial.h \
$$PWD/coreapi/qsgnode.h \
+ $$PWD/coreapi/qsgnode_p.h \
$$PWD/coreapi/qsgnodeupdater_p.h \
$$PWD/coreapi/qsgrenderer_p.h \
$$PWD/coreapi/qsgrendernode_p.h \
@@ -51,7 +52,6 @@ SOURCES += \
$$PWD/util/qsgpainternode.cpp \
$$PWD/util/qsgdistancefieldutil.cpp
-
# QML / Adaptations API
HEADERS += \
$$PWD/qsgadaptationlayer_p.h \
@@ -67,8 +67,8 @@ HEADERS += \
$$PWD/qsgflashnode_p.h \
$$PWD/qsgshareddistancefieldglyphcache_p.h \
$$PWD/qsgrenderloop_p.h \
- $$PWD/qsgthreadedrenderloop_p.h
-
+ $$PWD/qsgthreadedrenderloop_p.h \
+ $$PWD/qsgwindowsrenderloop_p.h
SOURCES += \
$$PWD/qsgadaptationlayer.cpp \
@@ -84,12 +84,5 @@ SOURCES += \
$$PWD/qsgflashnode.cpp \
$$PWD/qsgshareddistancefieldglyphcache.cpp \
$$PWD/qsgrenderloop.cpp \
- $$PWD/qsgthreadedrenderloop.cpp
-
-
-
-
-
-
-
-
+ $$PWD/qsgthreadedrenderloop.cpp \
+ $$PWD/qsgwindowsrenderloop.cpp
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
index 307201277c..09e2a7da27 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
@@ -74,11 +74,11 @@ void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial
const QColor &c = newMaterial->color();
if (oldMaterial == 0 || c != oldMaterial->color() || state.isOpacityDirty()) {
- float opacity = state.opacity();
- QVector4D v(c.redF() * c.alphaF() * opacity,
- c.greenF() * c.alphaF() * opacity,
- c.blueF() * c.alphaF() * opacity,
- c.alphaF() * opacity);
+ float opacity = state.opacity() * c.alphaF();
+ QVector4D v(c.redF() * opacity,
+ c.greenF() * opacity,
+ c.blueF() * opacity,
+ opacity);
program()->setUniformValue(m_color_id, v);
}
diff --git a/src/quick/scenegraph/util/qsgpainternode.cpp b/src/quick/scenegraph/util/qsgpainternode.cpp
index e5cf6b8295..97b3500ad0 100644
--- a/src/quick/scenegraph/util/qsgpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgpainternode.cpp
@@ -73,10 +73,6 @@ QSGPainterTexture::QSGPainterTexture()
m_retain_image = true;
}
-#ifdef QT_OPENGL_ES
-extern void qsg_swizzleBGRAToRGBA(QImage *image);
-#endif
-
void QSGPainterTexture::bind()
{
if (m_dirty_rect.isNull()) {
@@ -84,33 +80,8 @@ void QSGPainterTexture::bind()
return;
}
- bool oldMipmapsGenerated = m_mipmaps_generated;
- m_mipmaps_generated = true;
+ setImage(m_image);
QSGPlainTexture::bind();
- m_mipmaps_generated = oldMipmapsGenerated;
-
- QImage subImage = m_image.copy(m_dirty_rect);
-
- int w = m_dirty_rect.width();
- int h = m_dirty_rect.height();
-
-#ifdef QT_OPENGL_ES
- qsg_swizzleBGRAToRGBA(&subImage);
- glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
- GL_RGBA, GL_UNSIGNED_BYTE, subImage.constBits());
-#else
- glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
- GL_BGRA, GL_UNSIGNED_BYTE, subImage.constBits());
-#endif
-
- if (m_has_mipmaps && !m_mipmaps_generated) {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
- m_mipmaps_generated = true;
- }
-
- m_dirty_texture = false;
- m_dirty_bind_options = false;
m_dirty_rect = QRect();
}
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
index 318120e4bf..86e0d36f6c 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
@@ -41,18 +41,44 @@
#include "qsgsimpletexturenode.h"
+#include <private/qsgnode_p.h>
QT_BEGIN_NAMESPACE
+class QSGSimpleTextureNodePrivate : public QSGGeometryNodePrivate
+{
+public:
+ QSGSimpleTextureNodePrivate()
+ : QSGGeometryNodePrivate()
+ , m_texCoordMode(QSGSimpleTextureNode::NoTransform)
+ {}
+
+ QSGSimpleTextureNode::TextureCoordinatesTransformMode m_texCoordMode;
+};
+
static void qsgsimpletexturenode_update(QSGGeometry *g,
QSGTexture *texture,
- const QRectF &rect)
+ const QRectF &rect,
+ QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode)
{
if (!texture)
return;
QSize ts = texture->textureSize();
QRectF sourceRect(0, 0, ts.width(), ts.height());
+
+ // Maybe transform the texture coordinates
+ if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorHorizontally)) {
+ float tmp = sourceRect.left();
+ sourceRect.setLeft(sourceRect.right());
+ sourceRect.setRight(tmp);
+ }
+ if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorVertically)) {
+ float tmp = sourceRect.top();
+ sourceRect.setTop(sourceRect.bottom());
+ sourceRect.setBottom(tmp);
+ }
+
QSGGeometry::updateTexturedRectGeometry(g, rect, texture->convertToNormalizedSourceRect(sourceRect));
}
@@ -71,7 +97,8 @@ static void qsgsimpletexturenode_update(QSGGeometry *g,
Constructs a new simple texture node
*/
QSGSimpleTextureNode::QSGSimpleTextureNode()
- : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
+ : QSGGeometryNode(*new QSGSimpleTextureNodePrivate)
+ , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
{
setGeometry(&m_geometry);
setMaterial(&m_material);
@@ -112,7 +139,8 @@ void QSGSimpleTextureNode::setRect(const QRectF &r)
if (m_rect == r)
return;
m_rect = r;
- qsgsimpletexturenode_update(&m_geometry, texture(), m_rect);
+ Q_D(QSGSimpleTextureNode);
+ qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->m_texCoordMode);
markDirty(DirtyGeometry);
}
@@ -144,7 +172,8 @@ void QSGSimpleTextureNode::setTexture(QSGTexture *texture)
return;
m_material.setTexture(texture);
m_opaque_material.setTexture(texture);
- qsgsimpletexturenode_update(&m_geometry, texture, m_rect);
+ Q_D(QSGSimpleTextureNode);
+ qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->m_texCoordMode);
markDirty(DirtyMaterial);
}
@@ -158,4 +187,48 @@ QSGTexture *QSGSimpleTextureNode::texture() const
return m_material.texture();
}
+/*!
+ \enum QSGSimpleTextureNode::TextureCoordinatesTransformFlag
+
+ The TextureCoordinatesTransformFlag enum is used to specify the
+ mode used to generate texture coordinates for a textured quad.
+
+ \value NoTransform Texture coordinates are oriented with window coordinates
+ i.e. with origin at top-left.
+
+ \value MirrorHorizontally Texture coordinates are inverted in the horizontal axis with
+ respect to window coordinates
+
+ \value MirrorVertically Texture coordinates are inverted in the vertical axis with
+ respect to window coordinates
+ */
+
+/*!
+ Sets the method used to generate texture coordinates to \a mode. This can be used to obtain
+ correct orientation of the texture. This is commonly needed when using a third party OpenGL
+ library to render to texture as OpenGL has an inverted y-axis relative to Qt Quick.
+
+ \sa textureCoordinatesTransform()
+ */
+void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode)
+{
+ Q_D(QSGSimpleTextureNode);
+ if (d->m_texCoordMode == mode)
+ return;
+ d->m_texCoordMode = mode;
+ qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->m_texCoordMode);
+ markDirty(DirtyMaterial);
+}
+
+/*!
+ Returns the mode used to generate texture coordinates for this node.
+
+ \sa setTextureCoordinatesTransform()
+ */
+QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const
+{
+ Q_D(const QSGSimpleTextureNode);
+ return d->m_texCoordMode;
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.h b/src/quick/scenegraph/util/qsgsimpletexturenode.h
index ffd10210ae..f5ab7fb3bb 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.h
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.h
@@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
+class QSGSimpleTextureNodePrivate;
+
class Q_QUICK_EXPORT QSGSimpleTextureNode : public QSGGeometryNode
{
public:
@@ -63,14 +65,28 @@ public:
void setFiltering(QSGTexture::Filtering filtering);
QSGTexture::Filtering filtering() const;
+ enum TextureCoordinatesTransformFlag {
+ NoTransform = 0x00,
+ MirrorHorizontally = 0x01,
+ MirrorVertically = 0x02
+ };
+ Q_DECLARE_FLAGS(TextureCoordinatesTransformMode, TextureCoordinatesTransformFlag)
+
+ void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode);
+ TextureCoordinatesTransformMode textureCoordinatesTransform() const;
+
private:
QSGGeometry m_geometry;
QSGOpaqueTextureMaterial m_opaque_material;
QSGTextureMaterial m_material;
QRectF m_rect;
+
+ Q_DECLARE_PRIVATE(QSGSimpleTextureNode)
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSGSimpleTextureNode::TextureCoordinatesTransformMode)
+
QT_END_NAMESPACE
#endif // QSGSIMPLETEXTURENODE_H
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index ad98fe9d47..a69f43f8d6 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -614,7 +614,8 @@ void QSGPlainTexture::bind()
m_dirty_texture = false;
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
qsg_renderer_timer.start();
#endif
@@ -628,6 +629,11 @@ void QSGPlainTexture::bind()
m_texture_size.width(),
m_texture_size.height());
}
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphTextureDeletion,
+ qsg_renderer_timer.nsecsElapsed());
+ }
#endif
}
m_texture_id = 0;
@@ -645,9 +651,9 @@ void QSGPlainTexture::bind()
glBindTexture(GL_TEXTURE_2D, m_texture_id);
#ifndef QSG_NO_RENDER_TIMING
- int bindTime = 0;
- if (qsg_render_timing)
- bindTime = qsg_renderer_timer.elapsed();
+ qint64 bindTime = 0;
+ if (profileFrames)
+ bindTime = qsg_renderer_timer.nsecsElapsed();
#endif
// ### TODO: check for out-of-memory situations...
@@ -657,11 +663,13 @@ void QSGPlainTexture::bind()
QImage tmp = (m_image.format() == QImage::Format_RGB32 || m_image.format() == QImage::Format_ARGB32_Premultiplied)
? m_image
: m_image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ if (tmp.width() * 4 != tmp.bytesPerLine())
+ tmp = tmp.copy();
#ifndef QSG_NO_RENDER_TIMING
- int convertTime = 0;
- if (qsg_render_timing)
- convertTime = qsg_renderer_timer.elapsed();
+ qint64 convertTime = 0;
+ if (profileFrames)
+ convertTime = qsg_renderer_timer.nsecsElapsed();
#endif
updateBindOptions(m_dirty_bind_options);
@@ -684,16 +692,16 @@ void QSGPlainTexture::bind()
}
#ifndef QSG_NO_RENDER_TIMING
- int swizzleTime = 0;
- if (qsg_render_timing)
- swizzleTime = qsg_renderer_timer.elapsed();
+ qint64 swizzleTime = 0;
+ if (profileFrames)
+ swizzleTime = qsg_renderer_timer.nsecsElapsed();
#endif
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFormat, GL_UNSIGNED_BYTE, tmp.constBits());
#ifndef QSG_NO_RENDER_TIMING
- int uploadTime = 0;
- if (qsg_render_timing)
- uploadTime = qsg_renderer_timer.elapsed();
+ qint64 uploadTime = 0;
+ if (profileFrames)
+ uploadTime = qsg_renderer_timer.nsecsElapsed();
#endif
@@ -704,23 +712,35 @@ void QSGPlainTexture::bind()
}
#ifndef QSG_NO_RENDER_TIMING
- int mipmapTime = 0;
+ qint64 mipmapTime = 0;
if (qsg_render_timing) {
- mipmapTime = qsg_renderer_timer.elapsed();
+ mipmapTime = qsg_renderer_timer.nsecsElapsed();
printf(" - plaintexture(%dx%d) bind=%d, convert=%d, swizzle=%d (%s->%s), upload=%d, mipmap=%d, total=%d\n",
m_texture_size.width(), m_texture_size.height(),
- bindTime,
- convertTime - bindTime,
- swizzleTime - convertTime,
+ int(bindTime/1000000),
+ int((convertTime - bindTime)/1000000),
+ int((swizzleTime - convertTime)/1000000),
externalFormat == GL_BGRA ? "BGRA" : "RGBA",
internalFormat == GL_BGRA ? "BGRA" : "RGBA",
- uploadTime - swizzleTime,
- mipmapTime - uploadTime,
+ int((uploadTime - swizzleTime)/1000000),
+ int((mipmapTime - uploadTime)/1000000),
(int) qsg_renderer_timer.elapsed());
}
+ if (QQmlProfilerService::enabled) {
+ mipmapTime = qsg_renderer_timer.nsecsElapsed();
+
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphTexturePrepare,
+ bindTime,
+ convertTime - bindTime,
+ swizzleTime - convertTime,
+ uploadTime - swizzleTime,
+ mipmapTime - uploadTime);
+ }
+
#endif
diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h
index 6430a93ed8..7282d4051f 100644
--- a/src/quick/scenegraph/util/qsgtexture_p.h
+++ b/src/quick/scenegraph/util/qsgtexture_p.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
class QSGTexturePrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QSGTexture);
+ Q_DECLARE_PUBLIC(QSGTexture)
public:
QSGTexturePrivate();
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp
index ff91109a2a..87414766e3 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.cpp
+++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp
@@ -145,7 +145,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa
tuple. The QSGGeometry::defaultAttributes_TexturedPoint2D returns an
attribute set compatible with this material.
- The texture to be rendered is can be set using setTexture(). How the
+ The texture to be rendered can be set using setTexture(). How the
texture should be rendered can be specified using setMipmapFiltering(),
setFiltering(), setHorizontalWrapMode() and setVerticalWrapMode().
The rendering state is set on the texture instance just before it
@@ -208,7 +208,7 @@ QSGMaterialShader *QSGOpaqueTextureMaterial::createShader() const
/*!
Sets the texture of this material to \a texture.
- The material does not take ownership over the texture.
+ The material does not take ownership of the texture.
*/
void QSGOpaqueTextureMaterial::setTexture(QSGTexture *texture)
@@ -337,7 +337,7 @@ int QSGOpaqueTextureMaterial::compare(const QSGMaterial *o) const
tuple. The QSGGeometry::defaultAttributes_TexturedPoint2D returns an
attribute set compatible with this material.
- The texture to be rendered is set using setTexture(). How the
+ The texture to be rendered can be set using setTexture(). How the
texture should be rendered can be specified using setMipmapFiltering(),
setFiltering(), setHorizontalWrapMode() and setVerticalWrapMode().
The rendering state is set on the texture instance just before it
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index f74ad20bc6..c05b254b51 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -1025,7 +1025,7 @@ QAbstractAnimationJob* QQuickScriptAction::transition(QQuickStateActions &action
PropertyAction object) so that the rotation animation begins with the
correct transform origin.
- \sa {Animation and Transitions in Qt Quick}, QtQml
+ \sa {Animation and Transitions in Qt Quick}, {Qt QML}
*/
QQuickPropertyAction::QQuickPropertyAction(QObject *parent)
: QQuickAbstractAnimation(*(new QQuickPropertyActionPrivate), parent)
@@ -1975,7 +1975,7 @@ void QQuickPropertyAnimation::setDuration(int duration)
}
/*!
- \qmlproperty real QtQuick2::PropertyAnimation::from
+ \qmlproperty variant QtQuick2::PropertyAnimation::from
This property holds the starting value for the animation.
If the PropertyAnimation is defined within a \l Transition or \l Behavior,
@@ -2002,7 +2002,7 @@ void QQuickPropertyAnimation::setFrom(const QVariant &f)
}
/*!
- \qmlproperty real QtQuick2::PropertyAnimation::to
+ \qmlproperty variant QtQuick2::PropertyAnimation::to
This property holds the end value for the animation.
If the PropertyAnimation is defined within a \l Transition or \l Behavior,
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index e332f37493..1e77084e42 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -98,7 +98,7 @@ public:
state change. For general advice on using Behaviors to animate state changes, see
\l{Using Qt Quick Behaviors with States}.
- \sa {Animation and Transitions in Qt Quick}, {declarative/animation/behaviors}{Behavior example}, QtQml
+ \sa {Animation and Transitions in Qt Quick}, {declarative/animation/behaviors}{Behavior example}, {Qt QML}
*/
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index abdadaa5d3..6fbba8ca2f 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -169,7 +169,7 @@ QImage QQuickTextureFactory::image() const
an image provider named "colors", and the images to be loaded are "yellow"
and "red", respectively:
- \snippet quick/imageprovider/imageprovider-example.qml 0
+ \snippet imageprovider/imageprovider-example.qml 0
When these images are loaded by QML, it looks for a matching image provider
and calls its requestImage() or requestPixmap() method (depending on its
@@ -180,9 +180,9 @@ QImage QQuickTextureFactory::image() const
requested by the above QML. This implementation dynamically
generates QPixmap images that are filled with the requested color:
- \snippet quick/imageprovider/imageprovider.cpp 0
+ \snippet imageprovider/imageprovider.cpp 0
\codeline
- \snippet quick/imageprovider/imageprovider.cpp 1
+ \snippet imageprovider/imageprovider.cpp 1
To make this provider accessible to QML, it is registered with the QML engine
with a "colors" identifier:
@@ -242,7 +242,7 @@ QImage QQuickTextureFactory::image() const
\c cache property to \c false for the relevant \l Image, \l BorderImage or
\l AnimatedImage object.
- The QtQuick 1 version of this class is named QDeclarativeImageProvider.
+ The \l {Qt Quick 1} version of this class is named QDeclarativeImageProvider.
\sa QQmlEngine::addImageProvider()
*/
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 3aea724983..2278fd25ba 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -188,8 +188,67 @@ bool QQuickPath::hasEnd() const
QQmlListProperty<QQuickPathElement> QQuickPath::pathElements()
{
- Q_D(QQuickPath);
- return QQmlListProperty<QQuickPathElement>(this, d->_pathElements);
+ return QQmlListProperty<QQuickPathElement>(this,
+ 0,
+ pathElements_append,
+ pathElements_count,
+ pathElements_at,
+ pathElements_clear);
+}
+
+static QQuickPathPrivate *privatePath(QObject *object)
+{
+ QQuickPath *path = static_cast<QQuickPath*>(object);
+
+ return QQuickPathPrivate::get(path);
+}
+
+QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty<QQuickPathElement> *property, int index)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+
+ return d->_pathElements.at(index);
+}
+
+void QQuickPath::pathElements_append(QQmlListProperty<QQuickPathElement> *property, QQuickPathElement *pathElement)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+ QQuickPath *path = static_cast<QQuickPath*>(property->object);
+
+ d->_pathElements.append(pathElement);
+
+ if (d->componentComplete) {
+ QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement);
+ if (curve)
+ d->_pathCurves.append(curve);
+ else {
+ QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement);
+ if (attribute && !d->_attributes.contains(attribute->name()))
+ d->_attributes.append(attribute->name());
+ }
+
+ path->processPath();
+
+ connect(pathElement, SIGNAL(changed()), path, SLOT(processPath()));
+ }
+}
+
+int QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *property)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+
+ return d->_pathElements.count();
+}
+
+void QQuickPath::pathElements_clear(QQmlListProperty<QQuickPathElement> *property)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+ QQuickPath *path = static_cast<QQuickPath*>(property->object);
+
+ path->disconnectPathElements();
+ d->_pathElements.clear();
+ d->_pathCurves.clear();
+ d->_pointCache.clear();
}
void QQuickPath::interpolate(int idx, const QString &name, qreal value)
@@ -373,27 +432,49 @@ void QQuickPath::classBegin()
d->componentComplete = false;
}
-void QQuickPath::componentComplete()
+void QQuickPath::disconnectPathElements()
+{
+ Q_D(QQuickPath);
+
+ foreach (QQuickPathElement *pathElement, d->_pathElements)
+ disconnect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
+}
+
+void QQuickPath::connectPathElements()
{
Q_D(QQuickPath);
- QSet<QString> attrs;
- d->componentComplete = true;
+
+ foreach (QQuickPathElement *pathElement, d->_pathElements)
+ connect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
+}
+
+void QQuickPath::gatherAttributes()
+{
+ Q_D(QQuickPath);
+
+ QSet<QString> attributes;
// First gather up all the attributes
foreach (QQuickPathElement *pathElement, d->_pathElements) {
- if (QQuickCurve *curve =
- qobject_cast<QQuickCurve *>(pathElement))
+ if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement))
d->_pathCurves.append(curve);
- else if (QQuickPathAttribute *attribute =
- qobject_cast<QQuickPathAttribute *>(pathElement))
- attrs.insert(attribute->name());
+ else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement))
+ attributes.insert(attribute->name());
}
- d->_attributes = attrs.toList();
+
+ d->_attributes = attributes.toList();
+}
+
+void QQuickPath::componentComplete()
+{
+ Q_D(QQuickPath);
+ d->componentComplete = true;
+
+ gatherAttributes();
processPath();
- foreach (QQuickPathElement *pathElement, d->_pathElements)
- connect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
+ connectPathElements();
}
QPainterPath QQuickPath::path() const
@@ -1465,7 +1546,7 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa
nextData.curves = data.curves;
next = positionForCurve(nextData, point);
} else {
- if (point == QPointF(path.elementAt(0)) && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(0))) {
+ if (point == QPointF(path.elementAt(0)) && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(0)) && path.elementCount() >= 3) {
//this is a closed path starting and ending with catmull-rom segments.
//we try to smooth the join point
next = QPointF(path.elementAt(3)); //the first catmull-rom point
diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h
index 71545851e4..1a9be7c82a 100644
--- a/src/quick/util/qquickpath_p.h
+++ b/src/quick/util/qquickpath_p.h
@@ -393,6 +393,15 @@ Q_SIGNALS:
protected:
virtual void componentComplete();
virtual void classBegin();
+ void disconnectPathElements();
+ void connectPathElements();
+ void gatherAttributes();
+
+ // pathElements property
+ static QQuickPathElement *pathElements_at(QQmlListProperty<QQuickPathElement> *, int);
+ static void pathElements_append(QQmlListProperty<QQuickPathElement> *, QQuickPathElement *);
+ static int pathElements_count(QQmlListProperty<QQuickPathElement> *);
+ static void pathElements_clear(QQmlListProperty<QQuickPathElement> *);
private Q_SLOTS:
void processPath();
diff --git a/src/quick/util/qquickpath_p_p.h b/src/quick/util/qquickpath_p_p.h
index b4227e64f3..e376925f21 100644
--- a/src/quick/util/qquickpath_p_p.h
+++ b/src/quick/util/qquickpath_p_p.h
@@ -67,6 +67,9 @@ class QQuickPathPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QQuickPath)
public:
+ static QQuickPathPrivate* get(QQuickPath *path) { return path->d_func(); }
+ static const QQuickPathPrivate* get(const QQuickPath *path) { return path->d_func(); }
+
QQuickPathPrivate() : pathLength(0), closed(false), componentComplete(true) { }
QPainterPath _path;
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index c5968c2bc1..9cf8c5812d 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -71,6 +71,8 @@
#include <QQmlFile>
#include <QMetaMethod>
+#include <private/qqmlprofilerservice_p.h>
+
#define IMAGEREQUEST_MAX_REQUEST_COUNT 8
#define IMAGEREQUEST_MAX_REDIRECT_RECURSION 16
#define CACHE_EXPIRE_TIME 30
@@ -890,11 +892,15 @@ bool QQuickPixmapReply::event(QEvent *event)
if (data) {
Event *de = static_cast<Event *>(event);
data->pixmapStatus = (de->error == NoError) ? QQuickPixmap::Ready : QQuickPixmap::Error;
-
+ QQmlPixmapProfiler pixmapProfiler;
if (data->pixmapStatus == QQuickPixmap::Ready) {
+ pixmapProfiler.finishLoading(data->url);
data->textureFactory = de->textureFactory;
data->implicitSize = de->implicitSize;
+ if (data->implicitSize.width() > 0)
+ pixmapProfiler.setSize(url, data->implicitSize.width(), data->implicitSize.height());
} else {
+ pixmapProfiler.errorLoading(data->url);
data->errorString = de->errorString;
data->removeFromCache(); // We don't continue to cache error'd pixmaps
}
@@ -920,6 +926,7 @@ int QQuickPixmapData::cost() const
void QQuickPixmapData::addref()
{
++refCount;
+ QQmlPixmapProfiler().referenceCountChanged(url, refCount);
if (prevUnreferencedPtr)
pixmapStore()->referencePixmap(this);
}
@@ -928,6 +935,7 @@ void QQuickPixmapData::release()
{
Q_ASSERT(refCount > 0);
--refCount;
+ QQmlPixmapProfiler().referenceCountChanged(url, refCount);
if (refCount == 0) {
if (reply) {
QQuickPixmapReply *cancelReply = reply;
@@ -958,6 +966,10 @@ void QQuickPixmapData::addToCache()
QQuickPixmapKey key = { &url, &requestSize };
pixmapStore()->m_cache.insert(key, this);
inCache = true;
+ QQmlPixmapProfiler pixmapProfiler;
+ pixmapProfiler.cacheCountChanged(url, pixmapStore()->m_cache.count());
+ if (implicitSize.width() > 0)
+ pixmapProfiler.setSize(url, implicitSize.width(), implicitSize.height());
}
}
@@ -965,6 +977,7 @@ void QQuickPixmapData::removeFromCache()
{
if (inCache) {
QQuickPixmapKey key = { &url, &requestSize };
+ QQmlPixmapProfiler().cacheCountChanged(url, pixmapStore()->m_cache.count());
pixmapStore()->m_cache.remove(key);
inCache = false;
}
@@ -1238,14 +1251,21 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
if (!(options & QQuickPixmap::Asynchronous)) {
bool ok = false;
+ QQmlPixmapProfiler pixmapProfiler;
+ pixmapProfiler.startLoading(url);
d = createPixmapDataSync(this, engine, url, requestSize, &ok);
if (ok) {
+ pixmapProfiler.finishLoading(url);
+ if (d->implicitSize.width() > 0)
+ QQmlPixmapProfiler().setSize(url, d->implicitSize.width(), d->implicitSize.height());
if (options & QQuickPixmap::Cache)
d->addToCache();
return;
}
- if (d) // loadable, but encountered error while loading
+ if (d) { // loadable, but encountered error while loading
+ pixmapProfiler.errorLoading(url);
return;
+ }
}
if (!engine)
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index c1173d70f5..ec3a2f8170 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -128,7 +128,7 @@ QT_BEGIN_NAMESPACE
See the PropertyAction documentation for more details.
- \sa {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, QtQml
+ \sa {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, {Qt QML}
*/
/*!
diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp
index 491146660b..c89cea6767 100644
--- a/src/quick/util/qquickstate.cpp
+++ b/src/quick/util/qquickstate.cpp
@@ -151,7 +151,7 @@ QQuickStateOperation::QQuickStateOperation(QObjectPrivate &dd, QObject *parent)
not allowed.
\sa {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States},
- {Animation and Transitions in Qt Quick}{Transitions}, QtQml
+ {Animation and Transitions in Qt Quick}{Transitions}, {Qt QML}
*/
QQuickState::QQuickState(QObject *parent)
: QObject(*(new QQuickStatePrivate), parent)
diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp
index b4c8f214b9..a72a45e96b 100644
--- a/src/quick/util/qquickstategroup.cpp
+++ b/src/quick/util/qquickstategroup.cpp
@@ -119,7 +119,7 @@ public:
}
\endqml
- \sa {Qt Quick States}{Qt Quick States}, {Animation and Transitions in Qt Quick}{Transitions}, {QtQml}
+ \sa {Qt Quick States}{Qt Quick States}, {Animation and Transitions in Qt Quick}{Transitions}, {Qt QML}
*/
QQuickStateGroup::QQuickStateGroup(QObject *parent)
diff --git a/src/quick/util/qquicksvgparser.cpp b/src/quick/util/qquicksvgparser.cpp
index 760b4b0e2f..ece6d24ee1 100644
--- a/src/quick/util/qquicksvgparser.cpp
+++ b/src/quick/util/qquicksvgparser.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
static const double Q_PI = 3.14159265358979323846; // pi
-//copied from QtSvg (qsvghandler.cpp).
+//copied from Qt SVG (qsvghandler.cpp).
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
// '0' is 0x30 and '9' is 0x39
static inline bool isDigit(ushort ch)
diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp
index 025c7d7b03..ead28fe496 100644
--- a/src/quick/util/qquicktransition.cpp
+++ b/src/quick/util/qquicktransition.cpp
@@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE
\l Behavior, the Transition animation overrides the \l Behavior for that
state change.
- \sa {Animation and Transitions in Qt Quick}, {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, {QtQml}
+ \sa {Animation and Transitions in Qt Quick}, {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, {Qt QML}
*/
//ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting