aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-09-08 11:04:30 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-09-08 11:04:30 +0200
commitbde8c3cd9583ed9f3bdfc36a8699f56db20a6928 (patch)
tree33246b027739aafd72f9f289876f69627537f2b3
parentb63bc868875d7571bc332804f984824cff7c5b78 (diff)
parent685ad676a84bf48602a5da8f7171792686b94a73 (diff)
Merge remote-tracking branch 'origin/dev' into wip/new-backend
Conflicts: src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4jsir.cpp src/qml/jsruntime/qv4mathobject.cpp Change-Id: I426f1f4f0a5302b5bcff021de11766a03fec7637
-rw-r--r--.qmake.conf2
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc2
-rw-r--r--examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc2
-rw-r--r--examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc2
-rw-r--r--examples/quick/scenegraph/graph/noisynode.cpp3
-rw-r--r--examples/quick/scenegraph/sgengine/window.cpp11
-rw-r--r--src/3rdparty/masm/masm-defs.pri1
-rw-r--r--src/3rdparty/masm/stubs/WTFStubs.cpp5
-rw-r--r--src/imports/localstorage/plugin.cpp2
-rw-r--r--src/imports/settings/qqmlsettings.cpp19
-rw-r--r--src/imports/shapes/qquickshape.cpp236
-rw-r--r--src/imports/testlib/TestCase.qml6
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp2
-rw-r--r--src/particles/qquickangledirection.cpp6
-rw-r--r--src/particles/qquickcustomparticle.cpp4
-rw-r--r--src/particles/qquickellipseextruder.cpp6
-rw-r--r--src/particles/qquickimageparticle.cpp13
-rw-r--r--src/particles/qquicklineextruder.cpp6
-rw-r--r--src/particles/qquickmaskextruder.cpp3
-rw-r--r--src/particles/qquickparticleemitter.cpp5
-rw-r--r--src/particles/qquickparticleextruder.cpp6
-rw-r--r--src/particles/qquickpointdirection.cpp6
-rw-r--r--src/particles/qquickrectangleextruder.cpp16
-rw-r--r--src/particles/qquicktargetdirection.cpp7
-rw-r--r--src/particles/qquicktrailemitter.cpp5
-rw-r--r--src/particles/qquickwander.cpp13
-rw-r--r--src/qml/compiler/qv4compileddata.cpp15
-rw-r--r--src/qml/compiler/qv4compileddata_p.h3
-rw-r--r--src/qml/doc/src/cppintegration/data.qdoc2
-rw-r--r--src/qml/doc/src/cppintegration/definetypes.qdoc3
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/topic.qdoc2
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc2
-rw-r--r--src/qml/doc/src/statemachine.qdoc2
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp16
-rw-r--r--src/qml/qml/qqmlcontext.cpp2
-rw-r--r--src/qml/qml/qqmlcontext_p.h5
-rw-r--r--src/qml/qml/qqmlengine_p.h6
-rw-r--r--src/qml/qml/qqmlincubator.cpp11
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp9
-rw-r--r--src/qml/qml/qqmlobjectcreator_p.h5
-rw-r--r--src/qml/qml/qqmlproperty.cpp5
-rw-r--r--src/qml/qml/qqmltypeloader.cpp2
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp3
-rw-r--r--src/qml/types/qqmlbind.cpp4
-rw-r--r--src/qmltest/quicktest.cpp5
-rw-r--r--src/qmltest/quicktestevent.cpp2
-rw-r--r--src/quick/doc/snippets/qml/loader/KeyReader.qml2
-rw-r--r--src/quick/doc/snippets/qml/loader/focus.qml7
-rw-r--r--src/quick/doc/src/advtutorial.qdoc34
-rw-r--r--src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc2
-rw-r--r--src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc4
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc4
-rw-r--r--src/quick/doc/src/concepts/statesanimations/animations.qdoc2
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc6
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc2
-rw-r--r--src/quick/doc/src/qmltypereference.qdoc1
-rw-r--r--src/quick/doc/src/tutorial.qdoc4
-rw-r--r--src/quick/handlers/handlers.pri8
-rw-r--r--src/quick/handlers/qquickdraghandler.cpp6
-rw-r--r--src/quick/handlers/qquickdraghandler_p.h4
-rw-r--r--src/quick/handlers/qquickmultipointhandler.cpp (renamed from src/quick/handlers/qquickmultipointerhandler.cpp)32
-rw-r--r--src/quick/handlers/qquickmultipointhandler_p.h (renamed from src/quick/handlers/qquickmultipointerhandler_p.h)8
-rw-r--r--src/quick/handlers/qquickpinchhandler.cpp10
-rw-r--r--src/quick/handlers/qquickpinchhandler_p.h4
-rw-r--r--src/quick/handlers/qquicksinglepointhandler.cpp (renamed from src/quick/handlers/qquickpointersinglehandler.cpp)20
-rw-r--r--src/quick/handlers/qquicksinglepointhandler_p.h (renamed from src/quick/handlers/qquickpointersinglehandler_p.h)12
-rw-r--r--src/quick/handlers/qquicktaphandler.cpp8
-rw-r--r--src/quick/handlers/qquicktaphandler_p.h6
-rw-r--r--src/quick/items/qquickevents.cpp5
-rw-r--r--src/quick/items/qquickevents_p_p.h1
-rw-r--r--src/quick/items/qquickitem.cpp52
-rw-r--r--src/quick/items/qquickitem_p.h1
-rw-r--r--src/quick/items/qquickitemsmodule.cpp2
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp12
-rw-r--r--src/quick/items/qquicklistview.cpp10
-rw-r--r--src/quick/items/qquickloader.cpp8
-rw-r--r--src/quick/items/qquickshadereffect.cpp2
-rw-r--r--src/quick/items/qquicksprite.cpp5
-rw-r--r--src/quick/items/qquickspriteengine.cpp11
-rw-r--r--src/quick/items/qquickspriteengine_p.h3
-rw-r--r--src/quick/items/qquicktext.cpp27
-rw-r--r--src/quick/items/qquicktextedit.cpp28
-rw-r--r--src/quick/items/qquicktextedit_p_p.h7
-rw-r--r--src/quick/items/qquicktextinput.cpp22
-rw-r--r--src/quick/items/qquicktextinput_p_p.h7
-rw-r--r--src/quick/items/qquicktextutil_p.h16
-rw-r--r--src/quick/items/qquickwindow.cpp125
-rw-r--r--src/quick/items/qquickwindow.h9
-rw-r--r--src/quick/items/qquickwindow_p.h3
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp14
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgpkmhandler_p.h6
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp5
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h1
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer_p.h3
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp11
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp8
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp10
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp7
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture_p.h2
-rw-r--r--src/quick/util/qquickglobal.cpp8
-rw-r--r--src/quick/util/qquickimageprovider.cpp6
-rw-r--r--src/quick/util/qquickpath.cpp3
-rw-r--r--src/quick/util/qquickpropertychanges.cpp4
-rw-r--r--src/quick/util/qquickvaluetypes.cpp13
-rw-r--r--src/quick/util/qquickvaluetypes_p.h4
-rw-r--r--src/quickwidgets/qquickwidget.cpp2
-rw-r--r--tests/auto/qml/debugger/debugger.pro3
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp1
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp1
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp3
-rw-r--r--tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess.pro4
-rw-r--r--tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/qqmldebugprocess.pro14
-rw-r--r--tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp126
-rw-r--r--tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.cpp39
-rw-r--r--tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.pro10
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp1
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp1
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp1
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp192
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.pri8
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h54
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugprocess.cpp245
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugprocess_p.h99
-rw-r--r--tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp29
-rw-r--r--tests/auto/quick/qquicklistview/randomsortmodel.cpp5
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp2
-rw-r--r--tests/auto/quick/shared/viewtestutil.cpp6
-rw-r--r--tests/benchmarks/qml/holistic/testtypes.h5
-rw-r--r--tests/benchmarks/qml/painting/paintbenchmark.cpp3
-rw-r--r--tests/manual/pointer/main.cpp1
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_advance_bidi_ltr.qml2
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_advance_hebrew.qml2
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_advance_latin.qml2
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_advance_multiline.qml2
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph.qml2
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph_multifontsizes.qml2
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bengali_noshaping.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_latin_noshaping.qml15
-rw-r--r--tools/qmlimportscanner/main.cpp4
-rw-r--r--tools/qmlplugindump/main.cpp2
-rw-r--r--tools/qmlscene/main.cpp20
149 files changed, 1325 insertions, 754 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 4e4a28b8f9..31a134c4cc 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,4 +1,4 @@
load(qt_build_config)
CONFIG += warning_clean
-MODULE_VERSION = 5.10.0
+MODULE_VERSION = 5.11.0
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index f99aca5457..c5e3611905 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -171,7 +171,7 @@ is a little contrived, but in real applications it is likely that the two
extensions would add additional properties or modify the Person classes
behavior.
-\section2 Define People as a base class
+\section2 Define People as a Base Class
The implementation of the People class itself has not changed since the
previous example. However, as we have repurposed the People class as a common
diff --git a/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc
index 67a36eb8d8..d9703f6187 100644
--- a/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc
+++ b/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc
@@ -75,7 +75,7 @@ Item {
the text will only be visible when the switch is on.
-\section2 Images and user interaction
+\section2 Images and User Interaction
\snippet customitems/slideswitch/content/Switch.qml 4
First, we create the background image of the switch.
diff --git a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
index 9c0f8b337e..a107b19948 100644
--- a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
+++ b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
@@ -222,7 +222,7 @@
\printuntil onClicked
\printuntil }
- \section1 Laying out Photos on a Path
+ \section1 Laying Out Photos on a Path
In AlbumDelegate.qml, we use a PathView type to lay out the photos provided
by the \c visualModel.parts.stack model on a path that has the form of a
diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp
index 834151599b..5658702f3a 100644
--- a/examples/quick/scenegraph/graph/noisynode.cpp
+++ b/examples/quick/scenegraph/graph/noisynode.cpp
@@ -40,6 +40,7 @@
#include "noisynode.h"
+#include <QtCore/QRandomGenerator>
#include <QtQuick/QSGSimpleMaterialShader>
#include <QtQuick/QSGTexture>
#include <QtQuick/QQuickWindow>
@@ -103,7 +104,7 @@ NoisyNode::NoisyNode(QQuickWindow *window)
QImage image(NOISE_SIZE, NOISE_SIZE, QImage::Format_RGB32);
uint *data = (uint *) image.bits();
for (int i=0; i<NOISE_SIZE * NOISE_SIZE; ++i) {
- uint g = rand() & 0xff;
+ uint g = QRandomGenerator::bounded(0xff);
data[i] = 0xff000000 | (g << 16) | (g << 8) | g;
}
diff --git a/examples/quick/scenegraph/sgengine/window.cpp b/examples/quick/scenegraph/sgengine/window.cpp
index a73d9bf755..0e5c738ce5 100644
--- a/examples/quick/scenegraph/sgengine/window.cpp
+++ b/examples/quick/scenegraph/sgengine/window.cpp
@@ -48,6 +48,7 @@
#include <QScreen>
#include <QVariantAnimation>
#include <QOpenGLFunctions>
+#include <QRandomGenerator>
class Item {
public:
@@ -61,9 +62,9 @@ public:
transformNode->appendChildNode(textureNode);
parentNode->appendChildNode(transformNode);
- int duration = qrand() / float(RAND_MAX) * 400 + 800;
- rotAnimation.setStartValue(qrand() / float(RAND_MAX) * 720 - 180);
- rotAnimation.setEndValue(qrand() / float(RAND_MAX) * 720 - 180);
+ int duration = QRandomGenerator::getReal() * 400 + 800;
+ rotAnimation.setStartValue(QRandomGenerator::getReal() * 720 - 180);
+ rotAnimation.setEndValue(QRandomGenerator::getReal() * 720 - 180);
rotAnimation.setDuration(duration);
rotAnimation.start();
@@ -171,8 +172,8 @@ void Window::addItems()
QSGTexture *textures[] = { m_smileTexture.data(), m_qtTexture.data() };
for (int i = 0; i < 50; ++i) {
QSGTexture *tex = textures[i%2];
- QPointF fromPos(-tex->textureSize().width(), qrand() / float(RAND_MAX) * (height() - tex->textureSize().height()));
- QPointF toPos(width(), qrand() / float(RAND_MAX) * height() * 1.5 - height() * 0.25);
+ QPointF fromPos(-tex->textureSize().width(), QRandomGenerator::getReal() * (height() - tex->textureSize().height()));
+ QPointF toPos(width(), QRandomGenerator::getReal() * height() * 1.5 - height() * 0.25);
m_items.append(QSharedPointer<Item>::create(m_sgRootNode.data(), tex, fromPos, toPos));
}
update();
diff --git a/src/3rdparty/masm/masm-defs.pri b/src/3rdparty/masm/masm-defs.pri
index c0c5f3d114..34d6a67451 100644
--- a/src/3rdparty/masm/masm-defs.pri
+++ b/src/3rdparty/masm/masm-defs.pri
@@ -3,6 +3,7 @@ DEFINES += ENABLE_ASSEMBLER_WX_EXCLUSIVE=1
# Avoid symbol clashes with QtScript during static linking
DEFINES += WTFReportAssertionFailure=qmlWTFReportAssertionFailure
+DEFINES += WTFReportAssertionFailureWithMessage=qmlWTFReportAssertionFailureWithMessage
DEFINES += WTFReportBacktrace=qmlWTFReportBacktrace
DEFINES += WTFInvokeCrashHook=qmlWTFInvokeCrashHook
diff --git a/src/3rdparty/masm/stubs/WTFStubs.cpp b/src/3rdparty/masm/stubs/WTFStubs.cpp
index 610b632baf..ea7e2d78e0 100644
--- a/src/3rdparty/masm/stubs/WTFStubs.cpp
+++ b/src/3rdparty/masm/stubs/WTFStubs.cpp
@@ -112,6 +112,11 @@ void dataLogFString(const char* str)
}
extern "C" {
+// When adding a new stub here do not forget to add
+// DEFINES += StubFunctionName=qmlStubFunctionName
+// for example:
+// DEFINES += WTFReportAssertionFailureWithMessage=qmlWTFReportAssertionFailureWithMessage
+// to prevent "duplicate symbol" error during static library linking. See bugs QTBUG-35041 and QTBUG-63050
void WTFReportAssertionFailure(const char* file, int line, const char* function, const char*assertion)
{
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 795103cd26..a827188d10 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -572,7 +572,7 @@ The API conforms to the Synchronous API of the HTML5 Web Database API,
The \l{Qt Quick Examples - Local Storage}{SQL Local Storage example} demonstrates the basics of
using the Offline Storage API.
-\section3 Open or create a databaseData
+\section3 Open or Create a Database
\code
import QtQuick.LocalStorage 2.0 as Sql
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index df67c04654..ed2f58e7c1 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -39,6 +39,7 @@
#include "qqmlsettings_p.h"
#include <qcoreevent.h>
+#include <qloggingcategory.h>
#include <qsettings.h>
#include <qpointer.h>
#include <qjsvalue.h>
@@ -222,7 +223,7 @@ QT_BEGIN_NAMESPACE
\sa QSettings
*/
-// #define SETTINGS_DEBUG
+Q_LOGGING_CATEGORY(lcSettings, "qt.labs.settings")
static const int settingsWriteDelay = 500;
@@ -273,9 +274,7 @@ QSettings *QQmlSettingsPrivate::instance() const
void QQmlSettingsPrivate::init()
{
if (!initialized) {
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: stored at" << instance()->fileName();
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: stored at" << instance()->fileName();
load();
initialized = true;
}
@@ -303,9 +302,7 @@ void QQmlSettingsPrivate::load()
if (!currentValue.isNull() && (!previousValue.isValid()
|| (currentValue.canConvert(previousValue.type()) && previousValue != currentValue))) {
property.write(q, currentValue);
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: load" << property.name() << "setting:" << currentValue << "default:" << previousValue;
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: load" << property.name() << "setting:" << currentValue << "default:" << previousValue;
}
// ensure that a non-existent setting gets written
@@ -326,9 +323,7 @@ void QQmlSettingsPrivate::store()
QHash<const char *, QVariant>::const_iterator it = changedProperties.constBegin();
while (it != changedProperties.constEnd()) {
instance()->setValue(it.key(), it.value());
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: store" << it.key() << ":" << it.value();
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: store" << it.key() << ":" << it.value();
++it;
}
changedProperties.clear();
@@ -344,9 +339,7 @@ void QQmlSettingsPrivate::_q_propertyChanged()
const QMetaProperty &property = mo->property(i);
const QVariant value = readProperty(property);
changedProperties.insert(property.name(), value);
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: cache" << property.name() << ":" << value;
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: cache" << property.name() << ":" << value;
}
if (timerId != 0)
q->killTimer(timerId);
diff --git a/src/imports/shapes/qquickshape.cpp b/src/imports/shapes/qquickshape.cpp
index 1ed61ff476..6a76743242 100644
--- a/src/imports/shapes/qquickshape.cpp
+++ b/src/imports/shapes/qquickshape.cpp
@@ -53,11 +53,11 @@ QT_BEGIN_NAMESPACE
\qmlmodule QtQuick.Shapes 1.0
\title Qt Quick Shapes QML Types
\ingroup qmlmodules
- \brief Provides QML types for drawing stroked and filled shapes
+ \brief Provides QML types for drawing stroked and filled shapes.
To use the types in this module, import the module with the following line:
- \code
+ \badcode
import QtQuick.Shapes 1.0
\endcode
*/
@@ -84,7 +84,7 @@ QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()
\ingroup qtquick-paths
\ingroup qtquick-views
\inherits Path
- \brief Describes a Path and associated properties for stroking and filling
+ \brief Describes a Path and associated properties for stroking and filling.
\since 5.10
A \l Shape contains one or more ShapePath elements. At least one ShapePath is
@@ -104,7 +104,7 @@ QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()
In the following example the line join style changes automatically based on
the value of joinStyleIndex:
- \code
+ \qml
ShapePath {
strokeColor: "black"
strokeWidth: 16
@@ -112,7 +112,12 @@ QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()
capStyle: ShapePath.RoundCap
property int joinStyleIndex: 0
- property variant styles: [ ShapePath.BevelJoin, ShapePath.MiterJoin, ShapePath.RoundJoin ]
+
+ property variant styles: [
+ ShapePath.BevelJoin,
+ ShapePath.MiterJoin,
+ ShapePath.RoundJoin
+ ]
joinStyle: styles[joinStyleIndex]
@@ -121,7 +126,7 @@ QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()
PathLine { x: 100; y: 100 }
PathLine { x: 30; y: 100 }
}
- \endcode
+ \endqml
Once associated with a Shape, here is the output with a joinStyleIndex
of 2 (ShapePath.RoundJoin):
@@ -240,13 +245,14 @@ void QQuickShapePath::setFillColor(const QColor &color)
\qmlproperty enumeration QtQuick.Shapes::ShapePath::fillRule
This property holds the fill rule. The default value is
- ShapePath.OddEvenFill. For an example on fill rules, see
+ \c ShapePath.OddEvenFill. For an explanation on fill rules, see
QPainterPath::setFillRule().
- \list
- \li ShapePath.OddEvenFill
- \li ShapePath.WindingFill
- \endlist
+ \value ShapePath.OddEvenFill
+ Odd-even fill rule.
+
+ \value ShapePath.WindingFill
+ Non-zero winding fill rule.
*/
QQuickShapePath::FillRule QQuickShapePath::fillRule() const
@@ -270,13 +276,17 @@ void QQuickShapePath::setFillRule(FillRule fillRule)
\qmlproperty enumeration QtQuick.Shapes::ShapePath::joinStyle
This property defines how joins between two connected lines are drawn. The
- default value is ShapePath.BevelJoin.
+ default value is \c ShapePath.BevelJoin.
- \list
- \li ShapePath.MiterJoin - The outer edges of the lines are extended to meet at an angle, and this area is filled.
- \li ShapePath.BevelJoin - The triangular notch between the two lines is filled.
- \li ShapePath.RoundJoin - A circular arc between the two lines is filled.
- \endlist
+ \value ShapePath.MiterJoin
+ The outer edges of the lines are extended to meet at an angle, and
+ this area is filled.
+
+ \value ShapePath.BevelJoin
+ The triangular notch between the two lines is filled.
+
+ \value ShapePath.RoundJoin
+ A circular arc between the two lines is filled.
*/
QQuickShapePath::JoinStyle QQuickShapePath::joinStyle() const
@@ -299,7 +309,7 @@ void QQuickShapePath::setJoinStyle(JoinStyle style)
/*!
\qmlproperty int QtQuick.Shapes::ShapePath::miterLimit
- When ShapePath.joinStyle is set to ShapePath.MiterJoin, this property
+ When joinStyle is set to \c ShapePath.MiterJoin, this property
specifies how far the miter join can extend from the join point.
The default value is 2.
@@ -326,13 +336,17 @@ void QQuickShapePath::setMiterLimit(int limit)
\qmlproperty enumeration QtQuick.Shapes::ShapePath::capStyle
This property defines how the end points of lines are drawn. The
- default value is ShapePath.SquareCap.
+ default value is \c ShapePath.SquareCap.
- \list
- \li ShapePath.FlatCap - A square line end that does not cover the end point of the line.
- \li ShapePath.SquareCap - A square line end that covers the end point and extends beyond it by half the line width.
- \li ShapePath.RoundCap - A rounded line end.
- \endlist
+ \value ShapePath.FlatCap
+ A square line end that does not cover the end point of the line.
+
+ \value ShapePath.SquareCap
+ A square line end that covers the end point and extends beyond it
+ by half the line width.
+
+ \value ShapePath.RoundCap
+ A rounded line end.
*/
QQuickShapePath::CapStyle QQuickShapePath::capStyle() const
@@ -414,8 +428,8 @@ void QQuickShapePath::setDashOffset(qreal offset)
This property defines the dash pattern when ShapePath.strokeStyle is set
to ShapePath.DashLine. The pattern must be specified as an even number of
- positive entries where the entries 1, 3, 5... are the dashes and 2, 4, 6...
- are the spaces. The pattern is specified in units of the pen's width.
+ positive entries where the entries 1, 3, 5... are the dashes and 2, 4,
+ 6... are the spaces. The pattern is specified in units of the pen's width.
The default value is (4, 2), meaning a dash of 4 * ShapePath.strokeWidth
pixels followed by a space of 2 * ShapePath.strokeWidth pixels.
@@ -444,14 +458,14 @@ void QQuickShapePath::setDashPattern(const QVector<qreal> &array)
\qmlproperty ShapeGradient QtQuick.Shapes::ShapePath::fillGradient
This property defines the fill gradient. By default no gradient is enabled
- and the value is \c null. In this case the fill uses a solid color based on
- the value of ShapePath.fillColor.
+ and the value is \c null. In this case the fill uses a solid color based
+ on the value of ShapePath.fillColor.
When set, ShapePath.fillColor is ignored and filling is done using one of
the ShapeGradient subtypes.
- \note The Gradient type cannot be used here. Rather, prefer using one of the
- advanced subtypes, like LinearGradient.
+ \note The Gradient type cannot be used here. Rather, prefer using one of
+ the advanced subtypes, like LinearGradient.
*/
QQuickShapeGradient *QQuickShapePath::fillGradient() const
@@ -495,29 +509,30 @@ void QQuickShapePath::resetFillGradient()
\ingroup qtquick-paths
\ingroup qtquick-views
\inherits Item
- \brief Renders a path
+ \brief Renders a path.
\since 5.10
Renders a path either by generating geometry via QPainterPath and manual
- triangulation or by using a GPU vendor extension like \c{GL_NV_path_rendering}.
+ triangulation or by using a GPU vendor extension like
+ \c{GL_NV_path_rendering}.
This approach is different from rendering shapes via QQuickPaintedItem or
- the 2D Canvas because the path never gets rasterized in software. Therefore
- Shape is suitable for creating shapes spreading over larger areas of the
- screen, avoiding the performance penalty for texture uploads or framebuffer
- blits. In addition, the declarative API allows manipulating, binding to,
- and even animating the path element properties like starting and ending
- position, the control points, etc.
+ the 2D Canvas because the path never gets rasterized in software.
+ Therefore Shape is suitable for creating shapes spreading over larger
+ areas of the screen, avoiding the performance penalty for texture uploads
+ or framebuffer blits. In addition, the declarative API allows manipulating,
+ binding to, and even animating the path element properties like starting
+ and ending position, the control points, and so on.
The types for specifying path elements are shared between \l PathView and
Shape. However, not all Shape implementations support all path
element types, while some may not make sense for PathView. Shape's
currently supported subset is: PathMove, PathLine, PathQuad, PathCubic,
- PathArc, PathSvg.
+ PathArc, and PathSvg.
See \l Path for a detailed overview of the supported path elements.
- \code
+ \qml
Shape {
width: 200
height: 150
@@ -542,7 +557,7 @@ void QQuickShapePath::resetFillGradient()
PathLine { x: 20; y: 20 }
}
}
- \endcode
+ \endqml
\image pathitem-code-example.png
@@ -574,37 +589,39 @@ void QQuickShapePath::resetFillGradient()
When using Shape, it is important to be aware of potential performance
implications:
+ \list
+
\li When the application is running with the generic, triangulation-based
Shape implementation, the geometry generation happens entirely on the
CPU. This is potentially expensive. Changing the set of path elements,
- changing the properties of these elements, or changing certain properties of
- the Shape itself all lead to retriangulation of the affected paths on every
- change. Therefore, applying animation to such properties can affect
+ changing the properties of these elements, or changing certain properties
+ of the Shape itself all lead to retriangulation of the affected paths on
+ every change. Therefore, applying animation to such properties can affect
performance on less powerful systems.
\li However, the data-driven, declarative nature of the Shape API often
means better cacheability for the underlying CPU and GPU resources. A
- property change in one ShapePath will only lead to reprocessing the affected
- ShapePath, leaving other parts of the Shape unchanged. Therefore, a
- frequently changing property can still result in a lower overall system load
- than with imperative painting approaches (for example, QPainter).
-
- \li If animating properties other than stroke and fill colors is a must, it
- is recommended to target systems providing \c{GL_NV_path_rendering} where
- the cost of property changes is smaller.
-
- \li At the same time, attention must be paid to the number of Shape elements
- in the scene, in particular when using this special accelerated approach for
- \c{GL_NV_path_rendering}. The way such a Shape item is represented in the
- scene graph is different from an ordinary geometry-based item, and incurs a
- certain cost when it comes to OpenGL state changes.
+ property change in one ShapePath will only lead to reprocessing the
+ affected ShapePath, leaving other parts of the Shape unchanged. Therefore,
+ a frequently changing property can still result in a lower overall system
+ load than with imperative painting approaches (for example, QPainter).
+
+ \li If animating properties other than stroke and fill colors is a must,
+ it is recommended to target systems providing \c{GL_NV_path_rendering}
+ where the cost of property changes is smaller.
+
+ \li At the same time, attention must be paid to the number of Shape
+ elements in the scene, in particular when using this special accelerated
+ approach for \c{GL_NV_path_rendering}. The way such a Shape item is
+ represented in the scene graph is different from an ordinary
+ geometry-based item, and incurs a certain cost when it comes to OpenGL
+ state changes.
\li As a general rule, scenes should avoid using separate Shape items when
it is not absolutely necessary. Prefer using one Shape item with multiple
- ShapePath elements over multiple Shape items. Scenes that cannot avoid using
- a large number of individual Shape items should consider setting
+ ShapePath elements over multiple Shape items. Scenes that cannot avoid
+ using a large number of individual Shape items should consider setting
Shape.vendorExtensionsEnabled to \c false.
-
\endlist
\sa {Qt Quick Examples - Shapes}, Path, PathMove, PathLine, PathQuad, PathCubic, PathArc, PathSvg
@@ -656,25 +673,25 @@ QQuickShape::~QQuickShape()
This property determines which path rendering backend is active.
- \list
-
- \li Shape.UnknownRenderer - The renderer is unknown.
-
- \li Shape.GeometryRenderer - The generic, driver independent solution
- for OpenGL. Uses the same CPU-based triangulation approach as QPainter's
- OpenGL 2 paint engine. This is the default on non-NVIDIA hardware when the
- default, OpenGL Qt Quick scenegraph backend is in use.
-
- \li Shape.NvprRenderer - Path items are rendered by performing OpenGL
- calls using the \c{GL_NV_path_rendering} extension. This is the default on
- NVIDIA hardware when the default, OpenGL Qt Quick scenegraph backend is in
- use.
-
- \li Shape.SoftwareRenderer - Pure QPainter drawing using the raster
- paint engine. This is the default, and only, option when the Qt Quick
- scenegraph is running with the \c software backend.
-
- \endlist
+ \value Shape.UnknownRenderer
+ The renderer is unknown.
+
+ \value Shape.GeometryRenderer
+ The generic, driver independent solution for OpenGL. Uses the same
+ CPU-based triangulation approach as QPainter's OpenGL 2 paint
+ engine. This is the default on non-NVIDIA hardware when the default,
+ OpenGL Qt Quick scenegraph backend is in use.
+
+ \value Shape.NvprRenderer
+ Path items are rendered by performing OpenGL calls using the
+ \c{GL_NV_path_rendering} extension. This is the default on NVIDIA
+ hardware when the default, OpenGL Qt Quick scenegraph backend is in
+ use.
+
+ \value Shape.SoftwareRenderer
+ Pure QPainter drawing using the raster paint engine. This is the
+ default, and only, option when the Qt Quick scenegraph is running
+ with the \c software backend.
*/
QQuickShape::RendererType QQuickShape::rendererType() const
@@ -686,15 +703,15 @@ QQuickShape::RendererType QQuickShape::rendererType() const
/*!
\qmlproperty bool QtQuick.Shapes::Shape::asynchronous
- When Shape.rendererType is Shape.GeometryRenderer, the input path is
+ When rendererType is \c Shape.GeometryRenderer, the input path is
triangulated on the CPU during the polishing phase of the Shape. This is
- potentially expensive. To offload this work to separate worker threads, set
- this property to \c true.
+ potentially expensive. To offload this work to separate worker threads,
+ set this property to \c true.
When enabled, making a Shape visible will not wait for the content to
become available. Instead, the gui/main thread is not blocked and the
- results of the path rendering are shown only when all the asynchronous work
- has been finished.
+ results of the path rendering are shown only when all the asynchronous
+ work has been finished.
The default value is \c false.
*/
@@ -720,7 +737,7 @@ void QQuickShape::setAsynchronous(bool async)
\qmlproperty bool QtQuick.Shapes::Shape::vendorExtensionsEnabled
This property controls the usage of non-standard OpenGL extensions like
- GL_NV_path_rendering. To disable Shape.NvprRenderer and force a uniform
+ \c GL_NV_path_rendering. To disable Shape.NvprRenderer and force a uniform
behavior regardless of the graphics card and drivers, set this property to
\c false.
@@ -748,15 +765,14 @@ void QQuickShape::setVendorExtensionsEnabled(bool enable)
This property determines the status of the Shape and is relevant when
Shape.asynchronous is set to \c true.
- \list
-
- \li Shape.Null - Not yet initialized.
+ \value Shape.Null
+ Not yet initialized.
- \li Shape.Ready - The Shape has finished processing.
+ \value Shape.Ready
+ The Shape has finished processing.
- \li Shape.Processing - The path is being processed.
-
- \endlist
+ \value Shape.Processing
+ The path is being processed.
*/
QQuickShape::Status QQuickShape::status() const
@@ -801,8 +817,8 @@ static void vpe_clear(QQmlListProperty<QObject> *property)
\qmlproperty list<Object> QtQuick.Shapes::Shape::data
This property holds the ShapePath objects that define the contents of the
- Shape. It can also contain any other type of objects, since Shape, like Item,
- allows adding any visual or non-visual objects as children.
+ Shape. It can also contain any other type of objects, since Shape, like
+ Item, allows adding any visual or non-visual objects as children.
\default
*/
@@ -1010,7 +1026,7 @@ void QQuickShapePrivate::sync()
\ingroup qtquick-paths
\ingroup qtquick-views
\inherits Gradient
- \brief Base type of Shape fill gradients
+ \brief Base type of Shape fill gradients.
\since 5.10
This is an abstract base class for gradients like LinearGradient and
@@ -1028,13 +1044,16 @@ QQuickShapeGradient::QQuickShapeGradient(QObject *parent)
\qmlproperty enumeration QtQuick.Shapes::ShapeGradient::spread
Specifies how the area outside the gradient area should be filled. The
- default value is ShapeGradient.PadSpread.
+ default value is \c ShapeGradient.PadSpread.
- \list
- \li ShapeGradient.PadSpread - The area is filled with the closest stop color.
- \li ShapeGradient.RepeatSpread - The gradient is repeated outside the gradient area.
- \li ShapeGradient.ReflectSpread - The gradient is reflected outside the gradient area.
- \endlist
+ \value ShapeGradient.PadSpread
+ The area is filled with the closest stop color.
+
+ \value ShapeGradient.RepeatSpread
+ The gradient is repeated outside the gradient area.
+
+ \value ShapeGradient.ReflectSpread
+ The gradient is reflected outside the gradient area.
*/
QQuickShapeGradient::SpreadMode QQuickShapeGradient::spread() const
@@ -1058,7 +1077,7 @@ void QQuickShapeGradient::setSpread(SpreadMode mode)
\ingroup qtquick-paths
\ingroup qtquick-views
\inherits ShapeGradient
- \brief Linear gradient
+ \brief Linear gradient.
\since 5.10
Linear gradients interpolate colors between start and end points in Shape
@@ -1083,8 +1102,7 @@ QQuickShapeLinearGradient::QQuickShapeLinearGradient(QObject *parent)
\qmlproperty real QtQuick.Shapes::LinearGradient::y2
These properties define the start and end points between which color
- interpolation occurs. By default both the stard and end points are set to
- (0, 0).
+ interpolation occurs. By default both points are set to (0, 0).
*/
qreal QQuickShapeLinearGradient::x1() const
@@ -1150,7 +1168,7 @@ void QQuickShapeLinearGradient::setY2(qreal v)
\ingroup qtquick-paths
\ingroup qtquick-views
\inherits ShapeGradient
- \brief Radial gradient
+ \brief Radial gradient.
\since 5.10
Radial gradients interpolate colors between a focal circle and a center
@@ -1200,8 +1218,8 @@ QQuickShapeRadialGradient::QQuickShapeRadialGradient(QObject *parent)
\qmlproperty real QtQuick.Shapes::RadialGradient::focalY
These properties define the center and focal points. To specify a simple
- radial gradient, set focalX and focalY to the value of centerX and centerY,
- respectively.
+ radial gradient, set focalX and focalY to the value of centerX and
+ centerY, respectively.
*/
qreal QQuickShapeRadialGradient::centerX() const
@@ -1303,7 +1321,7 @@ void QQuickShapeRadialGradient::setFocalRadius(qreal v)
\ingroup qtquick-paths
\ingroup qtquick-views
\inherits ShapeGradient
- \brief Conical gradient
+ \brief Conical gradient.
\since 5.10
Conical gradients interpolate colors counter-clockwise around a center
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 7ff51bb6d6..18af7e0ab0 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -50,7 +50,7 @@ import Qt.test.qtestroot 1.0
\since 4.8
\ingroup qtquicktest
- \section1 Introduction to QML test cases
+ \section1 Introduction to QML Test Cases
Test cases are written as JavaScript functions within a TestCase
type:
@@ -99,7 +99,7 @@ import Qt.test.qtestroot 1.0
once they have all completed. If a test case doesn't need to run
(because a precondition has failed), then \l optional can be set to true.
- \section1 Data-driven tests
+ \section1 Data-driven Tests
Table data can be provided to a test using a function name that ends
with "_data". Alternatively, the \c init_data() function can be used
@@ -173,7 +173,7 @@ import Qt.test.qtestroot 1.0
To get the effect of the \c{QBENCHMARK_ONCE} macro, prefix the test
function name with "benchmark_once_".
- \section1 Simulating keyboard and mouse events
+ \section1 Simulating Keyboard and Mouse Events
The keyPress(), keyRelease(), and keyClick() methods can be used
to simulate keyboard events within unit tests. The events are
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 61c8665a14..fc9f73a881 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -693,7 +693,7 @@ void QQuickXmlListModelPrivate::clear_role(QQmlListProperty<QQuickXmlListModelRo
populated until the model is loaded.
- \section2 Using key XML roles
+ \section2 Using Key XML Roles
You can define certain roles as "keys" so that when reload() is called,
the model will only add and refresh data that contains new values for
diff --git a/src/particles/qquickangledirection.cpp b/src/particles/qquickangledirection.cpp
index debf52e49b..11a007ca09 100644
--- a/src/particles/qquickangledirection.cpp
+++ b/src/particles/qquickangledirection.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qquickangledirection_p.h"
-#include <stdlib.h>
+#include <QRandomGenerator>
#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -108,8 +108,8 @@ QPointF QQuickAngleDirection::sample(const QPointF &from)
{
Q_UNUSED(from);
QPointF ret;
- qreal theta = m_angle*CONV - m_angleVariation*CONV + rand()/float(RAND_MAX) * m_angleVariation*CONV * 2;
- qreal mag = m_magnitude- m_magnitudeVariation + rand()/float(RAND_MAX) * m_magnitudeVariation * 2;
+ qreal theta = m_angle*CONV - m_angleVariation*CONV + QRandomGenerator::getReal() * m_angleVariation*CONV * 2;
+ qreal mag = m_magnitude- m_magnitudeVariation + QRandomGenerator::getReal() * m_magnitudeVariation * 2;
ret.setX(mag * qCos(theta));
ret.setY(mag * qSin(theta));
return ret;
diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp
index a9645461a5..a2bcd91167 100644
--- a/src/particles/qquickcustomparticle.cpp
+++ b/src/particles/qquickcustomparticle.cpp
@@ -38,10 +38,10 @@
****************************************************************************/
#include "qquickcustomparticle_p.h"
+#include <QtCore/qrandom.h>
#include <QtQuick/private/qquickshadereffectmesh_p.h>
#include <QtQuick/private/qsgshadersourcebuilder_p.h>
#include <QtQml/qqmlinfo.h>
-#include <cstdlib>
QT_BEGIN_NAMESPACE
@@ -425,7 +425,7 @@ void QQuickCustomParticle::buildData(QQuickOpenGLShaderEffectNode *rootNode)
void QQuickCustomParticle::initialize(int gIdx, int pIdx)
{
QQuickParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
- datum->r = rand()/(qreal)RAND_MAX;
+ datum->r = QRandomGenerator::getReal();
}
void QQuickCustomParticle::commit(int gIdx, int pIdx)
diff --git a/src/particles/qquickellipseextruder.cpp b/src/particles/qquickellipseextruder.cpp
index bd3a95d684..fbb11b34cc 100644
--- a/src/particles/qquickellipseextruder.cpp
+++ b/src/particles/qquickellipseextruder.cpp
@@ -39,7 +39,7 @@
#include "qquickellipseextruder_p.h"
#include <qmath.h>
-#include <stdlib.h>
+#include <qrandom.h>
QT_BEGIN_NAMESPACE
/*!
@@ -68,8 +68,8 @@ QQuickEllipseExtruder::QQuickEllipseExtruder(QObject *parent) :
QPointF QQuickEllipseExtruder::extrude(const QRectF & r)
{
- qreal theta = ((qreal)rand()/RAND_MAX) * 6.2831853071795862;
- qreal mag = m_fill ? ((qreal)rand()/RAND_MAX) : 1;
+ qreal theta = QRandomGenerator::bounded(2 * M_PI);
+ qreal mag = m_fill ? QRandomGenerator::getReal() : 1;
return QPointF(r.x() + r.width()/2 + mag * (r.width()/2) * qCos(theta),
r.y() + r.height()/2 + mag * (r.height()/2) * qSin(theta));
}
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 1b3d2eed6b..8f809176a9 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -44,6 +44,7 @@
#include <QtQuick/qsgtexturematerial.h>
#include <QtQuick/qsgtexture.h>
#include <QFile>
+#include <QRandomGenerator>
#include "qquickimageparticle_p.h"
#include "qquickparticleemitter_p.h"
#include <private/qquicksprite_p.h>
@@ -1729,9 +1730,9 @@ void QQuickImageParticle::initialize(int gIdx, int pIdx)
if (!datum->rotationOwner)
datum->rotationOwner = this;
rotation =
- (m_rotation + (m_rotationVariation - 2*((qreal)rand()/RAND_MAX)*m_rotationVariation) ) * CONV;
+ (m_rotation + (m_rotationVariation - 2*QRandomGenerator::bounded(m_rotationVariation)) ) * CONV;
rotationVelocity =
- (m_rotationVelocity + (m_rotationVelocityVariation - 2*((qreal)rand()/RAND_MAX)*m_rotationVelocityVariation) ) * CONV;
+ (m_rotationVelocity + (m_rotationVelocityVariation - 2*QRandomGenerator::bounded(m_rotationVelocityVariation)) ) * CONV;
autoRotate = m_autoRotation?1.0:0.0;
if (datum->rotationOwner == this) {
datum->rotation = rotation;
@@ -1750,10 +1751,10 @@ void QQuickImageParticle::initialize(int gIdx, int pIdx)
if (m_explicitColor) {
if (!datum->colorOwner)
datum->colorOwner = this;
- color.r = m_color.red() * (1 - redVariation) + rand() % 256 * redVariation;
- color.g = m_color.green() * (1 - greenVariation) + rand() % 256 * greenVariation;
- color.b = m_color.blue() * (1 - blueVariation) + rand() % 256 * blueVariation;
- color.a = m_alpha * m_color.alpha() * (1 - m_alphaVariation) + rand() % 256 * m_alphaVariation;
+ color.r = m_color.red() * (1 - redVariation) + QRandomGenerator::bounded(256) * redVariation;
+ color.g = m_color.green() * (1 - greenVariation) + QRandomGenerator::bounded(256) * greenVariation;
+ color.b = m_color.blue() * (1 - blueVariation) + QRandomGenerator::bounded(256) * blueVariation;
+ color.a = m_alpha * m_color.alpha() * (1 - m_alphaVariation) + QRandomGenerator::bounded(256) * m_alphaVariation;
if (datum->colorOwner == this)
datum->color = color;
else
diff --git a/src/particles/qquicklineextruder.cpp b/src/particles/qquicklineextruder.cpp
index 4bcd63543c..6ebd728407 100644
--- a/src/particles/qquicklineextruder.cpp
+++ b/src/particles/qquicklineextruder.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
#include "qquicklineextruder_p.h"
-#include <stdlib.h>
+#include <QRandomGenerator>
#include <cmath>
/*!
@@ -69,10 +69,10 @@ QPointF QQuickLineExtruder::extrude(const QRectF &r)
{
qreal x,y;
if (!r.height()){
- x = r.width() * ((qreal)rand())/RAND_MAX;
+ x = r.width() * QRandomGenerator::getReal();
y = 0;
}else{
- y = r.height() * ((qreal)rand())/RAND_MAX;
+ y = r.height() * QRandomGenerator::getReal();
if (!r.width()){
x = 0;
}else{
diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp
index 93eaaf1a6f..60c23c55a8 100644
--- a/src/particles/qquickmaskextruder.cpp
+++ b/src/particles/qquickmaskextruder.cpp
@@ -42,6 +42,7 @@
#include <QtQml/qqmlinfo.h>
#include <QImage>
#include <QDebug>
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
/*!
\qmltype MaskShape
@@ -102,7 +103,7 @@ QPointF QQuickMaskExtruder::extrude(const QRectF &r)
ensureInitialized(r);
if (!m_mask.count() || m_img.isNull())
return r.topLeft();
- const QPointF p = m_mask[rand() % m_mask.count()];
+ const QPointF p = m_mask[QRandomGenerator::bounded(m_mask.count())];
//### Should random sub-pixel positioning be added?
return p + r.topLeft();
}
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index 9bed25dba6..d18250d706 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -40,6 +40,7 @@
#include "qquickparticleemitter_p.h"
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
@@ -424,7 +425,7 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
datum->t = pt;
datum->lifeSpan =
(m_particleDuration
- + ((rand() % ((m_particleDurationVariation*2) + 1)) - m_particleDurationVariation))
+ + (QRandomGenerator::bounded((m_particleDurationVariation*2) + 1) - m_particleDurationVariation))
/ 1000.0;
if (datum->lifeSpan >= m_system->maxLife){
@@ -461,7 +462,7 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
// Particle size
float sizeVariation = -m_particleSizeVariation
- + rand() / float(RAND_MAX) * m_particleSizeVariation * 2;
+ + QRandomGenerator::bounded(m_particleSizeVariation * 2);
float size = qMax((qreal)0.0 , m_particleSize + sizeVariation);
float endSize = qMax((qreal)0.0 , sizeAtEnd + sizeVariation);
diff --git a/src/particles/qquickparticleextruder.cpp b/src/particles/qquickparticleextruder.cpp
index f1fef58884..74b450921f 100644
--- a/src/particles/qquickparticleextruder.cpp
+++ b/src/particles/qquickparticleextruder.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qquickparticleextruder_p.h"
-#include <stdlib.h>
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
@@ -59,8 +59,8 @@ QQuickParticleExtruder::QQuickParticleExtruder(QObject *parent) :
QPointF QQuickParticleExtruder::extrude(const QRectF &rect)
{
- return QPointF(((qreal)rand() / RAND_MAX) * rect.width() + rect.x(),
- ((qreal)rand() / RAND_MAX) * rect.height() + rect.y());
+ return QPointF(QRandomGenerator::getReal() * rect.width() + rect.x(),
+ QRandomGenerator::getReal() * rect.height() + rect.y());
}
bool QQuickParticleExtruder::contains(const QRectF &bounds, const QPointF &point)
diff --git a/src/particles/qquickpointdirection.cpp b/src/particles/qquickpointdirection.cpp
index 8d602204b5..7b5c9bada1 100644
--- a/src/particles/qquickpointdirection.cpp
+++ b/src/particles/qquickpointdirection.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qquickpointdirection_p.h"
-#include <stdlib.h>
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
@@ -78,8 +78,8 @@ QQuickPointDirection::QQuickPointDirection(QObject *parent) :
QPointF QQuickPointDirection::sample(const QPointF &)
{
QPointF ret;
- ret.setX(m_x - m_xVariation + rand() / float(RAND_MAX) * m_xVariation * 2);
- ret.setY(m_y - m_yVariation + rand() / float(RAND_MAX) * m_yVariation * 2);
+ ret.setX(m_x - m_xVariation + QRandomGenerator::getReal() * m_xVariation * 2);
+ ret.setY(m_y - m_yVariation + QRandomGenerator::getReal() * m_yVariation * 2);
return ret;
}
diff --git a/src/particles/qquickrectangleextruder.cpp b/src/particles/qquickrectangleextruder.cpp
index cb166f1d50..6474f61630 100644
--- a/src/particles/qquickrectangleextruder.cpp
+++ b/src/particles/qquickrectangleextruder.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qquickrectangleextruder_p.h"
-#include <stdlib.h>
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
@@ -60,21 +60,21 @@ QQuickRectangleExtruder::QQuickRectangleExtruder(QObject *parent) :
QPointF QQuickRectangleExtruder::extrude(const QRectF &rect)
{
if (m_fill)
- return QPointF(((qreal)rand() / RAND_MAX) * rect.width() + rect.x(),
- ((qreal)rand() / RAND_MAX) * rect.height() + rect.y());
- int side = rand() % 4;
+ return QPointF(QRandomGenerator::getReal() * rect.width() + rect.x(),
+ QRandomGenerator::getReal() * rect.height() + rect.y());
+ int side = QRandomGenerator::bounded(4);
switch (side){//TODO: Doesn't this overlap the corners?
case 0:
return QPointF(rect.x(),
- ((qreal)rand() / RAND_MAX) * rect.height() + rect.y());
+ QRandomGenerator::getReal() * rect.height() + rect.y());
case 1:
return QPointF(rect.width() + rect.x(),
- ((qreal)rand() / RAND_MAX) * rect.height() + rect.y());
+ QRandomGenerator::getReal() * rect.height() + rect.y());
case 2:
- return QPointF(((qreal)rand() / RAND_MAX) * rect.width() + rect.x(),
+ return QPointF(QRandomGenerator::getReal() * rect.width() + rect.x(),
rect.y());
default:
- return QPointF(((qreal)rand() / RAND_MAX) * rect.width() + rect.x(),
+ return QPointF(QRandomGenerator::getReal() * rect.width() + rect.x(),
rect.height() + rect.y());
}
}
diff --git a/src/particles/qquicktargetdirection.cpp b/src/particles/qquicktargetdirection.cpp
index ee805b4e39..96b78a53b4 100644
--- a/src/particles/qquicktargetdirection.cpp
+++ b/src/particles/qquicktargetdirection.cpp
@@ -41,6 +41,7 @@
#include "qquickparticleemitter_p.h"
#include <cmath>
#include <QDebug>
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
/*!
@@ -117,10 +118,10 @@ QPointF QQuickTargetDirection::sample(const QPointF &from)
targetX = m_targetX;
targetY = m_targetY;
}
- targetX += 0 - from.x() - m_targetVariation + rand()/(float)RAND_MAX * m_targetVariation*2;
- targetY += 0 - from.y() - m_targetVariation + rand()/(float)RAND_MAX * m_targetVariation*2;
+ targetX += 0 - from.x() - m_targetVariation + QRandomGenerator::getReal() * m_targetVariation*2;
+ targetY += 0 - from.y() - m_targetVariation + QRandomGenerator::getReal() * m_targetVariation*2;
qreal theta = std::atan2(targetY, targetX);
- qreal mag = m_magnitude + rand()/(float)RAND_MAX * m_magnitudeVariation * 2 - m_magnitudeVariation;
+ qreal mag = m_magnitude + QRandomGenerator::getReal() * m_magnitudeVariation * 2 - m_magnitudeVariation;
if (m_proportionalMagnitude)
mag *= std::sqrt(targetX * targetX + targetY * targetY);
ret.setX(mag * std::cos(theta));
diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp
index a5bf0e9d21..14075f6b23 100644
--- a/src/particles/qquicktrailemitter.cpp
+++ b/src/particles/qquicktrailemitter.cpp
@@ -40,6 +40,7 @@
#include "qquicktrailemitter_p.h"
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
+#include <QRandomGenerator>
#include <cmath>
QT_BEGIN_NAMESPACE
@@ -207,7 +208,7 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
datum->t = pt;
datum->lifeSpan =
(m_particleDuration
- + ((rand() % ((m_particleDurationVariation*2) + 1)) - m_particleDurationVariation))
+ + (QRandomGenerator::bounded((m_particleDurationVariation*2) + 1) - m_particleDurationVariation))
/ 1000.0;
// Particle position
@@ -240,7 +241,7 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
// Particle size
float sizeVariation = -m_particleSizeVariation
- + rand() / float(RAND_MAX) * m_particleSizeVariation * 2;
+ + QRandomGenerator::getReal() * m_particleSizeVariation * 2;
float size = qMax((qreal)0.0, m_particleSize + sizeVariation);
float endSize = qMax((qreal)0.0, sizeAtEnd + sizeVariation);
diff --git a/src/particles/qquickwander.cpp b/src/particles/qquickwander.cpp
index 099b453808..cfdede440b 100644
--- a/src/particles/qquickwander.cpp
+++ b/src/particles/qquickwander.cpp
@@ -39,6 +39,7 @@
#include "qquickwander_p.h"
#include "qquickparticlesystem_p.h"//for ParticlesVertices
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
/*!
\qmltype Wander
@@ -102,8 +103,8 @@ WanderData* QQuickWanderAffector::getData(int idx)
d->y_vel = 0;
d->x_peak = m_xVariance;
d->y_peak = m_yVariance;
- d->x_var = m_pace * qreal(qrand()) / RAND_MAX;
- d->y_var = m_pace * qreal(qrand()) / RAND_MAX;
+ d->x_var = m_pace * QRandomGenerator::getReal();
+ d->y_var = m_pace * QRandomGenerator::getReal();
m_wanderData.insert(idx, d);
return d;
@@ -124,7 +125,7 @@ bool QQuickWanderAffector::affectParticle(QQuickParticleData* data, qreal dt)
if (m_xVariance != 0.) {
if ((d->x_vel > d->x_peak && d->x_var > 0.0) || (d->x_vel < -d->x_peak && d->x_var < 0.0)) {
d->x_var = -d->x_var;
- d->x_peak = m_xVariance + m_xVariance * qreal(qrand()) / RAND_MAX;
+ d->x_peak = m_xVariance + m_xVariance * QRandomGenerator::getReal();
}
d->x_vel += d->x_var * dt;
}
@@ -133,7 +134,7 @@ bool QQuickWanderAffector::affectParticle(QQuickParticleData* data, qreal dt)
if (m_yVariance != 0.) {
if ((d->y_vel > d->y_peak && d->y_var > 0.0) || (d->y_vel < -d->y_peak && d->y_var < 0.0)) {
d->y_var = -d->y_var;
- d->y_peak = m_yVariance + m_yVariance * qreal(qrand()) / RAND_MAX;
+ d->y_peak = m_yVariance + m_yVariance * QRandomGenerator::getReal();
}
d->y_vel += d->y_var * dt;
}
@@ -146,8 +147,8 @@ bool QQuickWanderAffector::affectParticle(QQuickParticleData* data, qreal dt)
p->y += dy;
return true;
*/
- qreal dx = dt * m_pace * (2 * qreal(qrand())/RAND_MAX - 1);
- qreal dy = dt * m_pace * (2 * qreal(qrand())/RAND_MAX - 1);
+ qreal dx = dt * m_pace * (2 * QRandomGenerator::getReal() - 1);
+ qreal dy = dt * m_pace * (2 * QRandomGenerator::getReal() - 1);
qreal newX, newY;
switch (m_affectedParameter){
case Position:
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 58588e4ad5..890f4c47de 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -97,6 +97,7 @@ static QString cacheFilePath(const QUrl &url)
CompilationUnit::CompilationUnit()
: data(0)
, engine(0)
+ , qmlEngine(0)
, runtimeLookups(0)
, runtimeRegularExpressions(0)
, runtimeClasses(0)
@@ -213,8 +214,8 @@ void CompilationUnit::unlink()
if (isRegisteredWithEngine) {
Q_ASSERT(data && quint32(propertyCaches.count()) > data->indexOfRootObject && propertyCaches.at(data->indexOfRootObject));
- if (engine)
- QQmlEnginePrivate::get(engine)->unregisterInternalCompositeType(this);
+ if (qmlEngine)
+ qmlEngine->unregisterInternalCompositeType(this);
QQmlMetaType::unregisterInternalCompositeType(this);
isRegisteredWithEngine = false;
}
@@ -231,6 +232,7 @@ void CompilationUnit::unlink()
resolvedTypes.clear();
engine = 0;
+ qmlEngine = 0;
free(runtimeStrings);
runtimeStrings = 0;
delete [] runtimeLookups;
@@ -260,9 +262,6 @@ void CompilationUnit::markObjects(QV4::MarkStack *markStack)
void CompilationUnit::destroy()
{
- QQmlEngine *qmlEngine = 0;
- if (engine && engine->v8Engine)
- qmlEngine = engine->v8Engine->engine();
if (qmlEngine)
QQmlEnginePrivate::deleteInEngineThread(qmlEngine, this);
else
@@ -285,12 +284,14 @@ IdentifierHash<int> CompilationUnit::namedObjectsPerComponent(int componentObjec
return *it;
}
-void CompilationUnit::finalize(QQmlEnginePrivate *engine)
+void CompilationUnit::finalizeCompositeType(QQmlEnginePrivate *qmlEngine)
{
+ this->qmlEngine = qmlEngine;
+
// Add to type registry of composites
if (propertyCaches.needsVMEMetaObject(data->indexOfRootObject)) {
QQmlMetaType::registerInternalCompositeType(this);
- engine->registerInternalCompositeType(this);
+ qmlEngine->registerInternalCompositeType(this);
} else {
const QV4::CompiledData::Object *obj = objectAt(data->indexOfRootObject);
auto *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex);
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 79476dbe5e..e2cdc3d8fc 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -879,6 +879,7 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public CompilationUnitBase, public
#ifndef V4_BOOTSTRAP
ExecutionEngine *engine;
+ QQmlEnginePrivate *qmlEngine; // only used in QML environment for composite types, not in plain QJSEngine case.
QString fileName() const { return data->stringAt(data->sourceFileIndex); }
QUrl url() const { if (m_url.isNull) m_url = QUrl(fileName()); return m_url; }
@@ -908,7 +909,7 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public CompilationUnitBase, public
// pointers either to data->constants() or little-endian memory copy.
const Value* constants;
- void finalize(QQmlEnginePrivate *engine);
+ void finalizeCompositeType(QQmlEnginePrivate *qmlEngine);
int totalBindingsCount; // Number of bindings used in this type
int totalParserStatusCount; // Number of instantiated types that are QQmlParserStatus subclasses
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc
index c3d073872a..65559f640a 100644
--- a/src/qml/doc/src/cppintegration/data.qdoc
+++ b/src/qml/doc/src/cppintegration/data.qdoc
@@ -347,7 +347,7 @@ them with default constructed values, do not use the indexed delete operator
("delete sequence[i]") but instead use the \c {splice} function
("sequence.splice(startIndex, deleteCount)").
-\section2 Value types
+\section2 Value Types
Some value types in Qt such as QPoint are represented in JavaScript as objects
that have the same properties and functions like in the C++ API. The same
diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc
index 1ce00c6ad0..91f916c699 100644
--- a/src/qml/doc/src/cppintegration/definetypes.qdoc
+++ b/src/qml/doc/src/cppintegration/definetypes.qdoc
@@ -606,7 +606,6 @@ public:
RandomNumberGenerator(QObject *parent)
: QObject(parent), m_maxValue(100)
{
- qsrand(QDateTime::currentMSecsSinceEpoch() / 1000);
QObject::connect(&m_timer, SIGNAL(timeout()), SLOT(updateProperty()));
m_timer.start(500);
}
@@ -621,7 +620,7 @@ signals:
private slots:
void updateProperty() {
- m_targetProperty.write(qrand() % m_maxValue);
+ m_targetProperty.write(QRandomGenerator::bounded(m_maxValue));
}
private:
diff --git a/src/qml/doc/src/qmllanguageref/documents/topic.qdoc b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
index 840afa9a0e..bc104e9c8a 100644
--- a/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
@@ -86,7 +86,7 @@ Please see the documentation about the \l{qtqml-syntax-basics.html}
documentation about \l{qtqml-javascript-topic.html}
{integrating QML and JavaScript} for in-depth information on that topic.
-\section1 Defining Object Types through QML Documents
+\section1 Defining Object Types Through QML Documents
As described briefly in the previous section, a document implicitly defines
a QML object type. One of the core principles of QML is the ability to define
diff --git a/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
index b0aab1c73a..d1d28381b5 100644
--- a/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
@@ -50,7 +50,7 @@ and registering the type with the QML engine, as discussed in
\section1 Defining Object Types from QML
-\section2 Defining Object Types through QML Documents
+\section2 Defining Object Types Through QML Documents
Plugin writers and application developers may provide types defined as QML
documents. A QML document, when visible to the QML import system, defines a
diff --git a/src/qml/doc/src/statemachine.qdoc b/src/qml/doc/src/statemachine.qdoc
index 56a8746e1e..b0bfef4f69 100644
--- a/src/qml/doc/src/statemachine.qdoc
+++ b/src/qml/doc/src/statemachine.qdoc
@@ -61,7 +61,7 @@
\annotatedlist statemachine-qmltypes
- \section1 Using both QtQuick and QtQml.StateMachine imports
+ \section1 Using Both QtQuick and QtQml.StateMachine Imports
\warning If you're attempting to import both \l{QtQuick} and
\e{QtQml.StateMachine} in one single QML file, make sure to import
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 2c1fefe9f8..cdf5c3117c 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -42,6 +42,7 @@
#include <QtCore/qdatetime.h>
#include <QtCore/qmath.h>
+#include <QtCore/qrandom.h>
#include <QtCore/private/qnumeric_p.h>
#include <QtCore/qthreadstorage.h>
@@ -273,20 +274,9 @@ ReturnedValue MathObject::method_pow(const BuiltinFunction *, CallData *callData
RETURN_RESULT(Encode(qt_qnan()));
}
-Q_GLOBAL_STATIC(QThreadStorage<bool *>, seedCreatedStorage);
-
-ReturnedValue MathObject::method_random(const BuiltinFunction *b, CallData *)
+ReturnedValue MathObject::method_random(const BuiltinFunction *, CallData *)
{
- if (!seedCreatedStorage()->hasLocalData()) {
- int msecs = QTime(0,0,0).msecsTo(QTime::currentTime());
- Q_ASSERT(msecs >= 0);
- qsrand(uint(uint(msecs) ^ reinterpret_cast<quintptr>(b)));
- seedCreatedStorage()->setLocalData(new bool(true));
- }
- // rand()/qrand() return a value where the upperbound is RAND_MAX inclusive. So, instead of
- // dividing by RAND_MAX (which would return 0..RAND_MAX inclusive), we divide by RAND_MAX + 1.
- qint64 upperLimit = qint64(RAND_MAX) + 1;
- RETURN_RESULT(Encode(qrand() / double(upperLimit)));
+ RETURN_RESULT(Encode(QRandomGenerator::getReal()));
}
ReturnedValue MathObject::method_round(const BuiltinFunction *, CallData *callData)
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index 1476c276f4..531d9ae457 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -523,7 +523,7 @@ QQmlContextData::QQmlContextData()
QQmlContextData::QQmlContextData(QQmlContext *ctxt)
: parent(0), engine(0), isInternal(false), ownedByParent(false), isJSContext(false),
isPragmaLibraryContext(false), unresolvedNames(false), hasEmittedDestruction(false), isRootObjectInCreation(false),
- publicContext(ctxt), activeVMEData(0), componentObjectIndex(-1),
+ publicContext(ctxt), incubator(0), componentObjectIndex(-1),
contextObject(0), childContexts(0), nextChild(0), prevChild(0),
expressions(0), contextObjects(0), contextGuards(0), idValues(0), idValueCount(0), linkedContext(0),
componentAttached(0)
diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h
index 4d2bb72352..a259fd62d8 100644
--- a/src/qml/qml/qqmlcontext_p.h
+++ b/src/qml/qml/qqmlcontext_p.h
@@ -78,6 +78,7 @@ class QQmlExpression;
class QQmlExpressionPrivate;
class QQmlJavaScriptExpression;
class QQmlContextData;
+class QQmlIncubatorPrivate;
class QQmlContextPrivate : public QObjectPrivate
{
@@ -145,8 +146,8 @@ public:
quint32 dummy:25;
QQmlContext *publicContext;
- // VME data that is constructing this context if any
- void *activeVMEData;
+ // The incubator that is constructing this context if any
+ QQmlIncubatorPrivate *incubator;
// Compilation unit for contexts that belong to a compiled type.
QQmlRefPointer<QV4::CompiledData::CompilationUnit> typeCompilationUnit;
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index da8ea24ea0..fd74a233a4 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -204,7 +204,7 @@ public:
template<typename T>
inline void deleteInEngineThread(T *);
template<typename T>
- inline static void deleteInEngineThread(QQmlEngine *, T *);
+ inline static void deleteInEngineThread(QQmlEnginePrivate *, T *);
QString offlineStorageDatabaseDirectory() const;
// These methods may be called from the loader thread
@@ -359,10 +359,10 @@ Delete \a value in the \a engine thread. If the calling thread is the engine
thread, \a value will be deleted immediately.
*/
template<typename T>
-void QQmlEnginePrivate::deleteInEngineThread(QQmlEngine *engine, T *value)
+void QQmlEnginePrivate::deleteInEngineThread(QQmlEnginePrivate *engine, T *value)
{
Q_ASSERT(engine);
- QQmlEnginePrivate::get(engine)->deleteInEngineThread<T>(value);
+ engine->deleteInEngineThread<T>(value);
}
/*!
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index 54d0b240f5..6d0e4b915a 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -45,9 +45,6 @@
#include "qqmlmemoryprofiler_p.h"
#include "qqmlobjectcreator_p.h"
-// XXX TODO
-// - check that the Component.onCompleted behavior is the same as 4.8 in the synchronous and
-// async if nested cases
void QQmlEnginePrivate::incubate(QQmlIncubator &i, QQmlContextData *forContext)
{
QExplicitlySharedDataPointer<QQmlIncubatorPrivate> p(i.d);
@@ -64,8 +61,8 @@ void QQmlEnginePrivate::incubate(QQmlIncubator &i, QQmlContextData *forContext)
QExplicitlySharedDataPointer<QQmlIncubatorPrivate> parentIncubator;
QQmlContextData *cctxt = forContext;
while (cctxt) {
- if (cctxt->activeVMEData) {
- parentIncubator = (QQmlIncubatorPrivate *)cctxt->activeVMEData;
+ if (cctxt->incubator) {
+ parentIncubator = cctxt->incubator;
break;
}
cctxt = cctxt->parent;
@@ -152,7 +149,7 @@ void QQmlIncubatorPrivate::clear()
}
enginePriv = 0;
if (!rootContext.isNull()) {
- rootContext->activeVMEData = 0;
+ rootContext->incubator = 0;
rootContext = 0;
}
@@ -388,7 +385,7 @@ void QQmlIncubatorPrivate::cancel(QObject *object, QQmlContext *context)
return;
QQmlContextData *data = QQmlContextData::get(context);
- QQmlIncubatorPrivate *p = (QQmlIncubatorPrivate *)data->activeVMEData;
+ QQmlIncubatorPrivate *p = data->incubator;
if (!p)
return;
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index cc9cc889d0..11d090a415 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -70,14 +70,15 @@ struct ActiveOCRestorer
};
}
-QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QV4::CompiledData::CompilationUnit *compilationUnit, QQmlContextData *creationContext, void *activeVMEDataForRootContext)
+QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QV4::CompiledData::CompilationUnit *compilationUnit, QQmlContextData *creationContext,
+ QQmlIncubatorPrivate *incubator)
: phase(Startup)
, compilationUnit(compilationUnit)
, resolvedTypes(compilationUnit->resolvedTypes)
, propertyCaches(&compilationUnit->propertyCaches)
, sharedState(new QQmlObjectCreatorSharedState)
, topLevelCreator(true)
- , activeVMEDataForRootContext(activeVMEDataForRootContext)
+ , incubator(incubator)
{
init(parentContext);
@@ -104,7 +105,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QV4::Compil
, propertyCaches(&compilationUnit->propertyCaches)
, sharedState(inheritedSharedState)
, topLevelCreator(false)
- , activeVMEDataForRootContext(0)
+ , incubator(0)
{
init(parentContext);
}
@@ -176,7 +177,7 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
if (!sharedState->rootContext) {
sharedState->rootContext = context;
- sharedState->rootContext->activeVMEData = activeVMEDataForRootContext;
+ sharedState->rootContext->incubator = incubator;
sharedState->rootContext->isRootObjectInCreation = true;
}
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h
index 45c14f0963..35bf96db4e 100644
--- a/src/qml/qml/qqmlobjectcreator_p.h
+++ b/src/qml/qml/qqmlobjectcreator_p.h
@@ -65,6 +65,7 @@ QT_BEGIN_NAMESPACE
class QQmlAbstractBinding;
struct QQmlTypeCompiler;
class QQmlInstantiationInterrupt;
+class QQmlIncubatorPrivate;
struct QQmlObjectCreatorSharedState : public QSharedData
{
@@ -84,7 +85,7 @@ class QQmlObjectCreator
{
Q_DECLARE_TR_FUNCTIONS(QQmlObjectCreator)
public:
- QQmlObjectCreator(QQmlContextData *parentContext, QV4::CompiledData::CompilationUnit *compilationUnit, QQmlContextData *creationContext, void *activeVMEDataForRootContext = 0);
+ QQmlObjectCreator(QQmlContextData *parentContext, QV4::CompiledData::CompilationUnit *compilationUnit, QQmlContextData *creationContext, QQmlIncubatorPrivate *incubator = 0);
~QQmlObjectCreator();
QObject *create(int subComponentIndex = -1, QObject *parent = 0, QQmlInstantiationInterrupt *interrupt = 0);
@@ -143,7 +144,7 @@ private:
const QQmlPropertyCacheVector *propertyCaches;
QExplicitlySharedDataPointer<QQmlObjectCreatorSharedState> sharedState;
bool topLevelCreator;
- void *activeVMEDataForRootContext;
+ QQmlIncubatorPrivate *incubator;
QObject *_qobject;
QObject *_scopeObject;
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 21bbcadb1c..9a138dcf80 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -798,7 +798,7 @@ QQmlPropertyPrivate::binding(QObject *object, QQmlPropertyIndex index)
const int coreIndex = index.coreIndex();
const int valueTypeIndex = index.valueTypeIndex();
- if (!data->hasBindingBit(coreIndex))
+ if (coreIndex < 0 || !data->hasBindingBit(coreIndex))
return 0;
QQmlAbstractBinding *binding = data->bindings;
@@ -1546,6 +1546,9 @@ bool QQmlProperty::connectNotifySignal(QObject *dest, int method) const
represent a regular Qt property or if it has no
change notifier signal, or if the \a dest object does
not have the specified \a slot.
+
+ \note \a slot should be passed using the SLOT() macro so it is
+ correctly identified.
*/
bool QQmlProperty::connectNotifySignal(QObject *dest, const char *slot) const
{
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 013ed48c70..38c14c2979 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2296,7 +2296,7 @@ void QQmlTypeData::done()
}
}
- m_compiledData->finalize(enginePrivate);
+ m_compiledData->finalizeCompositeType(enginePrivate);
}
{
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 2b54819ad0..bb70d88470 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -644,8 +644,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void *
if (t == QV4::CompiledData::Property::Var) {
// the context can be null if accessing var properties from cpp after re-parenting an item.
QQmlEnginePrivate *ep = (ctxt == 0 || ctxt->engine == 0) ? 0 : QQmlEnginePrivate::get(ctxt->engine);
- QV8Engine *v8e = (ep == 0) ? 0 : ep->v8engine();
- if (v8e) {
+ if (ep) {
if (c == QMetaObject::ReadProperty) {
*reinterpret_cast<QVariant *>(a[0]) = readPropertyAsVariant(id);
} else if (c == QMetaObject::WriteProperty) {
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index da644becc2..91c5a50877 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -102,7 +102,7 @@ void QQmlBindPrivate::validate(QObject *binding) const
In QML, property bindings result in a dependency between the properties of
different objects.
- \section1 Binding to an inaccessible property
+ \section1 Binding to an Inaccessible Property
Sometimes it is necessary to bind an object's property to
that of another object that isn't directly instantiated by QML, such as a
@@ -120,7 +120,7 @@ void QQmlBindPrivate::validate(QObject *binding) const
When \c{text} changes, the C++ property \c{enteredText} will update
automatically.
- \section1 Conditional bindings
+ \section1 Conditional Bindings
In some cases you may want to modify the value of a property when a certain
condition is met but leave it unmodified otherwise. Often, it's not possible
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index f62f66170e..8cf0d2918e 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -277,6 +277,11 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
}
#endif
+#ifdef Q_OS_ANDROID
+ if (testPath.isEmpty())
+ testPath = QLatin1String(":/");
+#endif
+
// Determine where to look for the test data.
if (testPath.isEmpty() && sourceDir) {
const QString s = QString::fromLocal8Bit(sourceDir);
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index dc7b917bc4..663d3c64e1 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -156,7 +156,7 @@ namespace QtQuickTest
return;
}
- QPoint pos;
+ QPoint pos = _pos.toPoint();
QQuickItem *sgitem = qobject_cast<QQuickItem *>(item);
if (sgitem)
pos = sgitem->mapToScene(_pos).toPoint();
diff --git a/src/quick/doc/snippets/qml/loader/KeyReader.qml b/src/quick/doc/snippets/qml/loader/KeyReader.qml
index 41eb208dd0..56604319e0 100644
--- a/src/quick/doc/snippets/qml/loader/KeyReader.qml
+++ b/src/quick/doc/snippets/qml/loader/KeyReader.qml
@@ -43,7 +43,7 @@ Item {
Item {
focus: true
Keys.onPressed: {
- console.log("Loaded item captured:",
+ console.log("KeyReader captured:",
event.text);
event.accepted = true;
}
diff --git a/src/quick/doc/snippets/qml/loader/focus.qml b/src/quick/doc/snippets/qml/loader/focus.qml
index 5634a48ad1..f3509021f1 100644
--- a/src/quick/doc/snippets/qml/loader/focus.qml
+++ b/src/quick/doc/snippets/qml/loader/focus.qml
@@ -49,11 +49,14 @@ Rectangle {
MouseArea {
anchors.fill: parent
- onClicked: loader.source = "KeyReader.qml"
+ onClicked: {
+ loader.source = "KeyReader.qml"
+ }
}
Keys.onPressed: {
- console.log("Captured:", event.text);
+ console.log("Captured:",
+ event.text);
}
}
//![0]
diff --git a/src/quick/doc/src/advtutorial.qdoc b/src/quick/doc/src/advtutorial.qdoc
index 6aeabbd7b5..025f902a6b 100644
--- a/src/quick/doc/src/advtutorial.qdoc
+++ b/src/quick/doc/src/advtutorial.qdoc
@@ -70,7 +70,7 @@ directory.
\example tutorials/samegame/samegame1
-\section2 Creating the application screen
+\section2 Creating the Application Screen
The first step is to create the basic QML items in your application.
@@ -92,7 +92,7 @@ and is used to give the button a more native look-and-feel.
Notice the anchors for the \c Item, \c Button and \c Text types are set using
group (dot) notation for readability.
-\section2 Adding \c Button and \c Block components
+\section2 Adding \c Button and \c Block Components
The \c Button item in the code above is defined in a separate component file named \c Button.qml.
To create a functional button, we use the QML types \l Text and \l MouseArea inside a \l Rectangle.
@@ -138,7 +138,7 @@ types to get started. Next, we will populate the game canvas with some blocks.
\example tutorials/samegame/samegame2
-\section2 Generating the blocks in JavaScript
+\section2 Generating the Blocks in JavaScript
Now that we've written some types, let's start writing the game.
@@ -181,7 +181,7 @@ and moves the new block to its position on the game canvas. This involves severa
\endlist
-\section2 Connecting JavaScript components to QML
+\section2 Connecting JavaScript Components to QML
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
@@ -212,7 +212,7 @@ Now, we have a screen of blocks, and we can begin to add the game mechanics.
\example tutorials/samegame/samegame3
-\section2 Making a playable game
+\section2 Making a Playable Game
Now that we have all the game components, we can add the game logic that
dictates how a player interacts with the blocks and plays the game
@@ -230,7 +230,7 @@ To do this, we have added the following functions to \c samegame.js:
As this is a tutorial about QML, not game design, we will only discuss \c handleClick() and \c victoryCheck() below since they interface directly with the QML types. Note that although the game logic here is written in JavaScript, it could have been written in C++ and then exposed to QML.
-\section3 Enabling mouse click interaction
+\section3 Enabling Mouse Click Interaction
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:
@@ -248,7 +248,7 @@ When clicked, the \l MouseArea calls \c{handleClick()} in \c samegame.js, which
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.
-\section3 Updating the score
+\section3 Updating the Score
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:
@@ -267,14 +267,14 @@ And this is how it is used in the main \c samegame.qml file:
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.
-\section3 A dash of color
+\section3 A Dash of Color
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 tutorials/samegame/samegame3/Block.qml 0
-\section2 A working game
+\section2 A Working Game
Now we now have a working game! The blocks can be clicked, the player can score, and the game can end (and then you can start a new one).
Here is a screenshot of what has been accomplished so far:
@@ -298,7 +298,7 @@ until the next chapter - where your application becomes alive!
\example tutorials/samegame/samegame4
-\section2 Adding some flair
+\section2 Adding Some Flair
Now we're going to do two things to liven up the game: animate the blocks and add a High Score system.
@@ -307,7 +307,7 @@ JavaScript and QML files outside of \c samegame.qml have been moved into a new s
In anticipation of the new block animations, \c Block.qml file is now renamed to \c BoomBlock.qml.
-\section3 Animating block movement
+\section3 Animating Block Movement
First we will animate the blocks so that they move in a fluid manner. QML has a number of methods for adding fluid
movement, and in this case we're going to use the \l Behavior type to add a \l SpringAnimation.
@@ -324,7 +324,7 @@ This ensures the \l SpringAnimation on the \c x is only enabled after \c createB
the correct position. Otherwise, the blocks will slide out of the corner (0,0) when a game begins, instead of falling
from the top in rows. (Try commenting out \c {enabled: spawned} and see for yourself.)
-\section3 Animating block opacity changes
+\section3 Animating Block Opacity Changes
Next, we will add a smooth exit animation. For this, we'll use a \l Behavior type, which allows us to specify
a default animation when a property change occurs. In this case, when the \c opacity of a Block changes, we will
@@ -353,7 +353,7 @@ Initially, we add these States to the root type of \c{BoomBlock.qml}:
Now blocks will automatically fade in, as we already set \c spawned to true when we implemented the block animations.
To fade out, we set \c dying to true instead of setting opacity to 0 when a block is destroyed (in the \c floodFill() function).
-\section3 Adding particle effects
+\section3 Adding Particle Effects
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:
@@ -374,7 +374,7 @@ player's actions. The end result is shown below, with a different set of images
The theme change here is produced simply by replacing the block images. This can be done at runtime by changing the \l Image \c source property, so for a further challenge, you could add a button that toggles between themes with different images.
-\section2 Keeping a High Scores table
+\section2 Keeping a High Scores Table
Another feature we might want to add to the game is a method of storing and retrieving high scores.
@@ -409,7 +409,7 @@ The \c nameInputDialog is activated in the \c victoryCheck() function in \c same
\dots 4
\snippet tutorials/samegame/samegame4/content/samegame.js 4
-\section3 Storing high scores offline
+\section3 Storing High Scores Offline
Now we need to implement the functionality to actually save the High Scores table.
@@ -423,7 +423,7 @@ Then, we use the \l{QtQuick.LocalStorage}{Local Storage API} to maintain a persi
This is one way of storing and displaying high scores locally, but certainly not the only way. A more complex alternative would be to create a high score dialog component, and pass it the results for processing and display (instead of reusing the \c Dialog). This would allow a more themeable dialog that could better present the high scores. If your QML is the UI for a C++ application, you could also have passed the score to a C++ function to store it locally in a variety of ways, including a simple format without SQL or in another SQL database.
-\section3 Storing high scores online
+\section3 Storing High Scores Online
You've seen how you can store high scores locally, but it is also easy to integrate a web-enabled high score storage into your QML application. The implementation we've done her is very
simple: the high score data is posted to a php script running on a server somewhere, and that server then stores it and
@@ -445,7 +445,7 @@ An alternate way to access and submit web-based data would be to use QML types d
makes it very easy to fetch and display XML based data such as RSS in a QML application (see the Flickr demo for an example).
-\section2 That's it!
+\section2 That's It!
By following this tutorial you've seen how you can write a fully functional application in QML:
diff --git a/src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc b/src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc
index 0be66fad2c..f65b1152e9 100644
--- a/src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc
+++ b/src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc
@@ -43,7 +43,7 @@
\annotatedlist layouts
- \section1 Related information
+ \section1 Related Information
\list
\li \l{Qt Quick}
diff --git a/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc
index e5834eb5c8..05e4465f2a 100644
--- a/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc
+++ b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc
@@ -33,7 +33,7 @@
Qt Quick Layouts are items that are used to arrange items in a user interface. Since Qt Quick
Layouts also resize their items, they are well suited for resizable user interfaces.
- \section1 Getting started
+ \section1 Getting Started
The QML types can be imported into your application using the following import statement in your \c {.qml} file.
@@ -152,7 +152,7 @@
height specified in the QML file.
- \section1 Connecting windows and layouts
+ \section1 Connecting Windows and Layouts
You can just use normal anchoring concepts to ensure that the layout will follow the window
resizing.
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index 12a107491a..8c647a5eaa 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -75,7 +75,7 @@ The API works just like with \l QStringList, as shown in the previous section.
have changed. If the QVariantList changes, it will be necessary to reset
the model.
-\section2 QObjectList-based model
+\section2 QObjectList-based Model
A list of QObject* values can also be used as a model. A QList<QObject*> provides
the properties of the objects in the list as roles.
@@ -112,7 +112,7 @@ has changed. If the QList changes, it is necessary to reset
the model by calling QQmlContext::setContextProperty() again.
-\section2 QAbstractItemModel subclass
+\section2 QAbstractItemModel Subclass
A model can be defined by subclassing QAbstractItemModel. This is the
best approach if you have a more complex model that cannot be supported
diff --git a/src/quick/doc/src/concepts/statesanimations/animations.qdoc b/src/quick/doc/src/concepts/statesanimations/animations.qdoc
index 1a2cff43f4..146902ecf1 100644
--- a/src/quick/doc/src/concepts/statesanimations/animations.qdoc
+++ b/src/quick/doc/src/concepts/statesanimations/animations.qdoc
@@ -139,7 +139,7 @@ values.
\target qml-transition-animations
-\section2 Transitions during State Changes
+\section2 Transitions During State Changes
\l{State}{Qt Quick States} are property configurations where a property may have different values to reflect different states. State changes introduce
abrupt property changes; animations smooth transitions to produce visually
diff --git a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
index bcfdf311af..ba5b97da39 100644
--- a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
@@ -35,7 +35,7 @@ Originally Qt Quick always relied on OpenGL (OpenGL ES 2.0 or OpenGL 2.0) for pa
the scene graph and rendering the results to a render target. From Qt 5.8 onwards
Qt Quick also supports rendering in software and with Direct3D 12.
-\section1 Switching between the adaptation used by the application
+\section1 Switching Between the Adaptation Used by the Application
The default rendering backend is still OpenGL, or - in Qt builds with disabled OpenGL support -
the software renderer. This can be overridden either by using an environment variable
@@ -261,7 +261,7 @@ offscreen render targets will be created with the specified sample count and a
quality of the maximum supported quality level. The backend automatically
performs resolving into the non-multisample swapchain buffers after each frame.
-\section2 Semi-transparent windows
+\section2 Semi-transparent Windows
When the alpha channel is enabled either via
QQuickWindow::setDefaultAlphaBuffer() or by setting alphaBufferSize to a
@@ -286,7 +286,7 @@ power-of-two images at the moment. Textures of other size will work too, but
this involves a QImage-based scaling on the CPU first. Therefore avoid enabling
mipmapping for NPOT images whenever possible.
-\section2 Image formats
+\section2 Image Formats
When creating textures via the C++ scenegraph APIs like
QQuickWindow::createTextureFromImage(), 32-bit formats will not involve any
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
index cb14c72b04..a7666d725e 100644
--- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
@@ -540,7 +540,7 @@ with multiple windows.
and may trigger early-z when available, but again, setting
Item::visible to false is always faster.
- \section2 Mixing with 3D primitives
+ \section2 Mixing with 3D Primitives
The scene graph can support pseudo 3D and proper 3D primitives. For
instance, one can implement a "page curl" effect using a
diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc
index 7c7bdbc137..0c2e2bc73d 100644
--- a/src/quick/doc/src/qmltypereference.qdoc
+++ b/src/quick/doc/src/qmltypereference.qdoc
@@ -171,6 +171,7 @@ available when you import \c QtQuick.
\li \l real \c font.letterSpacing
\li \l real \c font.wordSpacing
\li \l bool \c font.kerning
+ \li \l bool \c font.preferShaping
\li \l enumeration \c font.hintingPreference
\endlist
diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc
index e44129de83..6084a8a686 100644
--- a/src/quick/doc/src/tutorial.qdoc
+++ b/src/quick/doc/src/tutorial.qdoc
@@ -99,7 +99,7 @@ In this case, we specify that our text type should be horizontally centered in t
The \c font.pointSize and \c font.bold properties are related to fonts and use the dot notation.
-\section2 Viewing the example
+\section2 Viewing the Example
To view what you have created, run the \l{Prototyping with qmlscene}{qmlscene} tool (located in the \c bin directory) with your filename as the first argument.
For example, to run the provided completed Tutorial 1 example from the install location, you would type:
@@ -167,7 +167,7 @@ the same size as its parent.
A \l MouseArea defines a signal called \e clicked.
When this signal is triggered we want to emit our own \e clicked signal with the color as parameter.
-\section2 The main QML file
+\section2 The Main QML File
In our main QML file, we use our \c Cell component to create the color picker:
diff --git a/src/quick/handlers/handlers.pri b/src/quick/handlers/handlers.pri
index 17066bb33a..9e32b9278c 100644
--- a/src/quick/handlers/handlers.pri
+++ b/src/quick/handlers/handlers.pri
@@ -1,20 +1,20 @@
HEADERS += \
$$PWD/qquickdraghandler_p.h \
$$PWD/qquickhandlersmodule_p.h \
- $$PWD/qquickmultipointerhandler_p.h \
+ $$PWD/qquickmultipointhandler_p.h \
$$PWD/qquickpinchhandler_p.h \
$$PWD/qquickpointerdevicehandler_p.h \
$$PWD/qquickpointerhandler_p.h \
- $$PWD/qquickpointersinglehandler_p.h \
+ $$PWD/qquicksinglepointhandler_p.h \
$$PWD/qquicktaphandler_p.h \
SOURCES += \
$$PWD/qquickdraghandler.cpp \
$$PWD/qquickhandlersmodule.cpp \
- $$PWD/qquickmultipointerhandler.cpp \
+ $$PWD/qquickmultipointhandler.cpp \
$$PWD/qquickpinchhandler.cpp \
$$PWD/qquickpointerdevicehandler.cpp \
$$PWD/qquickpointerhandler.cpp \
- $$PWD/qquickpointersinglehandler.cpp \
+ $$PWD/qquicksinglepointhandler.cpp \
$$PWD/qquicktaphandler.cpp \
diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp
index b41e1f6c9d..49b391c7d5 100644
--- a/src/quick/handlers/qquickdraghandler.cpp
+++ b/src/quick/handlers/qquickdraghandler.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
*/
QQuickDragHandler::QQuickDragHandler(QObject *parent)
- : QQuickPointerSingleHandler(parent)
+ : QQuickSinglePointHandler(parent)
{
}
@@ -70,7 +70,7 @@ bool QQuickDragHandler::wantsEventPoint(QQuickEventPoint *point)
{
// If we've already been interested in a point, stay interested, even if it has strayed outside bounds.
return ((point->state() != QQuickEventPoint::Pressed && this->point().id() == point->pointId())
- || QQuickPointerSingleHandler::wantsEventPoint(point));
+ || QQuickSinglePointHandler::wantsEventPoint(point));
}
void QQuickDragHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
@@ -79,7 +79,7 @@ void QQuickDragHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEvent
// In case the grab got handled over from another grabber, we might not get the Press
initializeTargetStartPos(point);
enforceConstraints();
- QQuickPointerSingleHandler::onGrabChanged(grabber, stateChange, point);
+ QQuickSinglePointHandler::onGrabChanged(grabber, stateChange, point);
}
void QQuickDragHandler::onActiveChanged()
diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h
index 54fef697f7..b28fb630b8 100644
--- a/src/quick/handlers/qquickdraghandler_p.h
+++ b/src/quick/handlers/qquickdraghandler_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qquickpointersinglehandler_p.h"
+#include "qquicksinglepointhandler_p.h"
QT_BEGIN_NAMESPACE
@@ -85,7 +85,7 @@ private:
bool m_enabled;
};
-class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickPointerSingleHandler
+class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickSinglePointHandler
{
Q_OBJECT
Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT)
diff --git a/src/quick/handlers/qquickmultipointerhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp
index a605b3f12e..66b6fdb4a6 100644
--- a/src/quick/handlers/qquickmultipointerhandler.cpp
+++ b/src/quick/handlers/qquickmultipointhandler.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qquickmultipointerhandler_p.h"
+#include "qquickmultipointhandler_p.h"
#include <private/qquickitem_p.h>
#include <QLineF>
#include <QMouseEvent>
@@ -50,18 +50,18 @@ QT_BEGIN_NAMESPACE
for the type of handler which requires and acts upon a specific number
of multiple touchpoints.
*/
-QQuickMultiPointerHandler::QQuickMultiPointerHandler(QObject *parent, int requiredPointCount)
+QQuickMultiPointHandler::QQuickMultiPointHandler(QObject *parent, int requiredPointCount)
: QQuickPointerDeviceHandler(parent)
, m_requiredPointCount(requiredPointCount)
, m_pointDistanceThreshold(0)
{
}
-QQuickMultiPointerHandler::~QQuickMultiPointerHandler()
+QQuickMultiPointHandler::~QQuickMultiPointHandler()
{
}
-bool QQuickMultiPointerHandler::wantsPointerEvent(QQuickPointerEvent *event)
+bool QQuickMultiPointHandler::wantsPointerEvent(QQuickPointerEvent *event)
{
if (!QQuickPointerDeviceHandler::wantsPointerEvent(event))
return false;
@@ -76,7 +76,7 @@ bool QQuickMultiPointerHandler::wantsPointerEvent(QQuickPointerEvent *event)
return ret;
}
-QVector<QQuickEventPoint *> QQuickMultiPointerHandler::eligiblePoints(QQuickPointerEvent *event)
+QVector<QQuickEventPoint *> QQuickMultiPointHandler::eligiblePoints(QQuickPointerEvent *event)
{
QVector<QQuickEventPoint *> ret;
int c = event->pointCount();
@@ -99,7 +99,7 @@ QVector<QQuickEventPoint *> QQuickMultiPointerHandler::eligiblePoints(QQuickPoin
return ret;
}
-void QQuickMultiPointerHandler::setRequiredPointCount(int c)
+void QQuickMultiPointHandler::setRequiredPointCount(int c)
{
if (m_requiredPointCount == c)
return;
@@ -108,7 +108,7 @@ void QQuickMultiPointerHandler::setRequiredPointCount(int c)
emit requiredPointCountChanged();
}
-void QQuickMultiPointerHandler::setPointDistanceThreshold(qreal pointDistanceThreshold)
+void QQuickMultiPointHandler::setPointDistanceThreshold(qreal pointDistanceThreshold)
{
if (m_pointDistanceThreshold == pointDistanceThreshold)
return;
@@ -117,7 +117,7 @@ void QQuickMultiPointerHandler::setPointDistanceThreshold(qreal pointDistanceThr
emit pointDistanceThresholdChanged();
}
-bool QQuickMultiPointerHandler::sameAsCurrentPoints(QQuickPointerEvent *event)
+bool QQuickMultiPointHandler::sameAsCurrentPoints(QQuickPointerEvent *event)
{
bool ret = true;
int c = event->pointCount();
@@ -140,7 +140,7 @@ bool QQuickMultiPointerHandler::sameAsCurrentPoints(QQuickPointerEvent *event)
}
// TODO make templates for these functions somehow?
-QPointF QQuickMultiPointerHandler::touchPointCentroid()
+QPointF QQuickMultiPointHandler::touchPointCentroid()
{
QPointF ret;
if (Q_UNLIKELY(m_currentPoints.size() == 0))
@@ -150,7 +150,7 @@ QPointF QQuickMultiPointerHandler::touchPointCentroid()
return ret / m_currentPoints.size();
}
-QVector2D QQuickMultiPointerHandler::touchPointCentroidVelocity()
+QVector2D QQuickMultiPointHandler::touchPointCentroidVelocity()
{
QVector2D ret;
if (Q_UNLIKELY(m_currentPoints.size() == 0))
@@ -160,7 +160,7 @@ QVector2D QQuickMultiPointerHandler::touchPointCentroidVelocity()
return ret / m_currentPoints.size();
}
-qreal QQuickMultiPointerHandler::averageTouchPointDistance(const QPointF &ref)
+qreal QQuickMultiPointHandler::averageTouchPointDistance(const QPointF &ref)
{
qreal ret = 0;
if (Q_UNLIKELY(m_currentPoints.size() == 0))
@@ -170,7 +170,7 @@ qreal QQuickMultiPointerHandler::averageTouchPointDistance(const QPointF &ref)
return ret / m_currentPoints.size();
}
-qreal QQuickMultiPointerHandler::averageStartingDistance(const QPointF &ref)
+qreal QQuickMultiPointHandler::averageStartingDistance(const QPointF &ref)
{
// TODO cache it in setActive()?
qreal ret = 0;
@@ -181,7 +181,7 @@ qreal QQuickMultiPointerHandler::averageStartingDistance(const QPointF &ref)
return ret / m_currentPoints.size();
}
-QVector<QQuickMultiPointerHandler::PointData> QQuickMultiPointerHandler::angles(const QPointF &ref) const
+QVector<QQuickMultiPointHandler::PointData> QQuickMultiPointHandler::angles(const QPointF &ref) const
{
QVector<PointData> angles;
angles.reserve(m_currentPoints.count());
@@ -192,7 +192,7 @@ QVector<QQuickMultiPointerHandler::PointData> QQuickMultiPointerHandler::angles(
return angles;
}
-qreal QQuickMultiPointerHandler::averageAngleDelta(const QVector<PointData> &old, const QVector<PointData> &newAngles)
+qreal QQuickMultiPointHandler::averageAngleDelta(const QVector<PointData> &old, const QVector<PointData> &newAngles)
{
qreal avgAngleDelta = 0;
int numSamples = 0;
@@ -224,13 +224,13 @@ qreal QQuickMultiPointerHandler::averageAngleDelta(const QVector<PointData> &old
return avgAngleDelta;
}
-void QQuickMultiPointerHandler::acceptPoints(const QVector<QQuickEventPoint *> &points)
+void QQuickMultiPointHandler::acceptPoints(const QVector<QQuickEventPoint *> &points)
{
for (QQuickEventPoint* point : points)
point->setAccepted();
}
-bool QQuickMultiPointerHandler::grabPoints(QVector<QQuickEventPoint *> points)
+bool QQuickMultiPointHandler::grabPoints(QVector<QQuickEventPoint *> points)
{
bool canGrab = true;
for (QQuickEventPoint* point : points) {
diff --git a/src/quick/handlers/qquickmultipointerhandler_p.h b/src/quick/handlers/qquickmultipointhandler_p.h
index 1bbc2f2fa3..97e3383331 100644
--- a/src/quick/handlers/qquickmultipointerhandler_p.h
+++ b/src/quick/handlers/qquickmultipointhandler_p.h
@@ -57,15 +57,15 @@
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QQuickMultiPointerHandler : public QQuickPointerDeviceHandler
+class Q_AUTOTEST_EXPORT QQuickMultiPointHandler : public QQuickPointerDeviceHandler
{
Q_OBJECT
Q_PROPERTY(int requiredPointCount READ requiredPointCount WRITE setRequiredPointCount NOTIFY requiredPointCountChanged)
Q_PROPERTY(qreal pointDistanceThreshold READ pointDistanceThreshold WRITE setPointDistanceThreshold NOTIFY pointDistanceThresholdChanged)
public:
- explicit QQuickMultiPointerHandler(QObject *parent = 0, int requiredPointCount = 2);
- ~QQuickMultiPointerHandler();
+ explicit QQuickMultiPointHandler(QObject *parent = 0, int requiredPointCount = 2);
+ ~QQuickMultiPointHandler();
int requiredPointCount() const { return m_requiredPointCount; }
void setRequiredPointCount(int c);
@@ -107,6 +107,6 @@ protected:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QQuickMultiPointerHandler)
+QML_DECLARE_TYPE(QQuickMultiPointHandler)
#endif // QQUICKPOINTERMULTIHANDLER_H
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp
index 465a49a6fd..4dd51e744d 100644
--- a/src/quick/handlers/qquickpinchhandler.cpp
+++ b/src/quick/handlers/qquickpinchhandler.cpp
@@ -63,7 +63,7 @@ Q_LOGGING_CATEGORY(lcPinchHandler, "qt.quick.handler.pinch")
*/
QQuickPinchHandler::QQuickPinchHandler(QObject *parent)
- : QQuickMultiPointerHandler(parent, 2)
+ : QQuickMultiPointHandler(parent, 2)
, m_activeScale(1)
, m_activeRotation(0)
, m_activeTranslation(0,0)
@@ -131,7 +131,7 @@ void QQuickPinchHandler::setPinchOrigin(QQuickPinchHandler::PinchOrigin pinchOri
}
/*!
- \qmlproperty QQuickPinchHandler::minimumX
+ \qmlproperty real QQuickPinchHandler::minimumX
The minimum acceptable x coordinate of the centroid
*/
@@ -144,7 +144,7 @@ void QQuickPinchHandler::setMinimumX(qreal minX)
}
/*!
- \qmlproperty QQuickPinchHandler::maximumX
+ \qmlproperty real QQuickPinchHandler::maximumX
The maximum acceptable x coordinate of the centroid
*/
@@ -157,7 +157,7 @@ void QQuickPinchHandler::setMaximumX(qreal maxX)
}
/*!
- \qmlproperty QQuickPinchHandler::minimumY
+ \qmlproperty real QQuickPinchHandler::minimumY
The minimum acceptable y coordinate of the centroid
*/
@@ -170,7 +170,7 @@ void QQuickPinchHandler::setMinimumY(qreal minY)
}
/*!
- \qmlproperty QQuickPinchHandler::maximumY
+ \qmlproperty real QQuickPinchHandler::maximumY
The maximum acceptable y coordinate of the centroid
*/
diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h
index 6768196909..356cc0eed3 100644
--- a/src/quick/handlers/qquickpinchhandler_p.h
+++ b/src/quick/handlers/qquickpinchhandler_p.h
@@ -53,12 +53,12 @@
#include "qquickitem.h"
#include "qevent.h"
-#include "qquickmultipointerhandler_p.h"
+#include "qquickmultipointhandler_p.h"
#include <private/qquicktranslate_p.h>
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QQuickPinchHandler : public QQuickMultiPointerHandler
+class Q_AUTOTEST_EXPORT QQuickPinchHandler : public QQuickMultiPointHandler
{
Q_OBJECT
Q_PROPERTY(qreal minimumScale READ minimumScale WRITE setMinimumScale NOTIFY minimumScaleChanged)
diff --git a/src/quick/handlers/qquickpointersinglehandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp
index 0b0f482d8d..8747f5023d 100644
--- a/src/quick/handlers/qquickpointersinglehandler.cpp
+++ b/src/quick/handlers/qquicksinglepointhandler.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qquickpointersinglehandler_p.h"
+#include "qquicksinglepointhandler_p.h"
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH_TARGET)
@@ -50,14 +50,14 @@ Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH_TARGET)
Override handleEventPoint() to implement a single-point handler.
*/
-QQuickPointerSingleHandler::QQuickPointerSingleHandler(QObject *parent)
+QQuickSinglePointHandler::QQuickSinglePointHandler(QObject *parent)
: QQuickPointerDeviceHandler(parent)
, m_acceptedButtons(Qt::LeftButton)
, m_ignoreAdditionalPoints(false)
{
}
-bool QQuickPointerSingleHandler::wantsPointerEvent(QQuickPointerEvent *event)
+bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event)
{
if (!QQuickPointerDeviceHandler::wantsPointerEvent(event))
return false;
@@ -113,7 +113,7 @@ bool QQuickPointerSingleHandler::wantsPointerEvent(QQuickPointerEvent *event)
return m_pointInfo.m_id;
}
-void QQuickPointerSingleHandler::handlePointerEventImpl(QQuickPointerEvent *event)
+void QQuickSinglePointHandler::handlePointerEventImpl(QQuickPointerEvent *event)
{
QQuickPointerDeviceHandler::handlePointerEventImpl(event);
QQuickEventPoint *currentPoint = event->pointById(m_pointInfo.m_id);
@@ -158,12 +158,12 @@ void QQuickPointerSingleHandler::handlePointerEventImpl(QQuickPointerEvent *even
}
}
-bool QQuickPointerSingleHandler::wantsEventPoint(QQuickEventPoint *point)
+bool QQuickSinglePointHandler::wantsEventPoint(QQuickEventPoint *point)
{
return parentContains(point);
}
-void QQuickPointerSingleHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
+void QQuickSinglePointHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
{
if (grabber != this)
return;
@@ -191,19 +191,19 @@ void QQuickPointerSingleHandler::onGrabChanged(QQuickPointerHandler *grabber, QQ
emit singlePointGrabChanged();
}
-void QQuickPointerSingleHandler::setIgnoreAdditionalPoints(bool v)
+void QQuickSinglePointHandler::setIgnoreAdditionalPoints(bool v)
{
m_ignoreAdditionalPoints = v;
}
-void QQuickPointerSingleHandler::moveTarget(QPointF pos, QQuickEventPoint *point)
+void QQuickSinglePointHandler::moveTarget(QPointF pos, QQuickEventPoint *point)
{
target()->setPosition(pos);
m_pointInfo.m_scenePosition = point->scenePos();
m_pointInfo.m_position = target()->mapFromScene(m_pointInfo.m_scenePosition);
}
-void QQuickPointerSingleHandler::setAcceptedButtons(Qt::MouseButtons buttons)
+void QQuickSinglePointHandler::setAcceptedButtons(Qt::MouseButtons buttons)
{
if (m_acceptedButtons == buttons)
return;
@@ -212,7 +212,7 @@ void QQuickPointerSingleHandler::setAcceptedButtons(Qt::MouseButtons buttons)
emit acceptedButtonsChanged();
}
-void QQuickPointerSingleHandler::reset()
+void QQuickSinglePointHandler::reset()
{
setActive(false);
m_pointInfo.reset();
diff --git a/src/quick/handlers/qquickpointersinglehandler_p.h b/src/quick/handlers/qquicksinglepointhandler_p.h
index 8898a1600b..386cea253a 100644
--- a/src/quick/handlers/qquickpointersinglehandler_p.h
+++ b/src/quick/handlers/qquicksinglepointhandler_p.h
@@ -55,7 +55,7 @@
QT_BEGIN_NAMESPACE
-class QQuickPointerSingleHandler;
+class QQuickSinglePointHandler;
class Q_QUICK_PRIVATE_EXPORT QQuickHandlerPoint {
Q_GADGET
@@ -102,17 +102,17 @@ private:
qreal m_rotation;
qreal m_pressure;
QSizeF m_ellipseDiameters;
- friend class QQuickPointerSingleHandler;
+ friend class QQuickSinglePointHandler;
};
-class Q_QUICK_PRIVATE_EXPORT QQuickPointerSingleHandler : public QQuickPointerDeviceHandler
+class Q_QUICK_PRIVATE_EXPORT QQuickSinglePointHandler : public QQuickPointerDeviceHandler
{
Q_OBJECT
Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
Q_PROPERTY(QQuickHandlerPoint point READ point NOTIFY pointChanged)
public:
- explicit QQuickPointerSingleHandler(QObject *parent = 0);
- virtual ~QQuickPointerSingleHandler() { }
+ explicit QQuickSinglePointHandler(QObject *parent = 0);
+ virtual ~QQuickSinglePointHandler() { }
Qt::MouseButtons acceptedButtons() const { return m_acceptedButtons; }
void setAcceptedButtons(Qt::MouseButtons buttons);
@@ -149,6 +149,6 @@ private:
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickHandlerPoint)
-QML_DECLARE_TYPE(QQuickPointerSingleHandler)
+QML_DECLARE_TYPE(QQuickSinglePointHandler)
#endif // QQUICKPOINTERSINGLEHANDLER_H
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp
index 1bcf42a073..b8d9754cde 100644
--- a/src/quick/handlers/qquicktaphandler.cpp
+++ b/src/quick/handlers/qquicktaphandler.cpp
@@ -54,7 +54,7 @@ int QQuickTapHandler::m_touchMultiTapDistanceSquared(-1);
/*!
\qmltype TapHandler
\instantiates QQuickTapHandler
- \inqmlmodule QtQuick
+ \inqmlmodule Qt.labs.handlers
\ingroup qtquick-handlers
\brief Handler for taps and clicks.
@@ -78,7 +78,7 @@ int QQuickTapHandler::m_touchMultiTapDistanceSquared(-1);
*/
QQuickTapHandler::QQuickTapHandler(QObject *parent)
- : QQuickPointerSingleHandler(parent)
+ : QQuickSinglePointHandler(parent)
, m_pressed(false)
, m_gesturePolicy(ReleaseWithinBounds)
, m_tapCount(0)
@@ -287,7 +287,7 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QQuickEventPoint *poi
else
m_tapCount = 1;
qCDebug(lcTapHandler) << objectName() << "tapped" << m_tapCount << "times";
- emit tapped(point);
+ emit tapped();
emit tapCountChanged();
m_lastTapTimestamp = ts;
m_lastTapPos = point->scenePos();
@@ -305,7 +305,7 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QQuickEventPoint *poi
void QQuickTapHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
{
- QQuickPointerSingleHandler::onGrabChanged(grabber, stateChange, point);
+ QQuickSinglePointHandler::onGrabChanged(grabber, stateChange, point);
bool isCanceled = stateChange == QQuickEventPoint::CancelGrabExclusive || stateChange == QQuickEventPoint::CancelGrabPassive;
if (grabber == this && (isCanceled || point->state() == QQuickEventPoint::Released))
setPressed(false, isCanceled, point);
diff --git a/src/quick/handlers/qquicktaphandler_p.h b/src/quick/handlers/qquicktaphandler_p.h
index 0e9a6f0411..aea95ae827 100644
--- a/src/quick/handlers/qquicktaphandler_p.h
+++ b/src/quick/handlers/qquicktaphandler_p.h
@@ -53,12 +53,12 @@
#include "qquickitem.h"
#include "qevent.h"
-#include "qquickpointersinglehandler_p.h"
+#include "qquicksinglepointhandler_p.h"
#include <QtCore/qbasictimer.h>
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QQuickTapHandler : public QQuickPointerSingleHandler
+class Q_AUTOTEST_EXPORT QQuickTapHandler : public QQuickSinglePointHandler
{
Q_OBJECT
Q_PROPERTY(bool isPressed READ isPressed NOTIFY pressedChanged)
@@ -95,7 +95,7 @@ Q_SIGNALS:
void timeHeldChanged();
void longPressThresholdChanged();
void gesturePolicyChanged();
- void tapped(QQuickEventPoint *point);
+ void tapped();
void longPressed();
protected:
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index af2ba232f4..d133729625 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -1374,10 +1374,7 @@ Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QQuickPointerEvent *e
QDebugStateSaver saver(dbg);
dbg.nospace();
dbg << "QQuickPointerEvent(";
- if (event->isValid())
- dbg << event->timestamp();
- else
- dbg << "invalid";
+ dbg << event->timestamp();
dbg << " dev:";
QtDebugUtils::formatQEnum(dbg, event->device()->type());
if (event->buttons() != Qt::NoButton) {
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 0d6e06ac41..48c29f00de 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -417,7 +417,6 @@ public: // helpers for C++ only (during event delivery)
virtual const QQuickPointerMouseEvent *asPointerMouseEvent() const { return nullptr; }
virtual const QQuickPointerTouchEvent *asPointerTouchEvent() const { return nullptr; }
virtual const QQuickPointerTabletEvent *asPointerTabletEvent() const { return nullptr; }
- bool isValid() const { return m_event != nullptr; }
virtual bool allPointsAccepted() const = 0;
virtual bool allUpdatedPointsAccepted() const = 0;
virtual bool allPointsGrabbed() const = 0;
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 9f2d543387..0a5d7adf8b 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -5029,22 +5029,31 @@ void QQuickItemPrivate::transformChanged()
#endif
}
+bool QQuickItemPrivate::filterKeyEvent(QKeyEvent *e, bool post)
+{
+ if (!extra.isAllocated() || !extra->keyHandler)
+ return false;
+
+ if (post)
+ e->accept();
+
+ if (e->type() == QEvent::KeyPress)
+ extra->keyHandler->keyPressed(e, post);
+ else
+ extra->keyHandler->keyReleased(e, post);
+
+ return e->isAccepted();
+}
+
void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e)
{
Q_Q(QQuickItem);
Q_ASSERT(e->isAccepted());
- if (extra.isAllocated() && extra->keyHandler) {
- if (e->type() == QEvent::KeyPress)
- extra->keyHandler->keyPressed(e, false);
- else
- extra->keyHandler->keyReleased(e, false);
-
- if (e->isAccepted())
- return;
- else
- e->accept();
- }
+ if (filterKeyEvent(e, false))
+ return;
+ else
+ e->accept();
if (e->type() == QEvent::KeyPress)
q->keyPressEvent(e);
@@ -5054,16 +5063,7 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e)
if (e->isAccepted())
return;
- if (extra.isAllocated() && extra->keyHandler) {
- e->accept();
-
- if (e->type() == QEvent::KeyPress)
- extra->keyHandler->keyPressed(e, true);
- else
- extra->keyHandler->keyReleased(e, true);
- }
-
- if (e->isAccepted() || !q->window())
+ if (filterKeyEvent(e, true) || !q->window())
return;
//only care about KeyPress now
@@ -5832,7 +5832,7 @@ void QQuickItem::setVisible(bool v)
are returned to \c true, unless they have explicitly been set to \c false.
Setting this property to \c false automatically causes \l activeFocus to be
- set to \c false, and this item will longer receive keyboard events.
+ set to \c false, and this item will no longer receive keyboard events.
\sa visible
*/
@@ -7231,6 +7231,8 @@ void QQuickItem::setAcceptHoverEvents(bool enabled)
If this is false, then the item will not receive any touch events through
the touchEvent() function.
+
+ \since 5.10
*/
bool QQuickItem::acceptTouchEvents() const
{
@@ -7242,12 +7244,14 @@ bool QQuickItem::acceptTouchEvents() const
If \a enabled is true, this sets the item to accept touch events;
otherwise, touch events are not accepted by this item.
+ \since 5.10
+
\sa acceptTouchEvents()
*/
-void QQuickItem::setAcceptTouchEvents(bool accept)
+void QQuickItem::setAcceptTouchEvents(bool enabled)
{
Q_D(QQuickItem);
- d->touchEnabled = accept;
+ d->touchEnabled = enabled;
}
void QQuickItemPrivate::setHasCursorInChild(bool hasCursor)
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index d1aaf6026b..446a7d0945 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -564,6 +564,7 @@ public:
virtual void transformChanged();
void deliverKeyEvent(QKeyEvent *);
+ bool filterKeyEvent(QKeyEvent *, bool post);
#if QT_CONFIG(im)
void deliverInputMethodEvent(QInputMethodEvent *);
#endif
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index e6321e9365..1406e5b547 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -397,6 +397,8 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
#endif
qmlRegisterType<QQuickFlickable, 10>(uri, 2, 10, "Flickable");
+ qmlRegisterType<QQuickTextEdit, 10>(uri, 2, 10, "TextEdit");
+ qmlRegisterType<QQuickText, 10>(uri, 2, 10, "Text");
}
static void initResources()
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index 04d93937eb..745e5b275f 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -639,7 +639,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
attached property can be used to augment view transitions.
- \section2 View transitions: a simple example
+ \section2 View Transitions: a Simple Example
Here is a basic example of the use of view transitions. The view below specifies transitions for
the \c add and \c displaced properties, which will be run when items are added to the view:
@@ -668,7 +668,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
are some examples of how this can be achieved.
- \section2 Using the ViewTransition attached property
+ \section2 Using the ViewTransition Attached Property
As stated, the various ViewTransition properties provide details specific to the individual item
being transitioned as well as the operation that triggered the transition. In the animation above,
@@ -719,7 +719,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
that is triggered by a particular add operation.
- \section3 Delaying animations based on index
+ \section3 Delaying Animations Based on Index
Since each view transition is run once for each item affected by the transition, the ViewTransition
properties can be used within a transition to define custom behavior for each item's transition.
@@ -738,7 +738,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
\image viewtransitions-delayedbyindex.gif
- \section3 Animating items to intermediate positions
+ \section3 Animating Items to Intermediate Positions
The ViewTransition.item property gives a reference to the item to which the transition is being
applied. This can be used to access any of the item's attributes, custom \c property values,
@@ -775,7 +775,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
\image viewtransitions-pathanim.gif
- \section2 Handling interrupted animations
+ \section2 Handling Interrupted Animations
A view transition may be interrupted at any time if a different view transition needs to be
applied while the original transition is in progress. For example, say Item A is inserted at index 0
@@ -819,7 +819,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
properties.
- \section2 Restrictions regarding ScriptAction
+ \section2 Restrictions Regarding ScriptAction
When a view transition is initialized, any property bindings that refer to the ViewTransition
attached property are evaluated in preparation for the transition. Due to the nature of the
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index edfa970035..a6236d9801 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -3208,6 +3208,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
qreal tempPos = isContentFlowReversed() ? -position()-size() : position();
int index = visibleItems.count() ? mapFromModel(modelIndex) : 0;
+ qreal lastVisiblePos = buffer + displayMarginEnd + tempPos + size();
if (index < 0) {
int i = visibleItems.count() - 1;
@@ -3217,7 +3218,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
// there are no visible items except items marked for removal
index = visibleItems.count();
} else if (visibleItems.at(i)->index + 1 == modelIndex
- && visibleItems.at(i)->endPosition() <= buffer+displayMarginEnd+tempPos+size()) {
+ && visibleItems.at(i)->endPosition() <= lastVisiblePos) {
// Special case of appending an item to the model.
index = visibleItems.count();
} else {
@@ -3305,11 +3306,8 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
}
} else {
- qreal to = buffer + displayMarginEnd + tempPos + size();
-
- visibleAffected = count > 0 && pos < to;
-
- for (int i = 0; i < count && pos <= to; ++i) {
+ for (int i = 0; i < count && pos <= lastVisiblePos; ++i) {
+ visibleAffected = true;
FxViewItem *item = 0;
if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i))))
item->index = modelIndex + i;
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 2c8f854d4d..9f27beb298 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -185,7 +185,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
\l sourceComponent to \c undefined destroys the currently loaded object,
freeing resources and leaving the Loader empty.
- \section2 Loader sizing behavior
+ \section2 Loader Sizing Behavior
If the source component is not an Item type, Loader does not
apply any special sizing rules. When used to load visual types,
@@ -217,7 +217,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
\endtable
- \section2 Receiving signals from loaded objects
+ \section2 Receiving Signals from Loaded Objects
Any signals emitted from the loaded object can be received using the
\l Connections type. For example, the following \c application.qml
@@ -238,7 +238,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
its parent \l Item.
- \section2 Focus and key events
+ \section2 Focus and Key Events
Loader is a focus scope. Its \l {Item::}{focus} property must be set to
\c true for any of its children to get the \e {active focus}. (See
@@ -266,7 +266,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
Since \c {QtQuick 2.0}, Loader can also load non-visual components.
- \section2 Using a Loader within a view delegate
+ \section2 Using a Loader within a View Delegate
In some cases you may wish to use a Loader within a view delegate to improve delegate
loading performance. This works well in most cases, but there is one important issue to
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index a41e9324f3..8f0866f417 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -475,7 +475,7 @@ QT_BEGIN_NAMESPACE
\li \snippet qml/opacitymask.qml 1
\endtable
- \section1 Other notes
+ \section1 Other Notes
By default, the ShaderEffect consists of four vertices, one for each
corner. For non-linear vertex transformations, like page curl, you can
diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp
index aae657b749..8013c57938 100644
--- a/src/quick/items/qquicksprite.cpp
+++ b/src/quick/items/qquicksprite.cpp
@@ -40,6 +40,7 @@
#include "qquicksprite_p.h"
#include <qqml.h>
#include <QDebug>
+#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
@@ -236,12 +237,12 @@ int QQuickSprite::variedDuration() const //Deals with precedence when multiple d
if (m_frameRate != unsetDuration) {
qreal fpms = (m_frameRate
- + (m_frameRateVariation * ((qreal)qrand()/RAND_MAX) * 2)
+ + (m_frameRateVariation * QRandomGenerator::getReal() * 2)
- m_frameRateVariation) / 1000.0;
return qMax(qreal(0.0) , m_frames / fpms);
} else if (m_frameDuration != unsetDuration) {
int mspf = m_frameDuration
- + (m_frameDurationVariation * ((qreal)qrand()/RAND_MAX) * 2)
+ + (m_frameDurationVariation * QRandomGenerator::getReal() * 2)
- m_frameDurationVariation;
return qMax(0, m_frames * mspf);
} else if (duration() >= 0) {
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index 92b60a8e3a..9deb223957 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -43,6 +43,7 @@
#include <qqml.h>
#include <QDebug>
#include <QPainter>
+#include <QRandomGenerator>
#include <QSet>
#include <QtGui/qopengl.h>
#include <QOpenGLFunctions>
@@ -543,7 +544,7 @@ void QQuickStochasticEngine::restart(int index)
if (m_addAdvance)
m_startTimes[index] += m_advanceTime.elapsed();
if (randomStart)
- m_startTimes[index] -= qrand() % m_duration.at(index);
+ m_startTimes[index] -= QRandomGenerator::bounded(m_duration.at(index));
int time = m_duration.at(index) + m_startTimes.at(index);
for (int i=0; i<m_stateUpdates.count(); i++)
m_stateUpdates[i].second.removeAll(index);
@@ -557,13 +558,13 @@ void QQuickSpriteEngine::restart(int index) //Reimplemented to recognize and han
if (m_loaded && m_sprites.at(m_things.at(index))->frameSync()) {//Manually advanced
m_startTimes[index] = 0;
if (randomStart && m_sprites.at(m_things.at(index))->m_generatedCount)
- m_startTimes[index] += qrand() % m_sprites.at(m_things.at(index))->m_generatedCount;
+ m_startTimes[index] += QRandomGenerator::bounded(m_sprites.at(m_things.at(index))->m_generatedCount);
} else {
m_startTimes[index] = m_timeOffset;
if (m_addAdvance)
m_startTimes[index] += m_advanceTime.elapsed();
if (randomStart)
- m_startTimes[index] -= qrand() % m_duration.at(index);
+ m_startTimes[index] -= QRandomGenerator::bounded(m_duration.at(index));
int time = spriteDuration(index) + m_startTimes.at(index);
if (randomStart) {
int curTime = m_timeOffset + (m_addAdvance ? m_advanceTime.elapsed() : 0);
@@ -629,7 +630,7 @@ int QQuickStochasticEngine::nextState(int curState, int curThing)
int nextIdx = -1;
int goalPath = goalSeek(curState, curThing);
if (goalPath == -1){//Random
- qreal r =(qreal) qrand() / (qreal) RAND_MAX;
+ qreal r = QRandomGenerator::getReal();
qreal total = 0.0;
for (QVariantMap::const_iterator iter=m_states.at(curState)->m_to.constBegin();
iter!=m_states.at(curState)->m_to.constEnd(); ++iter)
@@ -719,7 +720,7 @@ int QQuickStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist)
if (options.count()==1)
return *(options.begin());
int option = -1;
- qreal r =(qreal) qrand() / (qreal) RAND_MAX;
+ qreal r = QRandomGenerator::getReal();
qreal total = 0;
for (QSet<int>::const_iterator iter=options.constBegin();
iter!=options.constEnd(); ++iter)
diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h
index 90ee68b2f6..4e5458a938 100644
--- a/src/quick/items/qquickspriteengine_p.h
+++ b/src/quick/items/qquickspriteengine_p.h
@@ -63,6 +63,7 @@ QT_REQUIRE_CONFIG(quick_sprite);
#include <QQmlListProperty>
#include <QImage>
#include <QPair>
+#include <QRandomGenerator>
#include <private/qquickpixmapcache_p.h>
#include <private/qtquickglobal_p.h>
@@ -112,7 +113,7 @@ public:
virtual int variedDuration() const
{
return qMax(qreal(0.0) , m_duration
- + (m_durationVariation * ((qreal)qrand()/RAND_MAX) * 2)
+ + (m_durationVariation * QRandomGenerator::bounded(2.0))
- m_durationVariation);
}
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 5ca0bb5f79..5f58f0cdde 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -80,11 +80,7 @@ QQuickTextPrivate::QQuickTextPrivate()
, elideMode(QQuickText::ElideNone), hAlign(QQuickText::AlignLeft), vAlign(QQuickText::AlignTop)
, format(QQuickText::AutoText), wrapMode(QQuickText::NoWrap)
, style(QQuickText::Normal)
-#if defined(QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
- , renderType(QQuickText::QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
-#else
- , renderType(QQuickText::QtRendering)
-#endif
+ , renderType(QQuickTextUtil::textRenderType<QQuickText>())
, updateType(UpdatePaintNode)
, maximumLineCountValid(false), updateOnComponentComplete(true), richText(false)
, styledText(false), widthExceeded(false), heightExceeded(false), internalWidthUpdate(false)
@@ -1519,6 +1515,23 @@ QQuickText::~QQuickText()
Text { text: "OATS FLAVOUR WAY"; font.kerning: false }
\endqml
*/
+
+/*!
+ \qmlproperty bool QtQuick::Text::font.preferShaping
+ \since 5.10
+
+ Sometimes, a font will apply complex rules to a set of characters in order to
+ display them correctly. In some writing systems, such as Brahmic scripts, this is
+ required in order for the text to be legible, but in e.g. Latin script, it is merely
+ a cosmetic feature. Setting the \c preferShaping property to false will disable all
+ such features when they are not required, which will improve performance in most cases.
+
+ The default value is true.
+
+ \qml
+ Text { text: "Some text"; font.preferShaping: false }
+ \endqml
+*/
QFont QQuickText::font() const
{
Q_D(const QQuickText);
@@ -2827,7 +2840,7 @@ void QQuickText::hoverLeaveEvent(QHoverEvent *event)
Supported render types are:
\list
- \li Text.QtRendering - the default
+ \li Text.QtRendering
\li Text.NativeRendering
\endlist
@@ -2835,6 +2848,8 @@ void QQuickText::hoverLeaveEvent(QHoverEvent *event)
not require advanced features such as transformation of the text. Using such features in
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
+
+ The default rendering type is determined by \l QQuickWindow::textRenderType().
*/
QQuickText::RenderType QQuickText::renderType() const
{
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index f22c5f00be..da11913bde 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -45,7 +45,6 @@
#include "qquickwindow.h"
#include "qquicktextnode_p.h"
#include "qquicktextnodeengine_p.h"
-#include "qquicktextutil_p.h"
#include <QtCore/qmath.h>
#include <QtGui/qguiapplication.h>
@@ -369,6 +368,23 @@ QString QQuickTextEdit::text() const
*/
/*!
+ \qmlproperty bool QtQuick::TextEdit::font.preferShaping
+ \since 5.10
+
+ Sometimes, a font will apply complex rules to a set of characters in order to
+ display them correctly. In some writing systems, such as Brahmic scripts, this is
+ required in order for the text to be legible, but in e.g. Latin script, it is merely
+ a cosmetic feature. Setting the \c preferShaping property to false will disable all
+ such features when they are not required, which will improve performance in most cases.
+
+ The default value is true.
+
+ \qml
+ TextEdit { text: "Some text"; font.preferShaping: false }
+ \endqml
+*/
+
+/*!
\qmlproperty string QtQuick::TextEdit::text
The text to display. If the text format is AutoText the text edit will
@@ -495,7 +511,7 @@ void QQuickTextEdit::setTextFormat(TextFormat format)
Supported render types are:
\list
- \li Text.QtRendering - the default
+ \li Text.QtRendering
\li Text.NativeRendering
\endlist
@@ -503,6 +519,8 @@ void QQuickTextEdit::setTextFormat(TextFormat format)
not require advanced features such as transformation of the text. Using such features in
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
+
+ The default rendering type is determined by \l QQuickWindow::textRenderType().
*/
QQuickTextEdit::RenderType QQuickTextEdit::renderType() const
{
@@ -3061,17 +3079,17 @@ void QQuickTextEdit::resetBottomPadding()
int QQuickTextEdit::tabStopDistance() const
{
Q_D(const QQuickTextEdit);
- return d->document->defaultTextOption().tabStop();
+ return d->document->defaultTextOption().tabStopDistance();
}
void QQuickTextEdit::setTabStopDistance(qreal distance)
{
Q_D(QQuickTextEdit);
QTextOption textOptions = d->document->defaultTextOption();
- if (textOptions.tabStop() == distance)
+ if (textOptions.tabStopDistance() == distance)
return;
- textOptions.setTabStop(distance);
+ textOptions.setTabStopDistance(distance);
d->document->setDefaultTextOption(textOptions);
emit tabStopDistanceChanged(distance);
}
diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h
index 03bce00cb0..455fffbcbc 100644
--- a/src/quick/items/qquicktextedit_p_p.h
+++ b/src/quick/items/qquicktextedit_p_p.h
@@ -53,6 +53,7 @@
#include "qquicktextedit_p.h"
#include "qquickimplicitsizeitem_p_p.h"
+#include "qquicktextutil_p.h"
#include <QtQml/qqml.h>
#include <QtCore/qlist.h>
@@ -112,11 +113,7 @@ public:
, quickDocument(0), lastSelectionStart(0), lastSelectionEnd(0), lineCount(0)
, hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop)
, format(QQuickTextEdit::PlainText), wrapMode(QQuickTextEdit::NoWrap)
-#if defined(QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
- , renderType(QQuickTextEdit::QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
-#else
- , renderType(QQuickTextEdit::QtRendering)
-#endif
+ , renderType(QQuickTextUtil::textRenderType<QQuickTextEdit>())
, contentDirection(Qt::LayoutDirectionAuto)
, mouseSelectionMode(QQuickTextEdit::SelectCharacters)
#if QT_CONFIG(im)
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 06ad0a9dbf..d516b6f30c 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -40,7 +40,6 @@
#include "qquicktextinput_p.h"
#include "qquicktextinput_p_p.h"
#include "qquickwindow.h"
-#include "qquicktextutil_p.h"
#include <private/qqmlglobal_p.h>
#include <private/qv4scopedvalue_p.h>
@@ -157,7 +156,7 @@ void QQuickTextInput::setText(const QString &s)
Supported render types are:
\list
- \li Text.QtRendering - the default
+ \li Text.QtRendering
\li Text.NativeRendering
\endlist
@@ -165,6 +164,8 @@ void QQuickTextInput::setText(const QString &s)
not require advanced features such as transformation of the text. Using such features in
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
+
+ The default rendering type is determined by \l QQuickWindow::textRenderType().
*/
QQuickTextInput::RenderType QQuickTextInput::renderType() const
{
@@ -391,6 +392,23 @@ QString QQuickTextInputPrivate::realText() const
TextInput { text: "OATS FLAVOUR WAY"; font.kerning: false }
\endqml
*/
+
+/*!
+ \qmlproperty bool QtQuick::TextInput::font.preferShaping
+ \since 5.10
+
+ Sometimes, a font will apply complex rules to a set of characters in order to
+ display them correctly. In some writing systems, such as Brahmic scripts, this is
+ required in order for the text to be legible, but in e.g. Latin script, it is merely
+ a cosmetic feature. Setting the \c preferShaping property to false will disable all
+ such features when they are not required, which will improve performance in most cases.
+
+ The default value is true.
+
+ \qml
+ TextInput { text: "Some text"; font.preferShaping: false }
+ \endqml
+*/
QFont QQuickTextInput::font() const
{
Q_D(const QQuickTextInput);
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 0bf5779a53..c3218197a4 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -43,6 +43,7 @@
#include "qquicktextinput_p.h"
#include "qquicktext_p.h"
#include "qquickimplicitsizeitem_p_p.h"
+#include "qquicktextutil_p.h"
#include <QtQml/qqml.h>
#include <QtCore/qelapsedtimer.h>
@@ -122,11 +123,7 @@ public:
, vAlign(QQuickTextInput::AlignTop)
, wrapMode(QQuickTextInput::NoWrap)
, m_echoMode(QQuickTextInput::Normal)
-#if defined(QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
- , renderType(QQuickTextInput::QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
-#else
- , renderType(QQuickTextInput::QtRendering)
-#endif
+ , renderType(QQuickTextUtil::textRenderType<QQuickTextInput>())
, updateType(UpdatePaintNode)
, mouseSelectionMode(QQuickTextInput::SelectCharacters)
, m_layoutDirection(Qt::LayoutDirectionAuto)
diff --git a/src/quick/items/qquicktextutil_p.h b/src/quick/items/qquicktextutil_p.h
index 01055c95ec..bad5e738a8 100644
--- a/src/quick/items/qquicktextutil_p.h
+++ b/src/quick/items/qquicktextutil_p.h
@@ -54,6 +54,7 @@
#include <QtQml/qqml.h>
#include <QtQml/qqmlincubator.h>
#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickwindow.h>
QT_BEGIN_NAMESPACE
@@ -64,6 +65,7 @@ public:
template <typename Private> static void setCursorDelegate(Private *d, QQmlComponent *delegate);
template <typename Private> static void createCursor(Private *d);
+ template <typename T> static typename T::RenderType textRenderType();
static qreal alignedX(qreal textWidth, qreal itemWidth, int alignment);
static qreal alignedY(qreal textHeight, qreal itemHeight, int alignment);
@@ -124,6 +126,20 @@ void QQuickTextUtil::createCursor(Private *d)
parent->update();
}
+template <typename T>
+typename T::RenderType QQuickTextUtil::textRenderType()
+{
+ switch (QQuickWindow::textRenderType()) {
+ case QQuickWindow::QtTextRendering:
+ return T::QtRendering;
+ case QQuickWindow::NativeTextRendering:
+ return T::NativeRendering;
+ }
+
+ Q_UNREACHABLE();
+ return T::QtRendering;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 7b331251f0..2d129f0823 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -93,6 +93,12 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_
bool QQuickWindowPrivate::defaultAlphaBuffer = false;
+#if defined(QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
+QQuickWindow::TextRenderType QQuickWindowPrivate::textRenderType = QQuickWindow::QT_QUICK_DEFAULT_TEXT_RENDER_TYPE;
+#else
+QQuickWindow::TextRenderType QQuickWindowPrivate::textRenderType = QQuickWindow::QtTextRendering;
+#endif
+
void QQuickWindowPrivate::updateFocusItemTransform()
{
#if QT_CONFIG(im)
@@ -1238,7 +1244,7 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
\note All classes with QSG prefix should be used solely on the scene graph's
rendering thread. See \l {Scene Graph and Rendering} for more information.
- \section2 Context and surface formats
+ \section2 Context and Surface Formats
While it is possible to specify a QSurfaceFormat for every QQuickWindow by
calling the member function setFormat(), windows may also be created from
@@ -1506,8 +1512,7 @@ QQuickItem *QQuickWindow::mouseGrabberItem() const
if (d->touchMouseId != -1 && d->touchMouseDevice) {
QQuickPointerEvent *event = d->pointerEventInstance(d->touchMouseDevice);
auto point = event->pointById(d->touchMouseId);
- Q_ASSERT(point);
- return point->grabberItem();
+ return point ? point->grabberItem() : nullptr;
}
QQuickPointerEvent *event = d->pointerEventInstance(QQuickPointerDevice::genericMouseDevice());
@@ -1663,17 +1668,18 @@ void QQuickWindowPrivate::deliverMouseEvent(QQuickPointerMouseEvent *pointerEven
{
auto point = pointerEvent->point(0);
lastMousePosition = point->scenePos();
+ const bool mouseIsReleased = (point->state() == QQuickEventPoint::Released && pointerEvent->buttons() == Qt::NoButton);
if (point->exclusiveGrabber()) {
- bool mouseIsReleased = (point->state() == QQuickEventPoint::Released && pointerEvent->buttons() == Qt::NoButton);
if (auto grabber = point->grabberItem()) {
if (sendFilteredPointerEvent(pointerEvent, grabber))
return;
// if the grabber is an Item:
// if the update consists of changing button state, don't accept it unless
// the button is one in which the grabber is interested
- if (pointerEvent->button() != Qt::NoButton && grabber->acceptedMouseButtons()
- && !(grabber->acceptedMouseButtons() & pointerEvent->button())) {
+ Qt::MouseButtons acceptedButtons = grabber->acceptedMouseButtons();
+ if (pointerEvent->button() != Qt::NoButton && acceptedButtons
+ && !(acceptedButtons & pointerEvent->button())) {
pointerEvent->setAccepted(false);
return;
}
@@ -1694,10 +1700,8 @@ void QQuickWindowPrivate::deliverMouseEvent(QQuickPointerMouseEvent *pointerEven
pointerEvent->localize(handler->parentItem());
if (!sendFilteredPointerEvent(pointerEvent, handler->parentItem()))
handler->handlePointerEvent(pointerEvent);
- if (mouseIsReleased) {
+ if (mouseIsReleased)
point->setGrabberPointerHandler(nullptr, true);
- point->clearPassiveGrabbers();
- }
}
} else {
bool delivered = false;
@@ -1736,6 +1740,9 @@ void QQuickWindowPrivate::deliverMouseEvent(QQuickPointerMouseEvent *pointerEven
// make sure not to accept unhandled events
pointerEvent->setAccepted(false);
}
+ // failsafe: never allow any kind of grab to persist after release
+ if (mouseIsReleased)
+ pointerEvent->clearGrabbers();
}
bool QQuickWindowPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
@@ -2326,8 +2333,9 @@ void QQuickWindowPrivate::deliverTouchEvent(QQuickPointerTouchEvent *event)
}
}
- if (allReleased && !event->exclusiveGrabbers().isEmpty()) {
- qWarning() << "No release received for some grabbers" << event->exclusiveGrabbers();
+ if (allReleased) {
+ if (Q_UNLIKELY(!event->exclusiveGrabbers().isEmpty()))
+ qWarning() << "No release received for some grabbers" << event->exclusiveGrabbers();
event->clearGrabbers();
}
}
@@ -2419,17 +2427,25 @@ bool QQuickWindowPrivate::deliverPressOrReleaseEvent(QQuickPointerEvent *event,
}
}
- if (allowChildEventFiltering && !handlersOnly) {
+ if (allowChildEventFiltering && !handlersOnly)
updateFilteringParentItems(targetItems);
- QQuickItem *filteredItem;
- if (sendFilteredPointerEvent(event, nullptr, &filteredItem)) {
- if (event->isAccepted())
+
+ QVarLengthArray<QQuickItem *> filteredItems;
+ for (QQuickItem *item : targetItems) {
+ if (sendFilteredPointerEvent(event, item)) {
+ if (event->isAccepted()) {
+ for (int i = 0; i < event->pointCount(); ++i)
+ event->point(i)->setAccepted();
return true;
- targetItems.removeAll(filteredItem);
+ }
+ while (!filteringParentItems.isEmpty() && filteringParentItems.first().first == item)
+ filteringParentItems.removeFirst();
+ filteredItems << item;
}
- }
- for (QQuickItem *item: targetItems) {
+ // Do not deliverMatchingPointsTo any item for which the parent-filter already intercepted the event
+ if (filteredItems.contains(item))
+ continue;
deliverMatchingPointsToItem(item, event, handlersOnly);
if (event->allPointsAccepted())
break;
@@ -2714,13 +2730,6 @@ QQuickItem *QQuickWindowPrivate::findCursorItem(QQuickItem *item, const QPointF
void QQuickWindowPrivate::updateFilteringParentItems(const QVector<QQuickItem *> &targetItems)
{
- if (Q_UNLIKELY(DBG_MOUSE_TARGET().isDebugEnabled())) {
- // qDebug() << map(&objectName, targetItems) but done the hard way because C++ is still that primitive
- QStringList targetNames;
- for (QQuickItem *t : targetItems)
- targetNames << (QLatin1String(t->metaObject()->className()) + QLatin1Char(' ') + t->objectName());
- qCDebug(DBG_MOUSE_TARGET) << "finding potential filtering parents of" << targetNames;
- }
filteringParentItems.clear();
for (QQuickItem *item : targetItems) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -2747,25 +2756,34 @@ void QQuickWindowPrivate::updateFilteringParentItems(const QVector<QQuickItem *>
parent = parent->parentItem();
}
}
+ if (Q_UNLIKELY(DBG_MOUSE_TARGET().isDebugEnabled())) {
+ QStringList l;
+ for (QPair<QQuickItem *,QQuickItem *> pair : filteringParentItems)
+ l << (QLatin1String(pair.first->metaObject()->className()) + QLatin1Char(' ') + pair.first->objectName() +
+ QLatin1String(" <- ") + pair.second->metaObject()->className()) + QLatin1Char(' ') + pair.second->objectName();
+ qCDebug(DBG_MOUSE_TARGET) << "potential filtering parents:" << l;
+ }
}
-bool QQuickWindowPrivate::sendFilteredPointerEvent(QQuickPointerEvent *event, QQuickItem *receiver, QQuickItem **itemThatFiltered)
+bool QQuickWindowPrivate::sendFilteredPointerEvent(QQuickPointerEvent *event, QQuickItem *receiver)
{
if (!allowChildEventFiltering)
return false;
bool ret = false;
+ QVarLengthArray<QQuickItem *> filteringParentsToSkip;
if (QQuickPointerMouseEvent *pme = event->asPointerMouseEvent()) {
for (QPair<QQuickItem *,QQuickItem *> itemAndParent : filteringParentItems) {
QQuickItem *item = receiver ? receiver : itemAndParent.first;
QQuickItem *filteringParent = itemAndParent.second;
if (item == filteringParent)
continue; // a filtering item never needs to filter for itself
+ if (filteringParentsToSkip.contains(filteringParent))
+ continue;
QPointF localPos = item->mapFromScene(pme->point(0)->scenePos());
QMouseEvent *me = pme->asMouseEvent(localPos);
- if (filteringParent->childMouseEventFilter(item, me)) {
- if (itemThatFiltered) *itemThatFiltered = item;
+ if (filteringParent->childMouseEventFilter(item, me))
ret = true;
- }
+ filteringParentsToSkip.append(filteringParent);
}
} else if (QQuickPointerTouchEvent *pte = event->asPointerTouchEvent()) {
QVarLengthArray<QPair<QQuickPointerHandler *, QQuickEventPoint *>, 32> passiveGrabsToCancel;
@@ -2867,7 +2885,7 @@ bool QQuickWindowPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem
hasFiltered->insert(target);
if (target->childMouseEventFilter(item, event))
filtered = true;
- qCDebug(DBG_MOUSE_TARGET) << target << "childMouseEventFilter ->" << filtered;
+ qCDebug(DBG_MOUSE_TARGET) << "for" << item << target << "childMouseEventFilter ->" << filtered;
}
return sendFilteredMouseEvent(target->parentItem(), item, event, hasFiltered) || filtered;
@@ -3825,6 +3843,23 @@ QQmlIncubationController *QQuickWindow::incubationController() const
*/
/*!
+ \enum QQuickWindow::TextRenderType
+ \since 5.10
+
+ This enum describes the default render type of text-like elements in Qt
+ Quick (\l Text, \l TextInput, etc.).
+
+ Select NativeTextRendering if you prefer text to look native on the target
+ platform and do not require advanced features such as transformation of the
+ text. Using such features in combination with the NativeTextRendering
+ render type will lend poor and sometimes pixelated results.
+
+ \value QtTextRendering Use Qt's own rasterization algorithm.
+
+ \value NativeTextRendering Use the operating system's native rasterizer for text.
+*/
+
+/*!
\fn void QQuickWindow::beforeSynchronizing()
This signal is emitted before the scene graph is synchronized with the QML state.
@@ -4794,7 +4829,7 @@ void QQuickWindow::setSceneGraphBackend(const QString &backend)
}
/*!
- Returns the requested Qt Quick scenegraph \a backend.
+ Returns the requested Qt Quick scenegraph backend.
\note The return value of this function may still be outdated by
subsequent calls to setSceneGraphBackend() until the first QQuickWindow in the
@@ -4846,6 +4881,34 @@ QSGNinePatchNode *QQuickWindow::createNinePatchNode() const
return isSceneGraphInitialized() ? d->context->sceneGraphContext()->createNinePatchNode() : nullptr;
}
+/*!
+ \since 5.10
+
+ Returns the render type of text-like elements in Qt Quick.
+ The default is QQuickWindow::QtTextRendering.
+
+ \sa setTextRenderType()
+*/
+QQuickWindow::TextRenderType QQuickWindow::textRenderType()
+{
+ return QQuickWindowPrivate::textRenderType;
+}
+
+/*!
+ \since 5.10
+
+ Sets the default render type of text-like elements in Qt Quick to \a renderType.
+
+ \note setting the render type will only affect elements created afterwards;
+ the render type of existing elements will not be modified.
+
+ \sa textRenderType()
+*/
+void QQuickWindow::setTextRenderType(QQuickWindow::TextRenderType renderType)
+{
+ QQuickWindowPrivate::textRenderType = renderType;
+}
+
#include "moc_qquickwindow.cpp"
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index d1a16fbeb6..022c4738f2 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -100,6 +100,12 @@ public:
};
Q_ENUM(SceneGraphError)
+ enum TextRenderType {
+ QtTextRendering,
+ NativeTextRendering
+ };
+ Q_ENUM(TextRenderType)
+
explicit QQuickWindow(QWindow *parent = Q_NULLPTR);
explicit QQuickWindow(QQuickRenderControl *renderControl);
@@ -170,6 +176,9 @@ public:
QSGImageNode *createImageNode() const;
QSGNinePatchNode *createNinePatchNode() const;
+ static TextRenderType textRenderType();
+ static void setTextRenderType(TextRenderType renderType);
+
Q_SIGNALS:
void frameSwapped();
Q_REVISION(2) void openglContextCreated(QOpenGLContext *context);
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 14564a7f55..36b2c57e5c 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -148,7 +148,7 @@ public:
static QMouseEvent *cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos = 0);
void deliverMouseEvent(QQuickPointerMouseEvent *pointerEvent);
bool sendFilteredMouseEvent(QQuickItem *, QQuickItem *, QEvent *, QSet<QQuickItem *> *);
- bool sendFilteredPointerEvent(QQuickPointerEvent *event, QQuickItem *receiver, QQuickItem **itemThatFiltered = 0);
+ bool sendFilteredPointerEvent(QQuickPointerEvent *event, QQuickItem *receiver);
#if QT_CONFIG(wheelevent)
bool deliverWheelEvent(QQuickItem *, QWheelEvent *);
#endif
@@ -279,6 +279,7 @@ public:
mutable QQuickWindowIncubationController *incubationController;
static bool defaultAlphaBuffer;
+ static QQuickWindow::TextRenderType textRenderType;
static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int startDragThreshold = -1);
diff --git a/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp b/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
index 1b8882e9a5..bb8fce046d 100644
--- a/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
+++ b/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
@@ -75,35 +75,35 @@ static unsigned int typeMap[5] = {
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
};
-EtcTexture::EtcTexture()
+QEtcTexture::QEtcTexture()
: m_texture_id(0), m_uploaded(false)
{
initializeOpenGLFunctions();
}
-EtcTexture::~EtcTexture()
+QEtcTexture::~QEtcTexture()
{
if (m_texture_id)
glDeleteTextures(1, &m_texture_id);
}
-int EtcTexture::textureId() const
+int QEtcTexture::textureId() const
{
if (m_texture_id == 0) {
- EtcTexture *texture = const_cast<EtcTexture*>(this);
+ QEtcTexture *texture = const_cast<QEtcTexture*>(this);
texture->glGenTextures(1, &texture->m_texture_id);
}
return m_texture_id;
}
-bool EtcTexture::hasAlphaChannel() const
+bool QEtcTexture::hasAlphaChannel() const
{
return m_type == GL_COMPRESSED_RGBA8_ETC2_EAC ||
m_type == GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
}
-void EtcTexture::bind()
+void QEtcTexture::bind()
{
if (m_uploaded && m_texture_id) {
glBindTexture(GL_TEXTURE_2D, m_texture_id);
@@ -158,7 +158,7 @@ public:
int textureByteCount() const { return m_data.size(); }
QSGTexture *createTexture(QQuickWindow *) const {
- EtcTexture *texture = new EtcTexture;
+ QEtcTexture *texture = new QEtcTexture;
texture->m_data = m_data;
texture->m_size = m_size;
texture->m_paddedSize = m_paddedSize;
diff --git a/src/quick/scenegraph/compressedtexture/qsgpkmhandler_p.h b/src/quick/scenegraph/compressedtexture/qsgpkmhandler_p.h
index 77097cb80a..eb6b2e46c0 100644
--- a/src/quick/scenegraph/compressedtexture/qsgpkmhandler_p.h
+++ b/src/quick/scenegraph/compressedtexture/qsgpkmhandler_p.h
@@ -66,12 +66,12 @@ public:
QQuickTextureFactory *read(QIODevice *device);
};
-class EtcTexture : public QSGTexture, protected QOpenGLFunctions
+class QEtcTexture : public QSGTexture, protected QOpenGLFunctions
{
Q_OBJECT
public:
- EtcTexture();
- ~EtcTexture();
+ QEtcTexture();
+ ~QEtcTexture();
void bind();
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index edee29584c..d016e79641 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -2914,6 +2914,11 @@ void Renderer::renderRenderNode(Batch *batch)
glBindFramebuffer(GL_FRAMEBUFFER, prevFbo);
}
+void Renderer::releaseCachedResources()
+{
+ m_shaderManager->invalidated();
+}
+
class VisualizeShader : public QOpenGLShaderProgram
{
public:
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 2c0f8667e8..b0a14d23b9 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -629,6 +629,7 @@ public:
protected:
void nodeChanged(QSGNode *node, QSGNode::DirtyState state) Q_DECL_OVERRIDE;
void render() Q_DECL_OVERRIDE;
+ void releaseCachedResources() Q_DECL_OVERRIDE;
private:
enum ClipTypeBit
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
index 1ea2775e6f..1cb4c56316 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
@@ -92,7 +92,8 @@ public:
QSGNodeUpdater *nodeUpdater() const;
void setNodeUpdater(QSGNodeUpdater *updater);
inline QSGMaterialShader::RenderState state(QSGMaterialShader::RenderState::DirtyStates dirty) const;
- virtual void setCustomRenderMode(const QByteArray &) { };
+ virtual void setCustomRenderMode(const QByteArray &) { }
+ virtual void releaseCachedResources() { }
void clearChangedFlag() { m_changed_emitted = false; }
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 4a69b770ed..88899c400c 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -56,6 +56,7 @@
#include <QtQuick/QQuickWindow>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qsgcontext_p.h>
+#include <QtQuick/private/qsgrenderer_p.h>
#include <private/qquickprofiler_p.h>
#if QT_CONFIG(opengl)
@@ -152,7 +153,7 @@ public:
void update(QQuickWindow *window) override { maybeUpdate(window); } // identical for this implementation.
void handleUpdateRequest(QQuickWindow *) override;
- void releaseResources(QQuickWindow *) override { }
+ void releaseResources(QQuickWindow *) override;
QAnimationDriver *animationDriver() const override { return 0; }
@@ -505,6 +506,14 @@ QSGContext *QSGGuiThreadRenderLoop::sceneGraphContext() const
return sg;
}
+void QSGGuiThreadRenderLoop::releaseResources(QQuickWindow *w)
+{
+ // No full invalidation of the rendercontext, just clear some caches.
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(w);
+ if (d->renderer)
+ d->renderer->releaseCachedResources();
+}
+
void QSGGuiThreadRenderLoop::handleUpdateRequest(QQuickWindow *window)
{
renderWindow(window);
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 1e5e61e43b..4a712d3cdd 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -406,6 +406,13 @@ bool QSGRenderThread::event(QEvent *e)
stopEventProcessing = true;
} else {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- not releasing because window is still active";
+ if (window) {
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+ if (d->renderer) {
+ qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- requesting renderer to release cached resources";
+ d->renderer->releaseCachedResources();
+ }
+ }
}
waitCondition.wakeOne();
wm->m_lockedForSync = false;
@@ -553,6 +560,7 @@ void QSGRenderThread::sync(bool inExpose)
if (d->renderer)
d->renderer->clearChangedFlag();
d->syncSceneGraph();
+ sgrc->endSync();
if (!hadRenderer && d->renderer) {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- renderer was created";
syncResultedInChanges = true;
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index e10e52d95e..e33f31f2ac 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -48,6 +48,7 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/private/qquickwindow_p.h>
+#include <QtQuick/private/qsgrenderer_p.h>
#include <QtQuick/private/qsgdefaultrendercontext_p.h>
#include <QtQuick/QQuickWindow>
@@ -503,6 +504,15 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
QQuickProfiler::SceneGraphRenderLoopSwap);
}
+void QSGWindowsRenderLoop::releaseResources(QQuickWindow *w)
+{
+ // No full invalidation of the rendercontext, just clear some caches.
+ RLDEBUG("releaseResources");
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(w);
+ if (d->renderer)
+ d->renderer->releaseCachedResources();
+}
+
QT_END_NAMESPACE
#include "moc_qsgwindowsrenderloop_p.cpp"
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop_p.h b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
index 1940a66af2..a1188fed8a 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop_p.h
+++ b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
@@ -86,7 +86,7 @@ public:
QSGContext *sceneGraphContext() const override { return m_sg; }
QSGRenderContext *createRenderContext(QSGContext *) const override;
- void releaseResources(QQuickWindow *) override { }
+ void releaseResources(QQuickWindow *) override;
void render();
void renderWindow(QQuickWindow *window);
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index d5f836a525..22f0b13f46 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -116,7 +116,7 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
Texture *t = 0;
if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) {
if (!m_atlas)
- m_atlas = new Atlas(m_atlas_size, this);
+ m_atlas = new Atlas(m_atlas_size);
// t may be null for atlas allocation failure
t = m_atlas->create(image);
if (t && !hasAlphaChannel && t->hasAlphaChannel())
@@ -125,9 +125,8 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
return t;
}
-Atlas::Atlas(const QSize &size, QObject *parent)
- : QObject(parent)
- , m_allocator(size)
+Atlas::Atlas(const QSize &size)
+ : m_allocator(size)
, m_texture_id(0)
, m_size(size)
, m_atlas_transient_image_threshold(0)
diff --git a/src/quick/scenegraph/util/qsgatlastexture_p.h b/src/quick/scenegraph/util/qsgatlastexture_p.h
index 0bb07e8e89..3dee539547 100644
--- a/src/quick/scenegraph/util/qsgatlastexture_p.h
+++ b/src/quick/scenegraph/util/qsgatlastexture_p.h
@@ -88,7 +88,7 @@ private:
class Atlas : public QObject
{
public:
- Atlas(const QSize &size, QObject *parent);
+ Atlas(const QSize &size);
~Atlas();
void invalidate();
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index 6df23cdff5..14ead56740 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -303,6 +303,7 @@ public:
QV4::ScopedValue vwspac(scope, obj->get((s = v4->newString(QStringLiteral("wordSpacing")))));
QV4::ScopedValue vhint(scope, obj->get((s = v4->newString(QStringLiteral("hintingPreference")))));
QV4::ScopedValue vkerning(scope, obj->get((s = v4->newString(QStringLiteral("kerning")))));
+ QV4::ScopedValue vshaping(scope, obj->get((s = v4->newString(QStringLiteral("preferShaping")))));
// pull out the values, set ok to true if at least one valid field is given.
if (vbold->isBoolean()) {
@@ -361,6 +362,13 @@ public:
retn.setKerning(vkerning->booleanValue());
if (ok) *ok = true;
}
+ if (vshaping->isBoolean()) {
+ bool enable = vshaping->booleanValue();
+ if (enable)
+ retn.setStyleStrategy(static_cast<QFont::StyleStrategy>(retn.styleStrategy() & ~QFont::PreferNoShaping));
+ else
+ retn.setStyleStrategy(static_cast<QFont::StyleStrategy>(retn.styleStrategy() | QFont::PreferNoShaping));
+ }
return retn;
}
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index b4a6b9e1f6..6ee5b95dc7 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -255,7 +255,7 @@ void QQuickImageResponse::cancel()
If you want the rest of the URL to be case insensitive, you will have to take care
of that yourself inside your image provider.
- \section2 An example
+ \section2 An Example
Here are two images. Their \c source values indicate they should be loaded by
an image provider named "colors", and the images to be loaded are "yellow"
@@ -301,7 +301,7 @@ void QQuickImageResponse::cancel()
instead of registering it in the application \c main() function as shown above.
- \section2 Asynchronous image loading
+ \section2 Asynchronous Image Loading
Image providers that support QImage or Texture loading automatically include support
for asychronous loading of images. To enable asynchronous loading for an
@@ -330,7 +330,7 @@ void QQuickImageResponse::cancel()
See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation.
- \section2 Image caching
+ \section2 Image Caching
Images returned by a QQuickImageProvider are automatically cached,
similar to any image loaded by the QML engine. When an image with a
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 15defdc01b..b19eec6fb3 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -146,6 +146,9 @@ QT_BEGIN_NAMESPACE
\li No
\endtable
+ \note Path is a non-visual type; it does not display anything on its own.
+ To draw a path, use \l Shape.
+
\sa PathView, Shape, PathAttribute, PathPercent, PathLine, PathMove, PathQuad, PathCubic, PathArc, PathCurve, PathSvg
*/
QQuickPath::QQuickPath(QObject *parent)
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 8d76bd986f..61380b3ea0 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE
\l {Item::}{parent} value, use ParentChange instead.
- \section2 Resetting property values
+ \section2 Resetting Property Values
The \c undefined value can be used to reset the property value for a state.
In the following example, when \c myText changes to the \e widerText
@@ -111,7 +111,7 @@ QT_BEGIN_NAMESPACE
\snippet qml/propertychanges.qml reset
- \section2 Immediate property changes in transitions
+ \section2 Immediate Property Changes in Transitions
When \l{Animation and Transitions in Qt Quick}{Transitions} are used to animate
state changes, they animate properties from their values in the current
diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp
index bc4a72b6ea..e4a03f3b52 100644
--- a/src/quick/util/qquickvaluetypes.cpp
+++ b/src/quick/util/qquickvaluetypes.cpp
@@ -767,6 +767,19 @@ void QQuickFontValueType::setKerning(bool b)
v.setKerning(b);
}
+bool QQuickFontValueType::preferShaping() const
+{
+ return (v.styleStrategy() & QFont::PreferNoShaping) == 0;
+}
+
+void QQuickFontValueType::setPreferShaping(bool enable)
+{
+ if (enable)
+ v.setStyleStrategy(static_cast<QFont::StyleStrategy>(v.styleStrategy() & ~QFont::PreferNoShaping));
+ else
+ v.setStyleStrategy(static_cast<QFont::StyleStrategy>(v.styleStrategy() | QFont::PreferNoShaping));
+}
+
QT_END_NAMESPACE
#include "moc_qquickvaluetypes_p.cpp"
diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h
index a3f35a84ec..5a9af970e8 100644
--- a/src/quick/util/qquickvaluetypes_p.h
+++ b/src/quick/util/qquickvaluetypes_p.h
@@ -324,6 +324,7 @@ class QQuickFontValueType
Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing FINAL)
Q_PROPERTY(HintingPreference hintingPreference READ hintingPreference WRITE setHintingPreference FINAL)
Q_PROPERTY(bool kerning READ kerning WRITE setKerning FINAL)
+ Q_PROPERTY(bool preferShaping READ preferShaping WRITE setPreferShaping FINAL)
public:
enum FontWeight { Thin = QFont::Thin,
@@ -397,6 +398,9 @@ public:
bool kerning() const;
void setKerning(bool b);
+
+ bool preferShaping() const;
+ void setPreferShaping(bool b);
};
QT_END_NAMESPACE
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index f71cf3c41b..6784155d25 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -423,7 +423,7 @@ QImage QQuickWidgetPrivate::grabFramebuffer()
entire purpose of QQuickWidget is to render Quick scenes without a separate native
window, hence making it a native widget should always be avoided.
- \section1 Scene graph and context persistency
+ \section1 Scene Graph and Context Persistency
QQuickWidget honors QQuickWindow::isPersistentSceneGraph(), meaning that
applications can decide - by calling
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro
index a50411e18b..63721cc575 100644
--- a/tests/auto/qml/debugger/debugger.pro
+++ b/tests/auto/qml/debugger/debugger.pro
@@ -10,7 +10,8 @@ PUBLICTESTS += \
qqmlenginedebuginspectorintegrationtest \
qqmlenginecontrol \
qqmldebuggingenabler \
- qqmlnativeconnector
+ qqmlnativeconnector \
+ qqmldebugprocess
PRIVATETESTS += \
qqmldebugclient \
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST b/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST
deleted file mode 100644
index 5fb1dc193b..0000000000
--- a/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTQAINFRA-1334
-windows gcc
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST
deleted file mode 100644
index 5fb1dc193b..0000000000
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTQAINFRA-1334
-windows gcc
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
index 134de44858..a76740a3f9 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "debugutil_p.h"
+#include "qqmldebugprocess_p.h"
#include "../../../shared/util.h"
#include <private/qqmldebugclient_p.h>
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST
deleted file mode 100644
index 5fb1dc193b..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTQAINFRA-1334
-windows gcc
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
index 59483d75da..33b294593f 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "debugutil_p.h"
+#include "qqmldebugprocess_p.h"
#include "../../shared/qqmlenginedebugclient.h"
#include "../../../../shared/util.h"
diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
index 8d21a8a45a..4b28857fc0 100644
--- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
+++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
@@ -32,6 +32,9 @@
#include <private/qqmldebugconnector_p.h>
#include <private/qqmldebugconnection_p.h>
+#include <QtQml/qqmldebug.h>
+#include <QtQml/qqmlengine.h>
+
#include <QtTest/qtest.h>
#include <QtTest/qsignalspy.h>
#include <QtNetwork/qhostaddress.h>
diff --git a/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess.pro b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess.pro
new file mode 100644
index 0000000000..331d87b9f1
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS = qqmldebugprocess qqmldebugprocessprocess
+
+qqmldebugprocess.depends = qqmldebugprocessprocess
diff --git a/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/qqmldebugprocess.pro b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/qqmldebugprocess.pro
new file mode 100644
index 0000000000..9bea2d222c
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/qqmldebugprocess.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmldebugprocess
+QT = core testlib
+CONFIG -= debug_and_release_target
+macos:CONFIG -= app_bundle
+
+SOURCES += \
+ ../../shared/qqmldebugprocess.cpp \
+ tst_qqmldebugprocess.cpp
+
+HEADERS += \
+ ../../shared/qqmldebugprocess_p.h
+
+INCLUDEPATH += ../../shared
diff --git a/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp
new file mode 100644
index 0000000000..993a1d5f63
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qqmldebugprocess_p.h>
+#include <QtTest>
+
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qscopedpointer.h>
+
+class tst_QQmlDebugProcess : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void sessionStart_data();
+ void sessionStart();
+};
+
+void tst_QQmlDebugProcess::sessionStart_data()
+{
+ QTest::addColumn<int>("delay");
+ QTest::addColumn<QString>("arg");
+ QTest::addColumn<bool>("sessionExpected");
+ QTest::addColumn<bool>("outputExpected");
+
+ QTest::addRow("synchronous / waiting") << -1
+ << "QML Debugger: Waiting for connection on port 2423..."
+ << true << false;
+ QTest::addRow("synchronous / failed") << -1 << "QML Debugger: Unable to listen to port 242."
+ << false << false;
+ QTest::addRow("synchronous / unknown") << -1 << "QML Debugger: You don't know this string."
+ << false << true;
+ QTest::addRow("synchronous / appout") << -1 << "Output from app itself."
+ << false << true;
+
+ QTest::addRow("no delay / waiting") << 0
+ << "QML Debugger: Waiting for connection on port 2423..."
+ << true << false;
+ QTest::addRow("no delay / failed") << 0 << "QML Debugger: Unable to listen to port 242."
+ << false << false;
+ QTest::addRow("no delay / unknown") << 0 << "QML Debugger: You don't know this string."
+ << false << true;
+ QTest::addRow("no delay / appout") << 0 << "Output from app itself."
+ << false << true;
+
+ QTest::addRow("delay / waiting") << 1000
+ << "QML Debugger: Waiting for connection on port 2423..."
+ << true << false;
+ QTest::addRow("delay / failed") << 1000 << "QML Debugger: Unable to listen to port 242."
+ << false << false;
+ QTest::addRow("delay / unknown") << 1000 << "QML Debugger: You don't know this string."
+ << false << true;
+ QTest::addRow("delay / appout") << 1000 << "Output from app itself."
+ << false << true;
+}
+
+void tst_QQmlDebugProcess::sessionStart()
+{
+ QFETCH(int, delay);
+ QFETCH(QString, arg);
+ QFETCH(bool, sessionExpected);
+ QFETCH(bool, outputExpected);
+
+ QScopedPointer<QQmlDebugProcess> process(
+ new QQmlDebugProcess(QCoreApplication::applicationDirPath()
+ + QLatin1String("/qqmldebugprocessprocess"), this));
+ QVERIFY(process);
+
+ bool outputReceived = false;
+ connect(process.data(), &QQmlDebugProcess::readyReadStandardOutput, this, [&]() {
+ QVERIFY(outputExpected);
+ QVERIFY(!outputReceived);
+ QCOMPARE(process->output().trimmed(), arg);
+ outputReceived = true;
+ QTimer::singleShot(qMax(delay, 0), process.data(), &QQmlDebugProcess::stop);
+ });
+
+ if (!outputExpected && !sessionExpected)
+ QTest::ignoreMessage(QtWarningMsg, "App was unable to bind to port!");
+ process->start(QStringList({arg}));
+
+ bool done = false;
+ auto wait = [&](){
+ QCOMPARE(process->waitForSessionStart(), sessionExpected);
+ QCOMPARE(outputReceived, outputExpected);
+ process->stop();
+ done = true;
+ };
+
+ if (delay < 0)
+ wait();
+ else
+ QTimer::singleShot(delay, process.data(), wait);
+
+ QTRY_VERIFY(done);
+ QVERIFY(process->state().startsWith("not running"));
+}
+
+QTEST_MAIN(tst_QQmlDebugProcess)
+
+#include "tst_qqmldebugprocess.moc"
diff --git a/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.cpp b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.cpp
new file mode 100644
index 0000000000..21cce53fc3
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.cpp
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qcoreapplication.h>
+
+// Process that just outputs a fake "Waiting" message.
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+ if (argc > 1)
+ qDebug() << argv[1];
+ return app.exec();
+}
diff --git a/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.pro b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.pro
new file mode 100644
index 0000000000..55a77d830d
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocessprocess/qqmldebugprocessprocess.pro
@@ -0,0 +1,10 @@
+QT = core
+macos:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+SOURCES += qqmldebugprocessprocess.cpp
+
+DESTDIR = ../qqmldebugprocess
+
+target.path = $$[QT_INSTALL_TESTS]/tst_qqmldebugprocess
+INSTALLS += target
+
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 06e4a4bfcc..4e103e9a65 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -29,6 +29,7 @@
#include "qqmldebugtestservice.h"
#include "debugutil_p.h"
+#include "qqmldebugprocess_p.h"
#include "../../../shared/util.h"
#include <private/qqmldebugclient_p.h>
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST b/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST
deleted file mode 100644
index 5fb1dc193b..0000000000
--- a/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTQAINFRA-1334
-windows gcc
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/BLACKLIST b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/BLACKLIST
deleted file mode 100644
index 5fb1dc193b..0000000000
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTQAINFRA-1334
-windows gcc
diff --git a/tests/auto/qml/debugger/qqmlinspector/BLACKLIST b/tests/auto/qml/debugger/qqmlinspector/BLACKLIST
deleted file mode 100644
index 5fb1dc193b..0000000000
--- a/tests/auto/qml/debugger/qqmlinspector/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTQAINFRA-1334
-windows gcc
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index a4cf932ee1..5c9506eb21 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -28,6 +28,7 @@
#include "qqmlinspectorclient.h"
#include "../shared/debugutil_p.h"
+#include "../shared/qqmldebugprocess_p.h"
#include "../../../shared/util.h"
#include <private/qqmldebugconnection_p.h>
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST b/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST
deleted file mode 100644
index 5fb1dc193b..0000000000
--- a/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTQAINFRA-1334
-windows gcc
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 45e4ad1207..6232a8a867 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "debugutil_p.h"
+#include "qqmldebugprocess_p.h"
#include "../../../shared/util.h"
#include <private/qqmlprofilerclient_p.h>
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index d3bb25ee89..8ecbe53822 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -27,13 +27,14 @@
****************************************************************************/
#include "debugutil_p.h"
+#include "qqmldebugprocess_p.h"
#include <private/qqmldebugconnection_p.h>
+#include <QtQml/qqmldebug.h>
+
#include <QtCore/qeventloop.h>
#include <QtCore/qtimer.h>
-#include <QtCore/qfileinfo.h>
-#include <QtCore/qdir.h>
bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
@@ -116,193 +117,6 @@ void QQmlDebugTestClient::messageReceived(const QByteArray &ba)
emit serverMessage(ba);
}
-QQmlDebugProcess::QQmlDebugProcess(const QString &executable, QObject *parent)
- : QObject(parent)
- , m_executable(executable)
- , m_started(false)
- , m_port(0)
- , m_maximumBindErrors(0)
- , m_receivedBindErrors(0)
-{
- m_process.setProcessChannelMode(QProcess::MergedChannels);
- m_timer.setSingleShot(true);
- m_timer.setInterval(5000);
- connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(processAppOutput()));
- connect(&m_process, SIGNAL(errorOccurred(QProcess::ProcessError)),
- this, SLOT(processError(QProcess::ProcessError)));
- connect(&m_timer, SIGNAL(timeout()), SLOT(timeout()));
-}
-
-QQmlDebugProcess::~QQmlDebugProcess()
-{
- stop();
-}
-
-QString QQmlDebugProcess::state()
-{
- QString stateStr;
- switch (m_process.state()) {
- case QProcess::NotRunning: {
- stateStr = "not running";
- if (m_process.exitStatus() == QProcess::CrashExit)
- stateStr += " (crashed!)";
- else
- stateStr += ", return value " + QString::number(m_process.exitCode());
- break;
- }
- case QProcess::Starting: stateStr = "starting"; break;
- case QProcess::Running: stateStr = "running"; break;
- }
- return stateStr;
-}
-
-void QQmlDebugProcess::start(const QStringList &arguments)
-{
-#ifdef Q_OS_MAC
- // make sure m_executable points to the actual binary even if it's inside an app bundle
- QFileInfo binFile(m_executable);
- if (!binFile.isExecutable()) {
- QDir bundleDir(m_executable + ".app");
- if (bundleDir.exists()) {
- m_executable = bundleDir.absoluteFilePath("Contents/MacOS/" + binFile.baseName());
- //qDebug() << Q_FUNC_INFO << "found bundled binary" << m_executable;
- }
- }
-#endif
- m_mutex.lock();
- m_port = 0;
- m_process.setEnvironment(QProcess::systemEnvironment() + m_environment);
- m_process.start(m_executable, arguments);
- if (!m_process.waitForStarted()) {
- qWarning() << "QML Debug Client: Could not launch app " << m_executable
- << ": " << m_process.errorString();
- m_eventLoop.quit();
- } else {
- m_timer.start();
- }
- m_mutex.unlock();
-}
-
-void QQmlDebugProcess::stop()
-{
- if (m_process.state() != QProcess::NotRunning) {
- m_process.kill();
- m_process.waitForFinished(5000);
- }
-}
-
-void QQmlDebugProcess::setMaximumBindErrors(int ignore)
-{
- m_maximumBindErrors = ignore;
-}
-
-void QQmlDebugProcess::timeout()
-{
- qWarning() << "Timeout while waiting for QML debugging messages "
- "in application output. Process is in state" << m_process.state() << ", Output:" << m_output << ".";
- m_eventLoop.quit();
-}
-
-bool QQmlDebugProcess::waitForSessionStart()
-{
- if (m_process.state() != QProcess::Running) {
- qWarning() << "Could not start up " << m_executable;
- return false;
- }
- m_eventLoop.exec();
-
- return m_started;
-}
-
-int QQmlDebugProcess::debugPort() const
-{
- return m_port;
-}
-
-bool QQmlDebugProcess::waitForFinished()
-{
- return m_process.waitForFinished();
-}
-
-QProcess::ExitStatus QQmlDebugProcess::exitStatus() const
-{
- return m_process.exitStatus();
-}
-
-void QQmlDebugProcess::addEnvironment(const QString &environment)
-{
- m_environment.append(environment);
-}
-
-QString QQmlDebugProcess::output() const
-{
- return m_output;
-}
-
-void QQmlDebugProcess::processAppOutput()
-{
- m_mutex.lock();
-
- bool outputFromAppItself = false;
-
- QString newOutput = m_process.readAll();
- m_output.append(newOutput);
- m_outputBuffer.append(newOutput);
-
- while (true) {
- const int nlIndex = m_outputBuffer.indexOf(QLatin1Char('\n'));
- if (nlIndex < 0) // no further complete lines
- break;
- const QString line = m_outputBuffer.left(nlIndex);
- m_outputBuffer = m_outputBuffer.right(m_outputBuffer.size() - nlIndex - 1);
-
- if (line.contains("QML Debugger:")) {
- const QRegExp portRx("Waiting for connection on port (\\d+)");
- if (portRx.indexIn(line) != -1) {
- m_port = portRx.cap(1).toInt();
- m_timer.stop();
- m_started = true;
- m_eventLoop.quit();
- continue;
- }
- if (line.contains("Unable to listen")) {
- if (++m_receivedBindErrors >= m_maximumBindErrors) {
- if (m_maximumBindErrors == 0)
- qWarning() << "App was unable to bind to port!";
- m_timer.stop();
- m_eventLoop.quit();
- }
- continue;
- }
- } else {
- // set to true if there is output not coming from the debugger
- outputFromAppItself = true;
- }
- }
- m_mutex.unlock();
-
- if (outputFromAppItself)
- emit readyReadStandardOutput();
-}
-
-void QQmlDebugProcess::processError(QProcess::ProcessError error)
-{
- if (!m_eventLoop.isRunning())
- return;
-
- qDebug() << "An error occurred while waiting for debug process to become available:";
- switch (error) {
- case QProcess::FailedToStart: qDebug() << "Process failed to start."; break;
- case QProcess::Crashed: qDebug() << "Process crashed."; break;
- case QProcess::Timedout: qDebug() << "Process timed out."; break;
- case QProcess::WriteError: qDebug() << "Error while writing to process."; break;
- case QProcess::ReadError: qDebug() << "Error while reading from process."; break;
- case QProcess::UnknownError: qDebug() << "Unknown process error."; break;
- }
-
- m_eventLoop.exit();
-}
-
template<typename F>
struct Finalizer {
F m_lambda;
diff --git a/tests/auto/qml/debugger/shared/debugutil.pri b/tests/auto/qml/debugger/shared/debugutil.pri
index 44e8e0f999..13dcdb91d8 100644
--- a/tests/auto/qml/debugger/shared/debugutil.pri
+++ b/tests/auto/qml/debugger/shared/debugutil.pri
@@ -3,5 +3,9 @@ QT += qmldebug-private
INCLUDEPATH += $$PWD
include($$PWD/../../../shared/util.pri)
-HEADERS += $$PWD/debugutil_p.h
-SOURCES += $$PWD/debugutil.cpp
+HEADERS += \
+ $$PWD/debugutil_p.h \
+ $$PWD/qqmldebugprocess_p.h
+SOURCES += \
+ $$PWD/debugutil.cpp \
+ $$PWD/qqmldebugprocess.cpp
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index f1b25d5f6d..94ad83bfce 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -1,4 +1,3 @@
-
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
@@ -44,14 +43,6 @@
#include <../../../shared/util.h>
#include <private/qqmldebugclient_p.h>
-#include <QtCore/qeventloop.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qthread.h>
-#include <QtCore/qprocess.h>
-#include <QtCore/qmutex.h>
-#include <QtTest/qtest.h>
-#include <QtQml/qqmlengine.h>
-
class QQmlDebugProcess;
class QQmlDebugTest : public QQmlDataTest
{
@@ -108,51 +99,6 @@ private:
QByteArray lastMsg;
};
-class QQmlDebugProcess : public QObject
-{
- Q_OBJECT
-public:
- QQmlDebugProcess(const QString &executable, QObject *parent = 0);
- ~QQmlDebugProcess();
-
- QString state();
-
- void addEnvironment(const QString &environment);
-
- void start(const QStringList &arguments);
- bool waitForSessionStart();
- int debugPort() const;
-
- bool waitForFinished();
- QProcess::ExitStatus exitStatus() const;
-
- QString output() const;
- void stop();
- void setMaximumBindErrors(int numErrors);
-
-signals:
- void readyReadStandardOutput();
-
-private slots:
- void timeout();
- void processAppOutput();
- void processError(QProcess::ProcessError error);
-
-private:
- QString m_executable;
- QProcess m_process;
- QString m_outputBuffer;
- QString m_output;
- QTimer m_timer;
- QEventLoop m_eventLoop;
- QMutex m_mutex;
- bool m_started;
- QStringList m_environment;
- int m_port;
- int m_maximumBindErrors;
- int m_receivedBindErrors;
-};
-
class QQmlInspectorResultRecipient : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
new file mode 100644
index 0000000000..816fec6a2f
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
@@ -0,0 +1,245 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmldebugprocess_p.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+
+QQmlDebugProcess::QQmlDebugProcess(const QString &executable, QObject *parent)
+ : QObject(parent)
+ , m_executable(executable)
+ , m_state(SessionUnknown)
+ , m_port(0)
+ , m_maximumBindErrors(0)
+ , m_receivedBindErrors(0)
+{
+ m_process.setProcessChannelMode(QProcess::MergedChannels);
+ m_timer.setSingleShot(true);
+ m_timer.setInterval(15000);
+ connect(&m_process, &QProcess::readyReadStandardOutput,
+ this, &QQmlDebugProcess::processAppOutput);
+ connect(&m_process, &QProcess::errorOccurred,
+ this, &QQmlDebugProcess::processError);
+ connect(&m_process, static_cast<void(QProcess::*)(int)>(&QProcess::finished),
+ this, [this]() {
+ m_timer.stop();
+ m_eventLoop.quit();
+ });
+ connect(&m_timer, &QTimer::timeout,
+ this, &QQmlDebugProcess::timeout);
+}
+
+QQmlDebugProcess::~QQmlDebugProcess()
+{
+ stop();
+}
+
+QString QQmlDebugProcess::state()
+{
+ QString stateStr;
+ switch (m_process.state()) {
+ case QProcess::NotRunning: {
+ stateStr = "not running";
+ if (m_process.exitStatus() == QProcess::CrashExit)
+ stateStr += " (crashed!)";
+ else
+ stateStr += ", return value " + QString::number(m_process.exitCode());
+ break;
+ }
+ case QProcess::Starting:
+ stateStr = "starting";
+ break;
+ case QProcess::Running:
+ stateStr = "running";
+ break;
+ }
+ return stateStr;
+}
+
+void QQmlDebugProcess::start(const QStringList &arguments)
+{
+#ifdef Q_OS_MAC
+ // make sure m_executable points to the actual binary even if it's inside an app bundle
+ QFileInfo binFile(m_executable);
+ if (!binFile.isExecutable()) {
+ QDir bundleDir(m_executable + ".app");
+ if (bundleDir.exists()) {
+ m_executable = bundleDir.absoluteFilePath("Contents/MacOS/" + binFile.baseName());
+ //qDebug() << Q_FUNC_INFO << "found bundled binary" << m_executable;
+ }
+ }
+#endif
+ m_mutex.lock();
+ m_port = 0;
+ m_process.setEnvironment(QProcess::systemEnvironment() + m_environment);
+ m_process.start(m_executable, arguments);
+ if (!m_process.waitForStarted()) {
+ qWarning() << "QML Debug Client: Could not launch app " << m_executable
+ << ": " << m_process.errorString();
+ m_eventLoop.quit();
+ }
+ m_mutex.unlock();
+}
+
+void QQmlDebugProcess::stop()
+{
+ if (m_process.state() != QProcess::NotRunning) {
+ disconnect(&m_process, &QProcess::errorOccurred, this, &QQmlDebugProcess::processError);
+ m_process.kill();
+ m_process.waitForFinished(5000);
+ }
+}
+
+void QQmlDebugProcess::setMaximumBindErrors(int ignore)
+{
+ m_maximumBindErrors = ignore;
+}
+
+void QQmlDebugProcess::timeout()
+{
+ qWarning() << "Timeout while waiting for QML debugging messages "
+ "in application output. Process is in state" << m_process.state()
+ << ", Output:" << m_output << ".";
+ m_eventLoop.quit();
+}
+
+bool QQmlDebugProcess::waitForSessionStart()
+{
+ if (m_process.state() != QProcess::Running) {
+ qWarning() << "Could not start up " << m_executable;
+ return false;
+ } else if (m_state == SessionStarted) {
+ return true;
+ } else if (m_state == SessionFailed) {
+ return false;
+ }
+
+ m_timer.start();
+ m_eventLoop.exec();
+
+ return m_state == SessionStarted;
+}
+
+int QQmlDebugProcess::debugPort() const
+{
+ return m_port;
+}
+
+bool QQmlDebugProcess::waitForFinished()
+{
+ return m_process.waitForFinished();
+}
+
+QProcess::ExitStatus QQmlDebugProcess::exitStatus() const
+{
+ return m_process.exitStatus();
+}
+
+void QQmlDebugProcess::addEnvironment(const QString &environment)
+{
+ m_environment.append(environment);
+}
+
+QString QQmlDebugProcess::output() const
+{
+ return m_output;
+}
+
+void QQmlDebugProcess::processAppOutput()
+{
+ m_mutex.lock();
+
+ bool outputFromAppItself = false;
+
+ QString newOutput = m_process.readAll();
+ m_output.append(newOutput);
+ m_outputBuffer.append(newOutput);
+
+ while (true) {
+ const int nlIndex = m_outputBuffer.indexOf(QLatin1Char('\n'));
+ if (nlIndex < 0) // no further complete lines
+ break;
+ const QString line = m_outputBuffer.left(nlIndex);
+ m_outputBuffer = m_outputBuffer.right(m_outputBuffer.size() - nlIndex - 1);
+
+ if (line.contains("QML Debugger:")) {
+ const QRegExp portRx("Waiting for connection on port (\\d+)");
+ if (portRx.indexIn(line) != -1) {
+ m_port = portRx.cap(1).toInt();
+ m_timer.stop();
+ m_state = SessionStarted;
+ m_eventLoop.quit();
+ continue;
+ }
+ if (line.contains("Unable to listen")) {
+ if (++m_receivedBindErrors >= m_maximumBindErrors) {
+ if (m_maximumBindErrors == 0)
+ qWarning() << "App was unable to bind to port!";
+ m_timer.stop();
+ m_state = SessionFailed;
+ m_eventLoop.quit();
+ }
+ continue;
+ }
+ }
+
+ // set to true if there is output not coming from the debugger or we don't understand it
+ outputFromAppItself = true;
+ }
+ m_mutex.unlock();
+
+ if (outputFromAppItself)
+ emit readyReadStandardOutput();
+}
+
+void QQmlDebugProcess::processError(QProcess::ProcessError error)
+{
+ qDebug() << "An error occurred while waiting for debug process to become available:";
+ switch (error) {
+ case QProcess::FailedToStart:
+ qDebug() << "Process failed to start.";
+ break;
+ case QProcess::Crashed:
+ qDebug() << "Process crashed.";
+ break;
+ case QProcess::Timedout:
+ qDebug() << "Process timed out.";
+ break;
+ case QProcess::WriteError:
+ qDebug() << "Error while writing to process.";
+ break;
+ case QProcess::ReadError:
+ qDebug() << "Error while reading from process.";
+ break;
+ case QProcess::UnknownError:
+ qDebug() << "Unknown process error.";
+ break;
+ }
+}
diff --git a/tests/auto/qml/debugger/shared/qqmldebugprocess_p.h b/tests/auto/qml/debugger/shared/qqmldebugprocess_p.h
new file mode 100644
index 0000000000..fd2c89bb41
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugprocess_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLDEBUGPROCESS_P_H
+#define QQMLDEBUGPROCESS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qprocess.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qeventloop.h>
+#include <QtCore/qmutex.h>
+
+class QQmlDebugProcess : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDebugProcess(const QString &executable, QObject *parent = 0);
+ ~QQmlDebugProcess();
+
+ QString state();
+
+ void addEnvironment(const QString &environment);
+
+ void start(const QStringList &arguments);
+ bool waitForSessionStart();
+ int debugPort() const;
+
+ bool waitForFinished();
+ QProcess::ExitStatus exitStatus() const;
+
+ QString output() const;
+ void stop();
+ void setMaximumBindErrors(int numErrors);
+
+signals:
+ void readyReadStandardOutput();
+
+private slots:
+ void timeout();
+ void processAppOutput();
+ void processError(QProcess::ProcessError error);
+
+private:
+ enum SessionState {
+ SessionUnknown,
+ SessionStarted,
+ SessionFailed
+ };
+
+ QString m_executable;
+ QProcess m_process;
+ QString m_outputBuffer;
+ QString m_output;
+ QTimer m_timer;
+ QEventLoop m_eventLoop;
+ QMutex m_mutex;
+ SessionState m_state;
+ QStringList m_environment;
+ int m_port;
+ int m_maximumBindErrors;
+ int m_receivedBindErrors;
+};
+
+#endif // QQMLDEBUGPROCESS_P_H
diff --git a/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp
index da7956a5fb..65ac1ef320 100644
--- a/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp
+++ b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp
@@ -26,6 +26,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include <qrandom.h>
#include <private/qqmlchangeset_p.h>
class tst_qqmlchangeset : public QObject
@@ -1462,23 +1463,19 @@ void tst_qqmlchangeset::debug()
void tst_qqmlchangeset::random_data()
{
- QTest::addColumn<int>("seed");
QTest::addColumn<int>("combinations");
QTest::addColumn<int>("depth");
- QTest::newRow("1*5") << 32 << 1 << 5;
- QTest::newRow("2*2") << 32 << 2 << 2;
- QTest::newRow("3*2") << 32 << 3 << 2;
- QTest::newRow("3*5") << 32 << 3 << 5;
+ QTest::newRow("1*5") << 1 << 5;
+ QTest::newRow("2*2") << 2 << 2;
+ QTest::newRow("3*2") << 3 << 2;
+ QTest::newRow("3*5") << 3 << 5;
}
void tst_qqmlchangeset::random()
{
- QFETCH(int, seed);
QFETCH(int, combinations);
QFETCH(int, depth);
- qsrand(seed);
-
int failures = 0;
for (int i = 0; i < 20000; ++i) {
QQmlChangeSet accumulatedSet;
@@ -1490,27 +1487,27 @@ void tst_qqmlchangeset::random()
for (int j = 0; j < combinations; ++j) {
QQmlChangeSet set;
for (int k = 0; k < depth; ++k) {
- switch (-(qrand() % 3)) {
+ switch (-QRandomGenerator::bounded(3)) {
case InsertOp: {
- int index = qrand() % (modelCount + 1);
- int count = qrand() % 5 + 1;
+ int index = QRandomGenerator::bounded(modelCount + 1);
+ int count = QRandomGenerator::bounded(5) + 1;
set.insert(index, count);
input.append(Insert(index, count));
modelCount += count;
break;
}
case RemoveOp: {
- const int index = qrand() % (modelCount + 1);
- const int count = qrand() % (modelCount - index + 1);
+ const int index = QRandomGenerator::bounded(modelCount + 1);
+ const int count = QRandomGenerator::bounded(modelCount - index + 1);
set.remove(index, count);
input.append(Remove(index, count));
modelCount -= count;
break;
}
case MoveOp: {
- const int from = qrand() % (modelCount + 1);
- const int count = qrand() % (modelCount - from + 1);
- const int to = qrand() % (modelCount - count + 1);
+ const int from = QRandomGenerator::bounded(modelCount + 1);
+ const int count = QRandomGenerator::bounded(modelCount - from + 1);
+ const int to = QRandomGenerator::bounded(modelCount - count + 1);
const int moveId = moveCount++;
set.move(from, to, count, moveId);
input.append(Move(from, to, count, moveId));
diff --git a/tests/auto/quick/qquicklistview/randomsortmodel.cpp b/tests/auto/quick/qquicklistview/randomsortmodel.cpp
index 7affb182c0..7c4bd5111c 100644
--- a/tests/auto/quick/qquicklistview/randomsortmodel.cpp
+++ b/tests/auto/quick/qquicklistview/randomsortmodel.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "randomsortmodel.h"
+#include <QRandomGenerator>
RandomSortModel::RandomSortModel(QObject* parent):
QAbstractListModel(parent)
@@ -73,14 +74,14 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const
void RandomSortModel::randomize()
{
- const int row = qrand() % mData.count();
+ const int row = QRandomGenerator::bounded(mData.count());
int random;
bool exists = false;
// Make sure we won't end up with two items with the same weight, as that
// would make unit-testing much harder
do {
exists = false;
- random = qrand() % (mData.count() * 10);
+ random = QRandomGenerator::bounded(mData.count() * 10);
QList<QPair<QString, int> >::ConstIterator iter, end;
for (iter = mData.constBegin(), end = mData.constEnd(); iter != end; ++iter) {
if ((*iter).second == random) {
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index adcdca4c3c..5ae82423f9 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -2668,7 +2668,6 @@ void tst_qquickwindow::pointerEventTypeAndPointCount()
QQuickPointerMouseEvent pme;
pme.reset(&me);
- QVERIFY(pme.isValid());
QCOMPARE(pme.asMouseEvent(localPosition), &me);
QVERIFY(pme.asPointerMouseEvent());
QVERIFY(!pme.asPointerTouchEvent());
@@ -2681,7 +2680,6 @@ void tst_qquickwindow::pointerEventTypeAndPointCount()
QQuickPointerTouchEvent pte;
pte.reset(&te);
- QVERIFY(pte.isValid());
QCOMPARE(pte.asTouchEvent(), &te);
QVERIFY(!pte.asPointerMouseEvent());
QVERIFY(pte.asPointerTouchEvent());
diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp
index cb2b8be97a..a33c5eae96 100644
--- a/tests/auto/quick/shared/viewtestutil.cpp
+++ b/tests/auto/quick/shared/viewtestutil.cpp
@@ -28,6 +28,7 @@
#include "viewtestutil.h"
+#include <QtCore/QRandomGenerator>
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickView>
#include <QtGui/QScreen>
@@ -356,7 +357,6 @@ QQuickViewTestUtil::StressTestModel::StressTestModel()
t->setInterval(500);
t->start();
- qsrand(qHash(QDateTime::currentDateTime()));
connect(t, &QTimer::timeout, this, &StressTestModel::updateModel);
}
@@ -374,7 +374,7 @@ void QQuickViewTestUtil::StressTestModel::updateModel()
{
if (m_rowCount > 10) {
for (int i = 0; i < 10; ++i) {
- int rnum = qrand() % m_rowCount;
+ int rnum = QRandomGenerator::bounded(m_rowCount);
beginRemoveRows(QModelIndex(), rnum, rnum);
m_rowCount--;
endRemoveRows();
@@ -382,7 +382,7 @@ void QQuickViewTestUtil::StressTestModel::updateModel()
}
if (m_rowCount < 20) {
for (int i = 0; i < 10; ++i) {
- int rnum = qrand() % m_rowCount;
+ int rnum = QRandomGenerator::bounded(m_rowCount);
beginInsertRows(QModelIndex(), rnum, rnum);
m_rowCount++;
endInsertRows();
diff --git a/tests/benchmarks/qml/holistic/testtypes.h b/tests/benchmarks/qml/holistic/testtypes.h
index a752a8585b..29ebe97f39 100644
--- a/tests/benchmarks/qml/holistic/testtypes.h
+++ b/tests/benchmarks/qml/holistic/testtypes.h
@@ -34,6 +34,7 @@
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
#include <QtQml/qqmllist.h>
+#include <QtCore/qrandom.h>
#include <QtCore/qrect.h>
#include <QtGui/qmatrix.h>
#include <QtGui/qcolor.h>
@@ -223,7 +224,7 @@ public:
{
QPixmap pv(150, 150);
pv.fill(Qt::green);
- int choice = qrand() % 4;
+ int choice = QRandomGenerator::bounded(4);
switch (choice) {
case 0: setArbitraryVariant(QVariant(QString(QLatin1String("string variant value")))); break;
case 1: setArbitraryVariant(QVariant(QColor(110, 120, 130))); break;
@@ -253,7 +254,7 @@ public:
QVariant retn;
QPixmap pv(randomFactorOne % 300, randomFactorTwo % 300);
pv.fill(QColor(randomFactorOne % 256, randomFactorTwo % 256, randomFactorThree % 256));
- int choice = qrand() % 4;
+ int choice = QRandomGenerator::bounded(4);
switch (choice) {
case 0: retn = QVariant(QString(QLatin1String("string variant value"))); break;
case 1: retn = QVariant(QColor(randomFactorThree % 256, randomFactorTwo % 256, randomFactorOne % 256)); break;
diff --git a/tests/benchmarks/qml/painting/paintbenchmark.cpp b/tests/benchmarks/qml/painting/paintbenchmark.cpp
index 0a9dee4664..98d8d7c16a 100644
--- a/tests/benchmarks/qml/painting/paintbenchmark.cpp
+++ b/tests/benchmarks/qml/painting/paintbenchmark.cpp
@@ -36,6 +36,7 @@
#include <QVBoxLayout>
#include <QTime>
#include <QDebug>
+#include <QRandomGenerator>
#include <QStaticText>
int iterations = 20;
@@ -321,7 +322,7 @@ public:
int len = strlen(chars);
for (int i = 0; i < lines; ++i) {
for (int j = 0; j < 60; j++) {
- strings[i] += QChar(chars[rand() % len]);
+ strings[i] += QChar(chars[QRandomGenerator::bounded(len)]);
}
}
}
diff --git a/tests/manual/pointer/main.cpp b/tests/manual/pointer/main.cpp
index 7935b4072c..5f6af79973 100644
--- a/tests/manual/pointer/main.cpp
+++ b/tests/manual/pointer/main.cpp
@@ -44,6 +44,7 @@
int main(int argc, char *argv[])
{
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_advance_bidi_ltr.qml b/tests/manual/scenegraph_lancelot/data/text/text_advance_bidi_ltr.qml
index 2f40aece89..e5d230e309 100644
--- a/tests/manual/scenegraph_lancelot/data/text/text_advance_bidi_ltr.qml
+++ b/tests/manual/scenegraph_lancelot/data/text/text_advance_bidi_ltr.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.10
Item {
width: 320
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_advance_hebrew.qml b/tests/manual/scenegraph_lancelot/data/text/text_advance_hebrew.qml
index 0a9dce4d82..000977f964 100644
--- a/tests/manual/scenegraph_lancelot/data/text/text_advance_hebrew.qml
+++ b/tests/manual/scenegraph_lancelot/data/text/text_advance_hebrew.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.10
Item {
width: 320
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_advance_latin.qml b/tests/manual/scenegraph_lancelot/data/text/text_advance_latin.qml
index ccab5d8c64..f5fc501bb8 100644
--- a/tests/manual/scenegraph_lancelot/data/text/text_advance_latin.qml
+++ b/tests/manual/scenegraph_lancelot/data/text/text_advance_latin.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.10
Item {
width: 320
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_advance_multiline.qml b/tests/manual/scenegraph_lancelot/data/text/text_advance_multiline.qml
index ae0f10718c..a58a7cb40c 100644
--- a/tests/manual/scenegraph_lancelot/data/text/text_advance_multiline.qml
+++ b/tests/manual/scenegraph_lancelot/data/text/text_advance_multiline.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.10
Item {
width: 320
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph.qml b/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph.qml
index 76f0910680..0627656ea6 100644
--- a/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph.qml
+++ b/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.10
Item {
width: 320
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph_multifontsizes.qml b/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph_multifontsizes.qml
index de33d65cdc..fb1f252148 100644
--- a/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph_multifontsizes.qml
+++ b/tests/manual/scenegraph_lancelot/data/text/text_advance_multiparagraph_multifontsizes.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.10
Item {
width: 320
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bengali_noshaping.qml b/tests/manual/scenegraph_lancelot/data/text/text_bengali_noshaping.qml
new file mode 100644
index 0000000000..343d5768e4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bengali_noshaping.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial" // Should use Lohit Bengali
+ font.pixelSize: 20
+ font.preferShaping: false
+ text: "ধারা ১: সমস্ত মানুষ স্বাধীনভাবে সমান মর্যাদা এবং অধিকার নিয়ে জন্মগ্রহণ করে। তাঁদের বিবেক এবং বুদ্ধি আছে; সুতরাং সকলেরই একে অপরের প্রতি ভ্রাতৃত্বসুলভ মনোভাব নিয়ে আচরণ করা উচিৎ।"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_latin_noshaping.qml b/tests/manual/scenegraph_lancelot/data/text/text_latin_noshaping.qml
new file mode 100644
index 0000000000..6dc6c2f3d6
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_latin_noshaping.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ font.preferShaping: false
+ text: "Are griffins birds or mammals?"
+ }
+}
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index 26a83395c8..9ab058d37b 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -404,7 +404,7 @@ QVariantList findQmlImportsInDirectory(const QString &qmlDir)
if (qmlDir.isEmpty())
return ret;
- QDirIterator iterator(qmlDir, QDir::AllDirs | QDir::NoDotDot, QDirIterator::Subdirectories);
+ QDirIterator iterator(qmlDir, QDir::AllDirs | QDir::NoDot | QDir::NoDotDot, QDirIterator::Subdirectories);
QStringList blacklist;
while (iterator.hasNext()) {
@@ -425,7 +425,7 @@ QVariantList findQmlImportsInDirectory(const QString &qmlDir)
if (path.contains(QLatin1String("Debug-iphoneos")) || path.contains(QLatin1String("Release-iphoneos")) ||
path.contains(QLatin1String("Debug-iphonesimulator")) || path.contains(QLatin1String("Release-iphonesimulator"))
#ifdef Q_OS_WIN
- || path.contains(QLatin1String("/release/")) || path.contains(QLatin1String("/debug/"))
+ || path.endsWith(QLatin1String("/release")) || path.endsWith(QLatin1String("/debug"))
#endif
){
continue;
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 2b919909ac..79f9b2c49b 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -999,7 +999,7 @@ int main(int argc, char *argv[])
// Check which kind of application should be instantiated.
bool useQApplication = false;
for (int i = 0; i < argc; ++i) {
- QString arg = QLatin1String(argv[1]);
+ QString arg = QLatin1String(argv[i]);
if (arg == QLatin1String("--qapp") || arg == QLatin1String("-qapp"))
useQApplication = true;
}
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index f411c6becc..fc8b9c5292 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -159,6 +159,7 @@ struct Options
, coreProfile(false)
, verbose(false)
, applicationType(DefaultQmlApplicationType)
+ , textRenderType(QQuickWindow::textRenderType())
{
// QtWebEngine needs a shared context in order for the GPU thread to
// upload textures.
@@ -182,6 +183,7 @@ struct Options
QVector<Qt::ApplicationAttribute> applicationAttributes;
QString translationFile;
QmlApplicationType applicationType;
+ QQuickWindow::TextRenderType textRenderType;
};
#if defined(QMLSCENE_BUNDLE)
@@ -377,6 +379,7 @@ static void usage()
#ifdef QT_WIDGETS_LIB
puts(" --apptype [gui|widgets] ...........Select which application class to use. Default is widgets.");
#endif
+ puts(" --textrendertype [qt|native].......Select the default render type for text-like elements.");
puts(" -I <path> ........................ Add <path> to the list of import paths");
puts(" -P <path> ........................ Add <path> to the list of plugin paths");
puts(" -translation <translationfile> ... Set the language to run in");
@@ -456,6 +459,19 @@ static QUrl parseUrlArgument(const QString &arg)
return url;
}
+static QQuickWindow::TextRenderType parseTextRenderType(const QString &renderType)
+{
+ if (renderType == QLatin1String("qt"))
+ return QQuickWindow::QtTextRendering;
+ else if (renderType == QLatin1String("native"))
+ return QQuickWindow::NativeTextRendering;
+
+ usage();
+
+ Q_UNREACHABLE();
+ return QQuickWindow::QtTextRendering;
+}
+
int main(int argc, char ** argv)
{
Options options;
@@ -536,6 +552,8 @@ int main(int argc, char ** argv)
pluginPaths.append(arguments.at(++i));
else if (lowerArgument == QLatin1String("--apptype"))
++i; // Consume previously parsed argument
+ else if (lowerArgument == QLatin1String("--textrendertype") && i + 1 < size)
+ options.textRenderType = parseTextRenderType(arguments.at(++i));
else if (lowerArgument == QLatin1String("--help")
|| lowerArgument == QLatin1String("-help")
|| lowerArgument == QLatin1String("--h")
@@ -564,6 +582,8 @@ int main(int argc, char ** argv)
}
#endif
+ QQuickWindow::setTextRenderType(options.textRenderType);
+
QUnifiedTimer::instance()->setSlowModeEnabled(options.slowAnimations);
if (options.url.isEmpty())