aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-03-03 17:22:51 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2015-03-03 18:31:04 +0000
commite7c18e2a2b39f35667e76aaafa7135bde161a806 (patch)
tree0a7480d6f84feef46763d6cec45211eb31b59323 /src
parentcd3b88c5949de902b5ee83711264dcab398df8eb (diff)
parent6dbf435ca46e87893dc46b3f7f09a95f29998e3e (diff)
Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/dev
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/masm.pri16
-rw-r--r--src/3rdparty/masm/wtf/PageBlock.cpp2
-rw-r--r--src/imports/statemachine/state.cpp8
-rw-r--r--src/imports/testlib/TestCase.qml54
-rw-r--r--src/particles/qquickcustomparticle.cpp7
-rw-r--r--src/qml/compiler/qv4codegen.cpp4
-rw-r--r--src/qml/compiler/qv4isel_p.cpp2
-rw-r--r--src/qml/compiler/qv4ssa.cpp8
-rw-r--r--src/qml/debugger/qqmldebugserver.cpp8
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h2
-rw-r--r--src/qml/doc/qtqml.qdocconf2
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc14
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/signals.qdoc4
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc5
-rw-r--r--src/qml/doc/src/whatsnew.qdoc1
-rw-r--r--src/qml/jit/qv4regalloc.cpp45
-rw-r--r--src/qml/jsapi/qjsengine.cpp4
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp8
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4persistent.cpp2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp2
-rw-r--r--src/qml/qml/qqmlengine.cpp11
-rw-r--r--src/qml/qml/qqmlfileselector.cpp6
-rw-r--r--src/qml/qml/qqmlmetatype.cpp6
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp4
-rw-r--r--src/qml/qml/qqmltypeloader.cpp19
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp13
-rw-r--r--src/qml/types/qqmlmodelindexvaluetype.cpp2
-rw-r--r--src/qml/types/qqmltimer.cpp8
-rw-r--r--src/qml/types/qquickpackage.cpp2
-rw-r--r--src/qml/util/qqmladaptormodel.cpp2
-rw-r--r--src/qmltest/quicktest.cpp4
-rw-r--r--src/qmltest/quicktestevent.cpp27
-rw-r--r--src/qmltest/quicktestevent_p.h2
-rw-r--r--src/quick/designer/designersupport.cpp4
-rw-r--r--src/quick/doc/images/qml-item-canvas-arc.png (renamed from src/quick/doc/images/qml-item-canvas.arc.png)bin6532 -> 6532 bytes
-rw-r--r--src/quick/doc/qtquick.qdocconf2
-rw-r--r--src/quick/doc/src/concepts/effects/sprites.qdoc14
-rw-r--r--src/quick/doc/src/concepts/input/focus.qdoc2
-rw-r--r--src/quick/doc/src/dynamicview-tutorial.qdoc20
-rw-r--r--src/quick/doc/src/whatsnew.qdoc6
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp7
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp4
-rw-r--r--src/quick/items/qquickdrag.cpp4
-rw-r--r--src/quick/items/qquickimagebase.cpp5
-rw-r--r--src/quick/items/qquickitem.cpp18
-rw-r--r--src/quick/items/qquickitemanimation.cpp6
-rw-r--r--src/quick/items/qquickitemview.cpp8
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp4
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquickpincharea.cpp46
-rw-r--r--src/quick/items/qquickpincharea_p.h1
-rw-r--r--src/quick/items/qquickscreen.cpp11
-rw-r--r--src/quick/items/qquickscreen_p.h1
-rw-r--r--src/quick/items/qquicktext.cpp8
-rw-r--r--src/quick/items/qquicktextinput.cpp1
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp92
-rw-r--r--src/quick/items/qquickwindow_p.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp1
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp16
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h1
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp14
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h11
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp10
-rw-r--r--src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp10
-rw-r--r--src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp2
-rw-r--r--src/quick/scenegraph/util/qsgsimplerectnode.cpp1
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp13
-rw-r--r--src/quick/scenegraph/util/qsgtextureprovider.cpp1
-rw-r--r--src/quick/util/qquickfontmetrics.cpp2
-rw-r--r--src/quick/util/qquickimageprovider.cpp3
-rw-r--r--src/quick/util/qquicksmoothedanimation.cpp6
-rw-r--r--src/quick/util/qquickspringanimation.cpp14
-rw-r--r--src/quick/util/qquicktextmetrics.cpp4
-rw-r--r--src/quick/util/qquicktimeline.cpp8
79 files changed, 446 insertions, 253 deletions
diff --git a/src/3rdparty/masm/masm.pri b/src/3rdparty/masm/masm.pri
index 3fd4aa6cec..3655af36b6 100644
--- a/src/3rdparty/masm/masm.pri
+++ b/src/3rdparty/masm/masm.pri
@@ -71,18 +71,16 @@ retgen.commands = python $$retgen.script > ${QMAKE_FILE_OUT}
QMAKE_EXTRA_COMPILERS += retgen
# Taken from WebKit/Tools/qmake/mkspecs/features/unix/default_post.prf
-linux-g++* {
- greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 5) {
- !contains(QMAKE_CXXFLAGS, -std=(c|gnu)\\+\\+(0x|11)) {
+!c++11:!intel_icc {
+ # Don't warn about OVERRIDE and FINAL, since they are feature-checked anyways
+ clang {
+ QMAKE_CXXFLAGS += -Wno-c++11-extensions -Wno-c++0x-extensions
+ QMAKE_OBJECTIVE_CFLAGS += -Wno-c++11-extensions -Wno-c++0x-extensions
+ } else: gcc {
+ greaterThan(QT_GCC_MAJOR_VERSION, 4)|greaterThan(QT_GCC_MINOR_VERSION, 5) {
# We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr).
QMAKE_CXXFLAGS_WARN_ON += -Wno-c++0x-compat
QMAKE_CXXFLAGS += -Wno-c++0x-compat
}
}
}
-
-# Don't warn about OVERRIDE and FINAL, since they are feature-checked anyways
-*clang:!contains(QMAKE_CXXFLAGS, -std=c++11) {
- QMAKE_CXXFLAGS += -Wno-c++11-extensions
- QMAKE_OBJECTIVE_CFLAGS += -Wno-c++11-extensions
-}
diff --git a/src/3rdparty/masm/wtf/PageBlock.cpp b/src/3rdparty/masm/wtf/PageBlock.cpp
index a6f5585925..e715ed262a 100644
--- a/src/3rdparty/masm/wtf/PageBlock.cpp
+++ b/src/3rdparty/masm/wtf/PageBlock.cpp
@@ -44,7 +44,7 @@ static size_t s_pageMask;
inline size_t systemPageSize()
{
- return getpagesize();
+ return ::sysconf(_SC_PAGESIZE);
}
#elif OS(WINDOWS)
diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp
index 78bd748f61..c4ca1502ac 100644
--- a/src/imports/statemachine/state.cpp
+++ b/src/imports/statemachine/state.cpp
@@ -221,15 +221,15 @@ QQmlListProperty<QObject> State::children()
\brief The type of history that this history state records.
- The default value of this property is QHistoryState.ShallowHistory.
+ The default value of this property is HistoryState.ShallowHistory.
- This enum specifies the type of history that a QHistoryState records.
+ This enum specifies the type of history that a HistoryState records.
\list
- \li QHistoryState.ShallowHistory Only the immediate child states of the
+ \li HistoryState.ShallowHistory Only the immediate child states of the
parent state are recorded. In this case, a transition with the history
state as its target will end up in the immediate child state that the
parent was in the last time it was exited. This is the default.
- \li QHistoryState.DeepHistory Nested states are recorded. In this case
+ \li HistoryState.DeepHistory Nested states are recorded. In this case
a transition with the history state as its target will end up in the
most deeply nested descendant state the parent was in the last time
it was exited.
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index caa50fb6d7..9f527b66f1 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -191,7 +191,7 @@ import Qt.test.qtestroot 1.0
}
\endcode
- The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(),
+ The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence()
and mouseMove() methods can be used to simulate mouse events in a
similar fashion.
@@ -947,7 +947,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mousePress(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -978,7 +978,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseRelease(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -1011,7 +1011,7 @@ Item {
Note: this method does not imply a drop action, to make a drop, an additional
mouseRelease(item, x + dx, y + dy) is needed.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseRelease(), mouseWheel()
+ \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel()
*/
function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) {
if (item.x === undefined || item.y === undefined)
@@ -1058,7 +1058,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseClick(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -1089,7 +1089,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mouseDoubleClickSequence(), mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseDoubleClick(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -1107,6 +1107,44 @@ Item {
}
/*!
+ \qmlmethod TestCase::mouseDoubleClickSequence(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
+
+ Simulates the full sequence of events generated by double-clicking a mouse
+ \a button with an optional \a modifier on an \a item.
+
+ This method reproduces the sequence of mouse events generated when a user makes
+ a double click: Press-Release-Press-DoubleClick-Release.
+
+ The position of the click is defined by \a x and \a y.
+ If \a x and \a y are not defined the position will be the center of \a item.
+ If \a delay is specified, the test will wait for the specified amount of
+ milliseconds before pressing and before releasing the button.
+
+ The position given by \a x and \a y is transformed from the co-ordinate
+ system of \a item into window co-ordinates and then delivered.
+ If \a item is obscured by another item, or a child of \a item occupies
+ that position, then the event will be delivered to the other item instead.
+
+ This QML method was introduced in Qt 5.5.
+
+ \sa mouseDoubleClick(), mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
+ */
+ function mouseDoubleClickSequence(item, x, y, button, modifiers, delay) {
+ if (button === undefined)
+ button = Qt.LeftButton
+ if (modifiers === undefined)
+ modifiers = Qt.NoModifier
+ if (delay == undefined)
+ delay = -1
+ if (x === undefined)
+ x = item.width / 2
+ if (y === undefined)
+ y = item.height / 2
+ if (!qtest_events.mouseDoubleClickSequence(item, x, y, button, modifiers, delay))
+ qtest_fail("window not shown", 2)
+ }
+
+ /*!
\qmlmethod TestCase::mouseMove(item, x, y, delay = -1)
Moves the mouse pointer to the position given by \a x and \a y within
@@ -1118,7 +1156,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseDrag(), mouseWheel()
*/
function mouseMove(item, x, y, delay, buttons) {
if (delay == undefined)
@@ -1143,7 +1181,7 @@ Item {
The \a xDelta and \a yDelta contain the wheel rotation distance in eighths of a degree. see \l QWheelEvent::angleDelta() for more details.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta()
+ \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta()
*/
function mouseWheel(item, x, y, xDelta, yDelta, buttons, modifiers, delay) {
if (delay == undefined)
diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp
index 9c82599c20..32cde7c126 100644
--- a/src/particles/qquickcustomparticle.cpp
+++ b/src/particles/qquickcustomparticle.cpp
@@ -303,6 +303,8 @@ QQuickShaderEffectNode *QQuickCustomParticle::prepareNextFrame(QQuickShaderEffec
QQuickShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
{
+ typedef QHash<int, QQuickShaderEffectNode*>::const_iterator NodeHashConstIt;
+
if (!QOpenGLContext::currentContext())
return 0;
@@ -368,10 +370,11 @@ QQuickShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
}
}
- QHash<int, QQuickShaderEffectNode*>::const_iterator it = m_nodes.begin();
+ NodeHashConstIt it = m_nodes.begin();
rootNode = it.value();
rootNode->setFlag(QSGNode::OwnsMaterial, true);
- for (++it; it != m_nodes.end(); ++it)
+ const NodeHashConstIt cend = m_nodes.end();
+ for (++it; it != cend; ++it)
rootNode->appendChildNode(it.value());
return rootNode;
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index c89a49c1ca..27aecdd3ed 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1965,7 +1965,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
// variables in global code are properties of the global context object, not locals as with other functions.
if (_env->compilationMode == FunctionCode || _env->compilationMode == QmlBinding) {
unsigned t = 0;
- for (Environment::MemberMap::iterator it = _env->members.begin(); it != _env->members.end(); ++it) {
+ for (Environment::MemberMap::iterator it = _env->members.begin(), end = _env->members.end(); it != end; ++it) {
const QString &local = it.key();
function->LOCAL(local);
(*it).index = t;
@@ -1984,7 +1984,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
}
IR::ExprList *args = 0;
- for (Environment::MemberMap::const_iterator it = _env->members.constBegin(); it != _env->members.constEnd(); ++it) {
+ for (Environment::MemberMap::const_iterator it = _env->members.constBegin(), cend = _env->members.constEnd(); it != cend; ++it) {
const QString &local = it.key();
IR::ExprList *next = function->New<IR::ExprList>();
next->expr = entryBlock->NAME(local, 0, 0);
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 6369c8e801..54b184b4eb 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -179,7 +179,7 @@ void IRDecoder::visitMove(IR::Move *s)
} else if (Subscript *ss = c->base->asSubscript()) {
callSubscript(ss->base, ss->index, c->args, s->target);
return;
- } else if (c->base->asTemp() || c->base->asArgLocal()) {
+ } else if (c->base->asTemp() || c->base->asArgLocal() || c->base->asConst()) {
callValue(c->base, c->args, s->target);
return;
}
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 52db540871..a0ed77ffc1 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -3844,6 +3844,7 @@ void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops =
}
qout << "}\n";
+ buf.close();
qDebug("%s", buf.data().constData());
}
@@ -4301,6 +4302,7 @@ public:
}
qout << endl;
}
+ buf.close();
qDebug("%s", buf.data().constData());
}
@@ -4315,7 +4317,7 @@ private:
foreach (Stmt *s, successor->statements()) {
if (Phi *phi = s->asPhi()) {
- if (Temp *t = phi->d->incoming[bbIndex]->asTemp())
+ if (Temp *t = phi->d->incoming.at(bbIndex)->asTemp())
live.insert(*t);
} else {
break;
@@ -4886,6 +4888,8 @@ void LifeTimeInterval::addRange(int from, int to) {
LifeTimeInterval LifeTimeInterval::split(int atPosition, int newStart)
{
Q_ASSERT(atPosition < newStart || newStart == InvalidPosition);
+ Q_ASSERT(atPosition <= _end);
+ Q_ASSERT(newStart <= _end || newStart == InvalidPosition);
if (_ranges.isEmpty() || atPosition < _ranges.first().start)
return LifeTimeInterval();
@@ -5204,6 +5208,7 @@ void Optimizer::convertOutOfSSA() {
os << (void *) function;
os << " on basic-block L" << bb->index() << ":" << endl;
moves.dump();
+ buf.close();
qDebug("%s", buf.data().constData());
}
@@ -5317,6 +5322,7 @@ void MoveMapping::add(Expr *from, Temp *to) {
printer.print(to);
os << " <- ";
printer.print(from);
+ buf.close();
qDebug("%s", buf.data().constData());
}
return;
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp
index c9e30e06b6..b0302181ee 100644
--- a/src/qml/debugger/qqmldebugserver.cpp
+++ b/src/qml/debugger/qqmldebugserver.cpp
@@ -471,6 +471,8 @@ QQmlDebugServer::QQmlDebugServer()
void QQmlDebugServer::receiveMessage(const QByteArray &message)
{
+ typedef QHash<QString, QQmlDebugService*>::const_iterator DebugServiceConstIt;
+
// to be executed in debugger thread
Q_ASSERT(QThread::currentThread() == thread());
@@ -516,8 +518,7 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
QMutexLocker helloLock(&d->helloMutex);
d->gotHello = true;
- QHash<QString, QQmlDebugService*>::ConstIterator iter = d->plugins.constBegin();
- for (; iter != d->plugins.constEnd(); ++iter) {
+ for (DebugServiceConstIt iter = d->plugins.constBegin(), cend = d->plugins.constEnd(); iter != cend; ++iter) {
QQmlDebugService::State newState = QQmlDebugService::Unavailable;
if (d->clientPlugins.contains(iter.key()))
newState = QQmlDebugService::Enabled;
@@ -534,8 +535,7 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
QStringList oldClientPlugins = d->clientPlugins;
in >> d->clientPlugins;
- QHash<QString, QQmlDebugService*>::ConstIterator iter = d->plugins.constBegin();
- for (; iter != d->plugins.constEnd(); ++iter) {
+ for (DebugServiceConstIt iter = d->plugins.constBegin(), cend = d->plugins.constEnd(); iter != cend; ++iter) {
const QString pluginName = iter.key();
QQmlDebugService::State newState = QQmlDebugService::Unavailable;
if (d->clientPlugins.contains(pluginName))
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index 470381a49d..978d8413a7 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -58,6 +58,8 @@
#include <QtCore/qstringbuilder.h>
#include <QtCore/qwaitcondition.h>
+#include <limits>
+
QT_BEGIN_NAMESPACE
class QUrl;
diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf
index 7806a1103f..5729a60ea3 100644
--- a/src/qml/doc/qtqml.qdocconf
+++ b/src/qml/doc/qtqml.qdocconf
@@ -33,7 +33,7 @@ qhp.QtQml.subprojects.qmltypes.sortPages = true
tagfile = ../../../doc/qtqml/qtqml.tags
-depends += qtcore qtxmlpatterns qtgui qtquick qtdoc qtlinguist
+depends += qtcore qtxmlpatterns qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets
headerdirs += .. \
../../imports/models
diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
index ed08d293f2..a8177d29d8 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
@@ -893,11 +893,11 @@ property in question is \c isCurrentItem, hence the attached property is
referred to as \c ListView.isCurrentItem.
An attached signal handler is referred to in the same way. For example, the
-\c Component.isCompleted attached signal handler is commonly used to execute
-some JavaScript code when a component's creation process has been completed.
-In the example below, once the \l ListModel has been fully created, its
-\c Component.onCompleted signal handler will automatically be invoked to
-populate the model:
+\l{Component::completed}{Component.onCompleted} attached signal handler is
+commonly used to execute some JavaScript code when a component's creation
+process has been completed. In the example below, once the \l ListModel has
+been fully created, its \c Component.onCompleted signal handler will
+automatically be invoked to populate the model:
\qml
import QtQuick 2.0
@@ -916,8 +916,8 @@ ListView {
\endqml
Since the name of the \e {attaching type} is \c Component and that type has a
-\c completed signal, the attached signal handler is referred to as
-\c Component.isCompleted.
+\l{Component::completed}{completed} signal, the attached signal handler is
+referred to as \c Component.onCompleted.
\section3 A Note About Accessing Attached Properties and Signal Handlers
diff --git a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
index 266cb11726..e7d75a89bc 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
@@ -144,7 +144,9 @@ Rectangle {
An \l {Attached Properties and Attached Signal Handlers}{attached signal handler} is a signal handler that receives a signal from an \e {attaching type} rather than the object within which the handler is declared.
-For example, \c \l {Component::isCompleted}{Component.isCompleted} is an attached signal handler. This handler is often used to execute some JavaScript code when its creation process has been completed, as in the example below:
+For example, \l{Component::completed}{Component.onCompleted} is an attached
+signal handler. This handler is often used to execute some JavaScript code when
+its creation process has been completed, as in the example below:
\qml
import QtQuick 2.0
diff --git a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
index 4f2e5b2496..780086cfc7 100644
--- a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
@@ -499,9 +499,6 @@ property is only invoked when the property is reassigned to a different object v
may also explicitly preserve the scarce resource by calling the
"preserve" method on the \c var property from within JavaScript.
- For more information regarding the usage of a scarce resource, please
- see \l{Scarce Resources in JavaScript}.
-
This basic type is provided by the QML language.
*/
@@ -543,8 +540,6 @@ property is only invoked when the property is reassigned to a different object v
"destroy" method on the \c variant property from within JavaScript. They
may also explicitly preserve the scarce resource by calling the
"preserve" method on the \c variant property from within JavaScript.
- For more information on the usage of a scarce resource, please
- see \l{Scarce Resources in JavaScript}.
\section1 Storing Arrays and Objects
diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc
index 42e690c48b..6abfe8c579 100644
--- a/src/qml/doc/src/whatsnew.qdoc
+++ b/src/qml/doc/src/whatsnew.qdoc
@@ -95,7 +95,6 @@ has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the
\li New \l var property type. This is a general-purpose property type which obsoletes the \l variant type.
Properties of the \l var type may hold JavaScript references.
\li QML properties of type \l var and \l variant can now hold pixmaps.
- See \l {Scarce Resources in JavaScript} for more information.
\li Value type improvements:
\list
\li QML now supports defining properties of value type basic types within QML documents. Supported types include
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index 9b2754a344..ae06a99d2a 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -34,6 +34,7 @@
#include <QtCore/QBuffer>
#include <QtCore/QDebug>
#include "qv4regalloc_p.h"
+#include "qv4alloca_p.h"
#include <private/qv4value_inl_p.h>
#include <algorithm>
@@ -184,21 +185,7 @@ public:
const std::vector<Use> &uses(const Temp &t) const
{
- return _uses[t.index];
- }
-
- bool useMustHaveReg(const Temp &t, int position) {
- foreach (const Use &use, uses(t))
- if (use.pos == position)
- return use.mustHaveRegister();
- return false;
- }
-
- bool isUsedAt(const Temp &t, int position) {
- foreach (const Use &use, uses(t))
- if (use.pos == position)
- return true;
- return false;
+ return _uses.at(t.index);
}
bool canHaveRegister(const Temp &t) const {
@@ -698,9 +685,13 @@ protected: // IRDecoder
virtual void visitPhi(IR::Phi *s)
{
addDef(s->targetTemp, true);
- foreach (Expr *e, s->d->incoming) {
+ for (int i = 0, ei = s->d->incoming.size(); i < ei; ++i) {
+ Expr *e = s->d->incoming.at(i);
if (Temp *t = e->asTemp()) {
- addUses(t, Use::CouldHaveRegister);
+ // The actual use of an incoming value in a phi node is right before the terminator
+ // of the other side of the incoming edge.
+ const int usePos = _lifeTimeIntervals->positionForStatement(_currentBB->in.at(i)->terminator()) - 1;
+ addUses(t, Use::CouldHaveRegister, usePos);
addHint(s->targetTemp, t);
addHint(t, s->targetTemp);
}
@@ -746,6 +737,11 @@ private:
void addUses(Expr *e, Use::RegisterFlag flag)
{
const int usePos = usePosition(_currentStmt);
+ addUses(e, flag, usePos);
+ }
+
+ void addUses(Expr *e, Use::RegisterFlag flag, int usePos)
+ {
Q_ASSERT(usePos > 0);
if (!e)
return;
@@ -1608,7 +1604,7 @@ void RegisterAllocator::tryAllocateFreeReg(LifeTimeInterval &current)
if (freeUntilPos_reg == 0) {
// no register available without spilling
if (DebugRegAlloc)
- qDebug() << "*** no register available for %" << current.temp().index;
+ qDebug("*** no register available for %u", current.temp().index);
return;
} else if (current.end() < freeUntilPos_reg) {
// register available for the whole interval
@@ -1719,7 +1715,7 @@ void RegisterAllocator::allocateBlockedReg(LifeTimeInterval &current)
Q_ASSERT(nextUse);
Q_ASSERT(!nextUse->isFixedInterval());
- split(*nextUse, position);
+ split(*nextUse, position, /*skipOptionalRegisterUses =*/ true);
// We might have chosen a register that is used by a range that has a hole in its life time.
// If that's the case, check if the current interval completely fits in the hole. Or rephrased:
@@ -1769,6 +1765,9 @@ int RegisterAllocator::nextIntersection(const LifeTimeInterval &current,
}
/// Find the first use after the start position for the given temp.
+///
+/// This is only called when all registers are in use, and when one of them has to be spilled to the
+/// stack. So, uses where a register is optional can be ignored.
int RegisterAllocator::nextUse(const Temp &t, int startPosition) const
{
typedef std::vector<Use>::const_iterator ConstIt;
@@ -1776,9 +1775,11 @@ int RegisterAllocator::nextUse(const Temp &t, int startPosition) const
const std::vector<Use> &usePositions = _info->uses(t);
const ConstIt cend = usePositions.end();
for (ConstIt it = usePositions.begin(); it != cend; ++it) {
- const int usePos = it->pos;
- if (usePos >= startPosition)
- return usePos;
+ if (it->mustHaveRegister()) {
+ const int usePos = it->pos;
+ if (usePos >= startPosition)
+ return usePos;
+ }
}
return -1;
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index eb97d5fc6b..896331593f 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -562,7 +562,9 @@ QJSEnginePrivate *QJSEnginePrivate::get(QV4::ExecutionEngine *e)
QJSEnginePrivate::~QJSEnginePrivate()
{
- for (QHash<const QMetaObject *, QQmlPropertyCache *>::Iterator iter = propertyCache.begin(); iter != propertyCache.end(); ++iter)
+ typedef QHash<const QMetaObject *, QQmlPropertyCache *>::Iterator PropertyCacheIt;
+
+ for (PropertyCacheIt iter = propertyCache.begin(), end = propertyCache.end(); iter != end; ++iter)
(*iter)->release();
}
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index b7232c1a28..e42fcdc4fd 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -91,7 +91,7 @@ Heap::ArrayBuffer::ArrayBuffer(ExecutionEngine *e, size_t length)
e->throwRangeError(QStringLiteral("ArrayBuffer: out of memory"));
return;
}
- data->size = length;
+ data->size = int(length);
memset(data->data(), 0, length + 1);
}
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 14df0fa8dd..a3c48fb378 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -128,7 +128,8 @@ quintptr getStackLimit()
void* stackBottom = 0;
pthread_attr_t attr;
#if HAVE(PTHREAD_NP_H) && OS(FREEBSD)
- if (pthread_attr_get_np(pthread_self(), &attr) == 0) {
+ // on FreeBSD pthread_attr_init() must be called otherwise getting the attrs crashes
+ if (pthread_attr_init(&attr) == 0 && pthread_attr_get_np(pthread_self(), &attr) == 0) {
#else
if (pthread_getattr_np(pthread_self(), &attr) == 0) {
#endif
@@ -1334,7 +1335,7 @@ static QV4::ReturnedValue objectFromVariantMap(QV4::ExecutionEngine *e, const QV
QV4::ScopedObject o(scope, e->newObject());
QV4::ScopedString s(scope);
QV4::ScopedValue v(scope);
- for (QVariantMap::ConstIterator iter = map.begin(); iter != map.end(); ++iter) {
+ for (QVariantMap::const_iterator iter = map.begin(), cend = map.end(); iter != cend; ++iter) {
s = e->newString(iter.key());
uint idx = s->asArrayIndex();
if (idx > 16 && (!o->arrayData() || idx > o->arrayData()->length() * 2))
@@ -1500,10 +1501,9 @@ static QV4::ReturnedValue variantMapToJS(QV4::ExecutionEngine *v4, const QVarian
{
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, v4->newObject());
- QVariantMap::const_iterator it;
QV4::ScopedString s(scope);
QV4::ScopedValue v(scope);
- for (it = vmap.constBegin(); it != vmap.constEnd(); ++it) {
+ for (QVariantMap::const_iterator it = vmap.constBegin(), cend = vmap.constEnd(); it != cend; ++it) {
s = v4->newIdentifier(it.key());
v = variantToJS(v4, it.value());
uint idx = s->asArrayIndex();
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index f332ec5133..5beb46f574 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -497,7 +497,7 @@ ReturnedValue GlobalFunctions::method_parseInt(CallContext *ctx)
}
if (overflow) {
- double result = (double) v_overflow * pow(R, overflow_digit_count);
+ double result = (double) v_overflow * pow(static_cast<double>(R), static_cast<double>(overflow_digit_count));
result += v;
return Encode(sign * result);
} else {
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 911fc7337c..e7905974df 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -1002,7 +1002,7 @@ QV4::ReturnedValue JsonObject::fromJsonObject(ExecutionEngine *engine, const QJs
ScopedObject o(scope, engine->newObject());
ScopedString s(scope);
ScopedValue v(scope);
- for (QJsonObject::const_iterator it = object.begin(); it != object.end(); ++it) {
+ for (QJsonObject::const_iterator it = object.begin(), cend = object.end(); it != cend; ++it) {
v = fromJsonValue(engine, it.value());
o->put((s = engine->newString(it.key())), v);
}
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp
index 83cee5cd0d..0889415a28 100644
--- a/src/qml/jsruntime/qv4persistent.cpp
+++ b/src/qml/jsruntime/qv4persistent.cpp
@@ -50,7 +50,7 @@ struct Header {
int freeList;
};
-static const int kEntriesPerPage = (WTF::pageSize() - sizeof(Header)) / sizeof(Value);
+static const int kEntriesPerPage = int((WTF::pageSize() - sizeof(Header)) / sizeof(Value));
struct Page {
Header header;
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 20707d073b..c31de6a9f0 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1005,7 +1005,7 @@ ReturnedValue Runtime::callElement(ExecutionEngine *engine, const Value &index,
ReturnedValue Runtime::callValue(ExecutionEngine *engine, const Value &func, CallData *callData)
{
if (!func.isObject())
- return engine->throwTypeError();
+ return engine->throwTypeError(QStringLiteral("%1 is not a function").arg(func.toQStringNoThrow()));
return func.objectValue()->call(callData);
}
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index d7f786f39d..91d5bc3d78 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -38,7 +38,7 @@
#include "qv4objectproto_p.h"
#include <private/qv4mm_p.h>
#include "qv4scopedvalue_p.h"
-
+#include "qv4alloca_p.h"
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
#include <QtCore/QStringList>
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index ab67d7738d..92e98e3e84 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -368,7 +368,7 @@ The following functions are also on the Qt object.
/*!
\qmlproperty object Qt::platform
- \since 4.8
+ \since 5.1
The \c platform object provides info about the underlying platform.
@@ -392,6 +392,8 @@ The following functions are also on the Qt object.
\li \c "unix" - Other Unix-based OS
\li \c "windows" - Windows
\li \c "wince" - Windows CE
+ \li \c "winrt" - Windows RT
+ \li \c "winphone" - Windows Phone
\endlist
\endtable
*/
@@ -593,6 +595,9 @@ QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e)
QQmlEnginePrivate::~QQmlEnginePrivate()
{
+ typedef QHash<QPair<QQmlType *, int>, QQmlPropertyCache *>::Iterator TypePropertyCacheIt;
+ typedef QHash<int, QQmlCompiledData *>::Iterator CompositeTypesIt;
+
if (inProgressCreations)
qWarning() << QQmlEngine::tr("There are still \"%1\" items in the process of being created at engine destruction.").arg(inProgressCreations);
@@ -610,9 +615,9 @@ QQmlEnginePrivate::~QQmlEnginePrivate()
if (incubationController) incubationController->d = 0;
incubationController = 0;
- for(QHash<QPair<QQmlType *, int>, QQmlPropertyCache *>::Iterator iter = typePropertyCache.begin(); iter != typePropertyCache.end(); ++iter)
+ for (TypePropertyCacheIt iter = typePropertyCache.begin(), end = typePropertyCache.end(); iter != end; ++iter)
(*iter)->release();
- for (QHash<int, QQmlCompiledData *>::Iterator iter = m_compositeTypes.begin(); iter != m_compositeTypes.end(); ++iter)
+ for (CompositeTypesIt iter = m_compositeTypes.begin(), end = m_compositeTypes.end(); iter != end; ++iter)
iter.value()->isRegisteredWithEngine = false;
delete profiler;
}
diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp
index 4939ac15c4..2b3c2ade4f 100644
--- a/src/qml/qml/qqmlfileselector.cpp
+++ b/src/qml/qml/qqmlfileselector.cpp
@@ -88,9 +88,9 @@ Q_GLOBAL_STATIC(interceptorSelectorMap, interceptorInstances);
*/
/*!
- Creates a new QQmlFileSelector, which includes its own QFileSelector.
- \a engine is the QQmlEngine you wish to apply file selectors too. It will
- also take ownership of the QQmlFileSelector.
+ Creates a new QQmlFileSelector with parent object \a parent, which includes
+ its own QFileSelector. \a engine is the QQmlEngine you wish to apply file
+ selectors to. It will also take ownership of the QQmlFileSelector.
*/
QQmlFileSelector::QQmlFileSelector(QQmlEngine* engine, QObject* parent)
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index 6dc18b4b05..9779773b05 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -143,8 +143,7 @@ QQmlMetaTypeData::~QQmlMetaTypeData()
for (int i = 0; i < types.count(); ++i)
delete types.at(i);
- TypeModules::const_iterator i = uriToModule.constBegin();
- for (; i != uriToModule.constEnd(); ++i)
+ for (TypeModules::const_iterator i = uriToModule.constBegin(), cend = uriToModule.constEnd(); i != cend; ++i)
delete *i;
}
@@ -1096,8 +1095,7 @@ void qmlClearTypeRegistrations() // Declared in qqml.h
for (int i = 0; i < data->types.count(); ++i)
delete data->types.at(i);
- QQmlMetaTypeData::TypeModules::const_iterator i = data->uriToModule.constBegin();
- for (; i != data->uriToModule.constEnd(); ++i)
+ for (QQmlMetaTypeData::TypeModules::const_iterator i = data->uriToModule.constBegin(), cend = data->uriToModule.constEnd(); i != cend; ++i)
delete *i;
data->types.clear();
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index bf38fc79a6..dd1f93ec00 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1053,7 +1053,7 @@ void QQmlPropertyData::markAsOverrideOf(QQmlPropertyData *predecessor)
QStringList QQmlPropertyCache::propertyNames() const
{
QStringList keys;
- for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter)
+ for (StringCache::ConstIterator iter = stringCache.begin(), cend = stringCache.end(); iter != cend; ++iter)
keys.append(iter.key());
return keys;
}
@@ -1374,7 +1374,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder)
QList<QPair<QString, QQmlPropertyData *> > properties;
QList<QPair<QString, QQmlPropertyData *> > methods;
- for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter)
+ for (StringCache::ConstIterator iter = stringCache.begin(), cend = stringCache.end(); iter != cend; ++iter)
Insert::in(this, properties, methods, iter, iter.value().second);
Q_ASSERT(properties.count() == propertyIndexCache.count());
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index ac4dcbdd4d..0bf8043cdb 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -885,15 +885,18 @@ Thus QQmlDataBlob::done() will always eventually be called, even if the blob has
void QQmlTypeLoader::invalidate()
{
- for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter)
- (*iter)->release();
- m_networkReplies.clear();
-
if (m_thread) {
shutdownThread();
delete m_thread;
m_thread = 0;
}
+
+ // Need to delete the network replies after
+ // the loader thread is shutdown as it could be
+ // getting new replies while we clear them
+ for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter)
+ (*iter)->release();
+ m_networkReplies.clear();
}
void QQmlTypeLoader::lock()
@@ -1881,11 +1884,11 @@ and qmldir information.
*/
void QQmlTypeLoader::clearCache()
{
- for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter)
+ for (TypeCache::Iterator iter = m_typeCache.begin(), end = m_typeCache.end(); iter != end; ++iter)
(*iter)->release();
- for (ScriptCache::Iterator iter = m_scriptCache.begin(); iter != m_scriptCache.end(); ++iter)
+ for (ScriptCache::Iterator iter = m_scriptCache.begin(), end = m_scriptCache.end(); iter != end; ++iter)
(*iter)->release();
- for (QmldirCache::Iterator iter = m_qmldirCache.begin(); iter != m_qmldirCache.end(); ++iter)
+ for (QmldirCache::Iterator iter = m_qmldirCache.begin(), end = m_qmldirCache.end(); iter != end; ++iter)
(*iter)->release();
qDeleteAll(m_importDirCache);
qDeleteAll(m_importQmlDirCache);
@@ -1901,7 +1904,7 @@ void QQmlTypeLoader::trimCache()
{
while (true) {
QList<TypeCache::Iterator> unneededTypes;
- for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter) {
+ for (TypeCache::Iterator iter = m_typeCache.begin(), end = m_typeCache.end(); iter != end; ++iter) {
QQmlTypeData *typeData = iter.value();
if (typeData->m_compiledData && typeData->m_compiledData->count() == 1) {
// There are no live objects of this type
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 9bd3b474b2..201fd4572c 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1358,6 +1358,11 @@ void QQmlDelegateModel::_q_itemsRemoved(int index, int count)
const QList<QQmlDelegateModelItem *> cache = d->m_cache;
for (int i = 0, c = cache.count(); i < c; ++i) {
QQmlDelegateModelItem *item = cache.at(i);
+ // layout change triggered by removal of a previous item might have
+ // already invalidated this item in d->m_cache and deleted it
+ if (!d->m_cache.contains(item))
+ continue;
+
if (item->modelIndex() >= index + count)
item->setModelIndex(item->modelIndex() - count);
else if (item->modelIndex() >= index)
@@ -2270,21 +2275,23 @@ void QQmlDelegateModelGroupPrivate::emitModelUpdated(bool reset)
changeSet.clear();
}
+typedef QQmlDelegateModelGroupEmitterList::iterator GroupEmitterListIt;
+
void QQmlDelegateModelGroupPrivate::createdPackage(int index, QQuickPackage *package)
{
- for (QQmlDelegateModelGroupEmitterList::iterator it = emitters.begin(); it != emitters.end(); ++it)
+ for (GroupEmitterListIt it = emitters.begin(), end = emitters.end(); it != end; ++it)
it->createdPackage(index, package);
}
void QQmlDelegateModelGroupPrivate::initPackage(int index, QQuickPackage *package)
{
- for (QQmlDelegateModelGroupEmitterList::iterator it = emitters.begin(); it != emitters.end(); ++it)
+ for (GroupEmitterListIt it = emitters.begin(), end = emitters.end(); it != end; ++it)
it->initPackage(index, package);
}
void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package)
{
- for (QQmlDelegateModelGroupEmitterList::iterator it = emitters.begin(); it != emitters.end(); ++it)
+ for (GroupEmitterListIt it = emitters.begin(), end = emitters.end(); it != end; ++it)
it->destroyingPackage(package);
}
diff --git a/src/qml/types/qqmlmodelindexvaluetype.cpp b/src/qml/types/qqmlmodelindexvaluetype.cpp
index 03ae05b4b5..a8900c686b 100644
--- a/src/qml/types/qqmlmodelindexvaluetype.cpp
+++ b/src/qml/types/qqmlmodelindexvaluetype.cpp
@@ -44,7 +44,7 @@ QString QQmlModelIndexValueType::propertiesString(const QModelIndex &idx)
return QLatin1String("()");
return QString(QLatin1String("(%1,%2,0x%3,%4(0x%5))"))
.arg(idx.row()).arg(idx.column()).arg(idx.internalId(), 0, 16)
- .arg(idx.model()->metaObject()->className()).arg(quintptr(idx.model()), 0, 16);
+ .arg(QLatin1String(idx.model()->metaObject()->className())).arg(quintptr(idx.model()), 0, 16);
}
/*!
diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp
index 879970b962..fb500426f3 100644
--- a/src/qml/types/qqmltimer.cpp
+++ b/src/qml/types/qqmltimer.cpp
@@ -329,7 +329,11 @@ bool QQmlTimer::event(QEvent *e)
ticked();
return true;
} else if (e->type() == QEvent_Triggered) {
- emit triggered();
+ if (d->running && d->pause.isStopped()) {
+ d->running = false;
+ emit triggered();
+ emit runningChanged();
+ }
return true;
}
return QObject::event(e);
@@ -340,10 +344,8 @@ void QQmlTimerPrivate::animationFinished(QAbstractAnimationJob *)
Q_Q(QQmlTimer);
if (repeating || !running)
return;
- running = false;
firstTick = false;
QCoreApplication::postEvent(q, new QEvent(QEvent_Triggered));
- emit q->runningChanged();
}
QT_END_NAMESPACE
diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp
index 49bab67f3d..5fe73ec0e0 100644
--- a/src/qml/types/qquickpackage.cpp
+++ b/src/qml/types/qquickpackage.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
\snippet package/Delegate.qml 0
These named items are used as the delegates by the two views who
- reference the special \l{VisualDataModel::parts} property to select
+ reference the special \l{DelegateModel::parts} property to select
a model which provides the chosen delegate.
\snippet package/view.qml 0
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 2130cdeb1f..356970eef0 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -527,7 +527,7 @@ public:
const QByteArray propertyType = QByteArrayLiteral("QVariant");
const QHash<int, QByteArray> names = model.aim()->roleNames();
- for (QHash<int, QByteArray>::const_iterator it = names.begin(); it != names.end(); ++it) {
+ for (QHash<int, QByteArray>::const_iterator it = names.begin(), cend = names.end(); it != cend; ++it) {
const int propertyId = propertyRoles.count();
propertyRoles.append(it.key());
roleNames.insert(it.value(), it.key());
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 9175a7c1fb..947039f60e 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -369,6 +369,10 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
}
view->show();
view->requestActivate();
+
+ while (view->status() == QQuickView::Loading)
+ QTest::qWait(10);
+
QTest::qWaitForWindowActive(view);
if (view->isExposed())
QTestRootObject::instance()->setWindowShown(true);
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index 2101d6e7aa..df8de14c14 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -111,7 +111,7 @@ namespace QTest {
namespace QtQuickTest
{
- enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDoubleClick, MouseMove };
+ enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDoubleClick, MouseMove, MouseDoubleClickSequence };
static void mouseEvent(MouseAction action, QWindow *window,
QObject *item, Qt::MouseButton button,
@@ -131,6 +131,15 @@ namespace QtQuickTest
return;
}
+ if (action == MouseDoubleClickSequence) {
+ mouseEvent(MousePress, window, item, button, stateKey, _pos);
+ mouseEvent(MouseRelease, window, item, button, stateKey, _pos);
+ mouseEvent(MousePress, window, item, button, stateKey, _pos);
+ mouseEvent(MouseDoubleClick, window, item, button, stateKey, _pos);
+ mouseEvent(MouseRelease, window, item, button, stateKey, _pos);
+ return;
+ }
+
QPoint pos;
QQuickItem *sgitem = qobject_cast<QQuickItem *>(item);
if (sgitem)
@@ -162,7 +171,7 @@ namespace QtQuickTest
QSpontaneKeyEvent::setSpontaneous(&me);
if (!qApp->notify(window, &me)) {
static const char *mouseActionNames[] =
- { "MousePress", "MouseRelease", "MouseClick", "MouseDoubleClick", "MouseMove" };
+ { "MousePress", "MouseRelease", "MouseClick", "MouseDoubleClick", "MouseMove", "MouseDoubleClickSequence" };
QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving window");
QWARN(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toLatin1().data());
}
@@ -269,6 +278,20 @@ bool QuickTestEvent::mouseDoubleClick
return true;
}
+bool QuickTestEvent::mouseDoubleClickSequence
+ (QObject *item, qreal x, qreal y, int button,
+ int modifiers, int delay)
+{
+ QWindow *view = eventWindow();
+ if (!view)
+ return false;
+ QtQuickTest::mouseEvent(QtQuickTest::MouseDoubleClickSequence, view, item,
+ Qt::MouseButton(button),
+ Qt::KeyboardModifiers(modifiers),
+ QPointF(x, y), delay);
+ return true;
+}
+
bool QuickTestEvent::mouseMove
(QObject *item, qreal x, qreal y, int delay, int buttons)
{
diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h
index 3005d84128..b7f8f3eda2 100644
--- a/src/qmltest/quicktestevent_p.h
+++ b/src/qmltest/quicktestevent_p.h
@@ -63,6 +63,8 @@ public Q_SLOTS:
int modifiers, int delay);
bool mouseDoubleClick(QObject *item, qreal x, qreal y, int button,
int modifiers, int delay);
+ bool mouseDoubleClickSequence(QObject *item, qreal x, qreal y, int button,
+ int modifiers, int delay);
bool mouseMove(QObject *item, qreal x, qreal y, int delay, int buttons);
#ifndef QT_NO_WHEELEVENT
diff --git a/src/quick/designer/designersupport.cpp b/src/quick/designer/designersupport.cpp
index fe61340859..56d2badb62 100644
--- a/src/quick/designer/designersupport.cpp
+++ b/src/quick/designer/designersupport.cpp
@@ -57,9 +57,9 @@ DesignerSupport::DesignerSupport()
DesignerSupport::~DesignerSupport()
{
- QHash<QQuickItem*, QSGLayer*>::iterator iterator;
+ typedef QHash<QQuickItem*, QSGLayer*>::iterator ItemTextureHashIt;
- for (iterator = m_itemTextureHash.begin(); iterator != m_itemTextureHash.end(); ++iterator) {
+ for (ItemTextureHashIt iterator = m_itemTextureHash.begin(), end = m_itemTextureHash.end(); iterator != end; ++iterator) {
QSGLayer *texture = iterator.value();
QQuickItem *item = iterator.key();
QQuickItemPrivate::get(item)->derefFromEffectItem(true);
diff --git a/src/quick/doc/images/qml-item-canvas.arc.png b/src/quick/doc/images/qml-item-canvas-arc.png
index 5f9d32d8d3..5f9d32d8d3 100644
--- a/src/quick/doc/images/qml-item-canvas.arc.png
+++ b/src/quick/doc/images/qml-item-canvas-arc.png
Binary files differ
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index 41fe42777b..afe1b9708f 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -33,7 +33,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtquick/qtquick.tags
-depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs qtsensors qtwidgets
+depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects
headerdirs += ..\
../../quickwidgets
diff --git a/src/quick/doc/src/concepts/effects/sprites.qdoc b/src/quick/doc/src/concepts/effects/sprites.qdoc
index 2af463e4bf..edad89b1e5 100644
--- a/src/quick/doc/src/concepts/effects/sprites.qdoc
+++ b/src/quick/doc/src/concepts/effects/sprites.qdoc
@@ -144,14 +144,12 @@ to some graphics memory limitations. Because it requires all the sprites for a s
texture, attempting to load many different animations can run into texture memory limits on embedded devices. In
these situations, a warning will be output to the console containing the maximum texture size.
-There are several software tools to help turn images into sprite sheets, here are some examples:
-Photoshop plugin:
-http://www.personal.psu.edu/zez1/blogs/my_blog/2011/05/scripts-4-photoshop-file-sequence-to-layers-to-sprite-sheet.html
-Gimp plugin:
-http://registry.gimp.org/node/20943
-Cmd-line tool:
-http://www.imagemagick.org/script/montage.php
-
+There are several tools to help turn a set of images into sprite sheets, here are some examples:
+\list
+ \li Photoshop plugin: \l http://www.johnwordsworth.com/projects/photoshop-sprite-sheet-generator-script
+ \li Gimp plugin: \l http://registry.gimp.org/node/20943
+ \li Cmd-line tool: \l http://www.imagemagick.org/script/montage.php
+\endlist
\section2 QML Types Using the Sprite Engine
diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc
index 90999d8b5e..db84961d20 100644
--- a/src/quick/doc/src/concepts/input/focus.qdoc
+++ b/src/quick/doc/src/concepts/input/focus.qdoc
@@ -138,7 +138,7 @@ similar to when there are no focus scopes.
\li When a focus scope receives active focus, the contained type with
\c focus set (if any) also gets the active focus. If this type is
also a \l FocusScope, the proxying behavior continues. Both the
-focus scope and the sub-focused item will have \c activeFocus property set.
+focus scope and the sub-focused item will have the \c activeFocus property set.
\endlist
Note that, since the FocusScope type is not a visual type, the properties
diff --git a/src/quick/doc/src/dynamicview-tutorial.qdoc b/src/quick/doc/src/dynamicview-tutorial.qdoc
index 7e6a5166a3..f87f94f264 100644
--- a/src/quick/doc/src/dynamicview-tutorial.qdoc
+++ b/src/quick/doc/src/dynamicview-tutorial.qdoc
@@ -165,14 +165,14 @@ to the index of the item it was dragged over.
To move the items within the view we use a DelegateModel. The DelegateModel type is used by
the view types to instantiate delegate items from model data and when constructed explicitly can
be used to filter and re-order the model items provided to ListView. The
-\l {QtQuick::DelegateModel::items}{items} property of DelegateModel provides access to the
+\l [QML]{DelegateModel::}{items} property of DelegateModel provides access to the
view's items and allows us to change the visible order without modifying the source model. To
-determine the current visible index of the items we use \l {QtQuick::DelegateModel::itemsIndex}
+determine the current visible index of the items we use \l {DelegateModel::}{itemsIndex}
{itemsIndex} property on the DelegateModel attached property of the delegate item.
-To utilize a DelegateModel with a ListView we bind it to the \l {QtQuick::ListView::model}{model}
-property of the view and bind the \l {QtQuick::DelegateModel::model}{model} and
-\l {QtQuick::DelegateModel::delegate}{delegate} to the DelegateModel.
+To utilize a DelegateModel with a ListView we bind it to the \l {ListView::}{model}
+property of the view and bind the \l {DelegateModel::}{model} and
+\l {DelegateModel::}{delegate} to the DelegateModel.
\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 4
@@ -194,7 +194,7 @@ like this:
\section2 Walkthrough
Items in a DelegateModel are filtered into groups represented by the DelegateModelGroup type,
-normally all items in the model belong to a default \l {QtQuick::DelegateModel::items}{items}
+normally all items in the model belong to a default \l {DelegateModel::}{items}
group but this default can be changed with the includeByDefault property. To implement our sorting
we want items to first be added to an unsorted group from where we can transfer them to a sorted
position in the items group. To do that we clear includeByDefault on the items group and set it on
@@ -208,7 +208,7 @@ item and then transfer the item to the items group before moving it to the pre-d
repeat until the unsorted group is empty.
To find the insert position for an item we request a handle for the item from the unsorted group
-with the \l {QtQuick::DelegateModel::get} {get} function. Through the model property on this
+with the \l {DelegateModel::}{get} function. Through the model property on this
handle we can access the same model data that is available in a delegate instance of that item and
compare against other items to determine relative position.
@@ -220,7 +220,7 @@ of the list. In this example it can be one of the following:
\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 4
A sort is triggered whenever new items are added to the unsorted DelegateModel which we are
-notified of by the \l {QtQuick::DelegateModelGroup::onChanged}{onChanged} handler. If no sort
+notified of by the \l {DelegateModelGroup} \c onChanged handler. If no sort
function is currently selected we simply transfer all items from the unsorted group to the items
group, otherwise we call sort with the selected sort function.
@@ -228,8 +228,8 @@ group, otherwise we call sort with the selected sort function.
Finally when the selected sort order changes we can trigger a full re-sort of the list by moving
all items from the items group to the unsorted group, which will trigger the
-\l {QtQuick::DelegateModelGroup::onChanged}{onChanged} handler and transfer the items back to the
-items group in correct order. Note that the \l {QtQuick::DelegateModelGroup::onChanged}{onChanged}
+\l {DelegateModelGroup} \c onChanged handler and transfer the items back to the
+items group in correct order. Note that the \l {DelegateModelGroup} \c onChanged
handler will not be invoked recursively so there's no issue with it being invoked during a sort.
\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 6
diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc
index 21ab4a2731..b0a39e1dd3 100644
--- a/src/quick/doc/src/whatsnew.qdoc
+++ b/src/quick/doc/src/whatsnew.qdoc
@@ -193,7 +193,7 @@ relative to its start.
\endlist
-\section2 Text
+\section2 Text Rendering and Input
\list
\li Changes common to \l Text, TextEdit and TextInput:
@@ -312,8 +312,8 @@ the window loses focus.
\li VisualDataModel:
\list
\li Now has features to filter the items to be displayed in a view. This is supported by the new
- \l {VisualDataModel::}{groups}, \l {VisualDataModel::}{filterOnGroup}, \l {VisualDataModel::}{items}
- and \l {VisualDataModel::}{persistedItems} properties.
+ \l {DelegateModel::}{groups}, \l {DelegateModel::}{filterOnGroup}, \l {DelegateModel::}{items}
+ and \l {DelegateModel::}{persistedItems} properties.
\endlist
\li Changes common to both ListView and GridView:
\list
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 4145b2f6ff..11aff9b95d 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -592,7 +592,9 @@ void QQuickCanvasItem::geometryChanged(const QRectF &newGeometry, const QRectF &
QQuickItem::geometryChanged(newGeometry, oldGeometry);
- QSizeF newSize = newGeometry.size();
+ // Due to indirect recursion, newGeometry may be outdated
+ // after this call, so we use width and height instead.
+ QSizeF newSize = QSizeF(width(), height());
if (!d->hasCanvasSize && d->canvasSize != newSize) {
d->canvasSize = newSize;
emit canvasSizeChanged();
@@ -1124,6 +1126,9 @@ bool QQuickCanvasItem::createContext(const QString &contextType)
{
Q_D(QQuickCanvasItem);
+ if (!window())
+ return false;
+
if (contextType == QLatin1String("2d")) {
if (d->contextType.compare(QLatin1String("2d"), Qt::CaseInsensitive) != 0) {
d->contextType = QLatin1String("2d");
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 7b9cb9e9f1..99b9311ee0 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE
}
\endqml
The \l role is set to \c Button to indicate the type of control.
- \l Accessible.name is the most important information and bound to the text on the button.
+ \l {Accessible::}{name} is the most important information and bound to the text on the button.
The name is a short and consise description of the control and should reflect the visual label.
In this case it is not clear what the button does with the name only, so \l description contains
an explanation.
@@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE
\li All interactive elements
\li \l focusable and \l focused
\li All elements that the user can interact with should have focusable set to \c true and
- set \l focus to \c true when they have the focus. This is important even for applications
+ set \c focus to \c true when they have the focus. This is important even for applications
that run on touch-only devices since screen readers often implement a virtual focus that
can be moved from item to item.
\row
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index c23b8bb8a4..7ce649c7eb 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -516,8 +516,8 @@ void QQuickDragAttached::setProposedAction(Qt::DropAction action)
\endlist
When using \c Drag.Automatic you should also define \l mimeData and bind the
- \l active property to the active property of \l MouseArea.drag.
- */
+ \l active property to the active property of MouseArea : \l {MouseArea::drag.active}
+*/
QQuickDrag::DragType QQuickDragAttached::dragType() const
{
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index 688cf57441..b54c34765f 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -210,7 +210,8 @@ void QQuickImageBase::load()
QUrl loadUrl = d->url;
if (d->url.scheme() == QStringLiteral("image")
- || d->url.toString().endsWith(".svg") || d->url.toString().endsWith(".svgz")) {
+ || d->url.toString().endsWith(QLatin1String(".svg"))
+ || d->url.toString().endsWith(QLatin1String(".svgz"))) {
// QQuickImageProvider and SVG can generate a high resolution image when
// sourceSize is set. If sourceSize is not set then the provider default size
// will be used, as usual.
@@ -322,7 +323,7 @@ static QString image2xPath(const QString &path)
{
const int dotIndex = path.lastIndexOf(QLatin1Char('.'));
if (dotIndex == -1)
- return path;
+ return path + QLatin1String("@2x");
if (path.contains(QLatin1String("@2x.")))
return path;
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index b1aeda4091..4157fc4a66 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -1757,11 +1757,9 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
QQmlProperty(), or QMetaProperty::write() when you need to modify those
properties from C++. This ensures that the QML engine knows about the
property change. Otherwise, the engine won't be able to carry out your
- requested animation. For example, if you call \l setPosition() directly,
- any behavior that reacts to changes in the x or y properties will not take
- effect, as you are bypassing Qt's meta-object system. Note that these
- functions incur a slight performance penalty. For more details, see
- \l {Accessing Members of a QML Object Type from C++}.
+ requested animation.
+ Note that these functions incur a slight performance penalty. For more
+ details, see \l {Accessing Members of a QML Object Type from C++}.
\sa QQuickWindow, QQuickPaintedItem
*/
@@ -5053,7 +5051,7 @@ void QQuickItem::setZ(qreal v)
\endqml
\endtable
- \sa transform, Rotation
+ \sa Transform, Rotation
*/
/*!
\property QQuickItem::rotation
@@ -5079,7 +5077,7 @@ void QQuickItem::setZ(qreal v)
\endqml
\endtable
- \sa transform, Rotation
+ \sa Transform, Rotation
*/
qreal QQuickItem::rotation() const
{
@@ -5139,7 +5137,7 @@ void QQuickItem::setRotation(qreal r)
\endqml
\endtable
- \sa transform, Scale
+ \sa Transform, Scale
*/
/*!
\property QQuickItem::scale
@@ -5178,7 +5176,7 @@ void QQuickItem::setRotation(qreal r)
\endqml
\endtable
- \sa transform, Scale
+ \sa Transform, Scale
*/
qreal QQuickItem::scale() const
{
@@ -6368,7 +6366,7 @@ void QQuickItem::setSize(const QSizeF &size)
d->heightValid = true;
d->widthValid = true;
- if (QSizeF(d->width, d->height) == size)
+ if (d->width == size.width() && d->height == size.height())
return;
qreal oldHeight = d->height;
diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp
index dadef6a0c3..9d140b3156 100644
--- a/src/quick/items/qquickitemanimation.cpp
+++ b/src/quick/items/qquickitemanimation.cpp
@@ -581,11 +581,11 @@ QQuickPathAnimation::QQuickPathAnimation(QObject *parent)
QQuickPathAnimation::~QQuickPathAnimation()
{
+ typedef QHash<QQuickItem*, QQuickPathAnimationAnimator* >::iterator ActiveAnimationsIt;
+
Q_D(QQuickPathAnimation);
- QHash<QQuickItem*, QQuickPathAnimationAnimator* >::iterator it;
- for (it = d->activeAnimations.begin(); it != d->activeAnimations.end(); ++it) {
+ for (ActiveAnimationsIt it = d->activeAnimations.begin(), end = d->activeAnimations.end(); it != end; ++it)
it.value()->clearTemplate();
- }
}
/*!
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 0cab9d28dd..01ef1e65f7 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -2415,20 +2415,22 @@ void QQuickItemViewPrivate::updateTrackedItem()
void QQuickItemViewPrivate::updateUnrequestedIndexes()
{
Q_Q(QQuickItemView);
- for (QHash<QQuickItem*,int>::iterator it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it)
+ for (QHash<QQuickItem*,int>::iterator it = unrequestedItems.begin(), end = unrequestedItems.end(); it != end; ++it)
*it = model->indexOf(it.key(), q);
}
void QQuickItemViewPrivate::updateUnrequestedPositions()
{
- for (QHash<QQuickItem*,int>::const_iterator it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it)
+ for (QHash<QQuickItem*,int>::const_iterator it = unrequestedItems.begin(), cend = unrequestedItems.end(); it != cend; ++it)
repositionPackageItemAt(it.key(), it.value());
}
void QQuickItemViewPrivate::updateVisibleIndex()
{
+ typedef QList<FxViewItem*>::const_iterator FxViewItemListConstIt;
+
visibleIndex = 0;
- for (QList<FxViewItem*>::Iterator it = visibleItems.begin(); it != visibleItems.end(); ++it) {
+ for (FxViewItemListConstIt it = visibleItems.constBegin(), cend = visibleItems.constEnd(); it != cend; ++it) {
if ((*it)->index != -1) {
visibleIndex = (*it)->index;
break;
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index ae719198f1..7fa6cdc161 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -162,7 +162,9 @@ QQuickItemViewTransitioner::QQuickItemViewTransitioner()
QQuickItemViewTransitioner::~QQuickItemViewTransitioner()
{
- for (QSet<QQuickItemViewTransitionJob *>::iterator it = runningJobs.begin(); it != runningJobs.end(); ++it)
+ typedef QSet<QQuickItemViewTransitionJob *>::iterator JobIt;
+
+ for (JobIt it = runningJobs.begin(), end = runningJobs.end(); it != end; ++it)
(*it)->m_transitioner = 0;
}
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index b78c58854e..6227329fbc 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -1305,6 +1305,8 @@ void QQuickMouseArea::setCursorShape(Qt::CursorShape shape)
started. If set to \c false, the target will be moved straight to the current mouse position.
By default, this property is \c true. This property was added in Qt Quick 2.4
+ See the \l Drag attached property and \l DropArea if you want to make a drop.
+
\snippet qml/mousearea/mouseareadragfilter.qml dragfilter
*/
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 33f4bade3a..8a391b7aea 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -346,8 +346,11 @@ void QQuickPinchArea::touchEvent(QTouchEvent *event)
case QEvent::TouchEnd:
clearPinch();
break;
+ case QEvent::TouchCancel:
+ cancelPinch();
+ break;
default:
- QQuickItem::event(event);
+ QQuickItem::touchEvent(event);
}
}
@@ -384,6 +387,47 @@ void QQuickPinchArea::clearPinch()
setKeepMouseGrab(false);
}
+void QQuickPinchArea::cancelPinch()
+{
+ Q_D(QQuickPinchArea);
+
+ d->touchPoints.clear();
+ if (d->inPinch) {
+ d->inPinch = false;
+ QPointF pinchCenter = mapFromScene(d->sceneLastCenter);
+ QQuickPinchEvent pe(d->pinchStartCenter, d->pinchStartScale, d->pinchStartAngle, d->pinchStartRotation);
+ pe.setStartCenter(d->pinchStartCenter);
+ pe.setPreviousCenter(pinchCenter);
+ pe.setPreviousAngle(d->pinchLastAngle);
+ pe.setPreviousScale(d->pinchLastScale);
+ pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
+ pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
+ pe.setPoint1(pe.startPoint1());
+ pe.setPoint2(pe.startPoint2());
+ emit pinchFinished(&pe);
+
+ d->pinchLastScale = d->pinchStartScale;
+ d->sceneLastCenter = d->sceneStartCenter;
+ d->pinchLastAngle = d->pinchStartAngle;
+ d->lastPoint1 = pe.startPoint1();
+ d->lastPoint2 = pe.startPoint2();
+ updatePinchTarget();
+
+ if (d->pinch && d->pinch->target())
+ d->pinch->setActive(false);
+ }
+ d->pinchStartDist = 0;
+ d->pinchActivated = false;
+ d->initPinch = false;
+ d->pinchRejected = false;
+ d->stealMouse = false;
+ d->id1 = -1;
+ QQuickWindow *win = window();
+ if (win && win->mouseGrabberItem() == this)
+ ungrabMouse();
+ setKeepMouseGrab(false);
+}
+
void QQuickPinchArea::updatePinch()
{
Q_D(QQuickPinchArea);
diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h
index 57f9a87e07..d2de59b5d6 100644
--- a/src/quick/items/qquickpincharea_p.h
+++ b/src/quick/items/qquickpincharea_p.h
@@ -279,6 +279,7 @@ protected:
private:
void clearPinch();
+ void cancelPinch();
void updatePinch();
void updatePinchTarget();
void handlePress();
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 24fc4b6af8..5bd6430f2d 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -198,7 +198,7 @@ QT_BEGIN_NAMESPACE
This contains the update mask for the orientation. Screen::orientation
only emits changes for the screen orientations matching this mask.
- The default, \c 0, means Screen::orientation never updates.
+ By default it is set to the value of the QScreen that the window uses.
*/
QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
@@ -206,6 +206,7 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
, m_screen(NULL)
, m_window(NULL)
, m_updateMask(0)
+ , m_updateMaskSet(false)
{
m_attachee = qobject_cast<QQuickItem*>(attachee);
@@ -301,6 +302,7 @@ Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const
void QQuickScreenAttached::setOrientationUpdateMask(Qt::ScreenOrientations mask)
{
+ m_updateMaskSet = true;
if (m_updateMask == mask)
return;
@@ -342,7 +344,12 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
if (!screen)
return; //Don't bother emitting signals, because the new values are garbage anyways
- screen->setOrientationUpdateMask(m_updateMask);
+ if (m_updateMaskSet) {
+ screen->setOrientationUpdateMask(m_updateMask);
+ } else if (m_updateMask != screen->orientationUpdateMask()) {
+ m_updateMask = screen->orientationUpdateMask();
+ emit orientationUpdateMaskChanged();
+ }
if (!oldScreen || screen->size() != oldScreen->size()) {
emit widthChanged();
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 68dbff7138..3d0f00b22c 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -106,6 +106,7 @@ private:
QQuickWindow* m_window;
QQuickItem* m_attachee;
Qt::ScreenOrientations m_updateMask;
+ bool m_updateMaskSet;
};
class Q_AUTOTEST_EXPORT QQuickScreen : public QObject
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 4cd055594c..1919ba9e79 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -144,10 +144,10 @@ QSizeF QQuickTextDocumentWithImageResources::intrinsicSize(
if (format.isImageFormat()) {
QTextImageFormat imageFormat = format.toImageFormat();
- const bool hasWidth = imageFormat.hasProperty(QTextFormat::ImageWidth);
const int width = qRound(imageFormat.width());
- const bool hasHeight = imageFormat.hasProperty(QTextFormat::ImageHeight);
+ const bool hasWidth = imageFormat.hasProperty(QTextFormat::ImageWidth) && width > 0;
const int height = qRound(imageFormat.height());
+ const bool hasHeight = imageFormat.hasProperty(QTextFormat::ImageHeight) && height > 0;
QSizeF size(width, height);
if (!hasWidth || !hasHeight) {
@@ -961,7 +961,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
// If the horizontal alignment is not left and the width was not valid we need to relayout
// now that we know the maximum line width.
- if (!implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
+ if (!q->widthValid() && !implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
widthExceeded = false;
heightExceeded = false;
continue;
@@ -2755,7 +2755,7 @@ void QQuickText::invalidateFontCaches()
{
Q_D(QQuickText);
- if (d->richText && d->extra->doc != 0) {
+ if (d->richText && d->extra.isAllocated() && d->extra->doc != 0) {
QTextBlock block;
for (block = d->extra->doc->firstBlock(); block.isValid(); block = block.next()) {
if (block.layout() != 0 && block.layout()->engine() != 0)
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 85ff6735bb..1d86b4b000 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -578,6 +578,7 @@ void QQuickTextInput::setVAlign(QQuickTextInput::VAlignment alignment)
emit verticalAlignmentChanged(d->vAlign);
if (isComponentComplete()) {
updateCursorRectangle();
+ d->updateBaselineOffset();
}
}
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 2db04ab378..369570f657 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -408,7 +408,7 @@ void QQuickTextNodeEngine::addImage(const QRectF &rect, const QImage &image, qre
QRectF searchRect = rect;
if (layoutPosition == QTextFrameFormat::InFlow) {
if (m_currentLineTree.isEmpty()) {
- searchRect.moveTopLeft(m_position + m_currentLine.position());
+ searchRect.moveTopLeft(m_position + m_currentLine.position() + QPointF(0,1));
} else {
const BinaryTreeNode *lastNode = m_currentLineTree.data() + m_currentLineTree.size() - 1;
if (lastNode->glyphRun.isRightToLeft()) {
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 8ac6ac7d6d..521ff1c4bb 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -249,20 +249,22 @@ void QQuickWindow::focusInEvent(QFocusEvent *ev)
void QQuickWindowPrivate::polishItems()
{
- int maxPolishCycles = 100000;
-
- while (!itemsToPolish.isEmpty() && --maxPolishCycles > 0) {
- QSet<QQuickItem *> itms = itemsToPolish;
- itemsToPolish.clear();
-
- for (QSet<QQuickItem *>::iterator it = itms.begin(); it != itms.end(); ++it) {
- QQuickItem *item = *it;
- QQuickItemPrivate::get(item)->polishScheduled = false;
- item->updatePolish();
- }
+ // An item can trigger polish on another item, or itself for that matter,
+ // during its updatePolish() call. Because of this, we cannot simply
+ // iterate through the set, we must continue pulling items out until it
+ // is empty.
+ // In the case where polish is called from updatePolish() either directly
+ // or indirectly, we use a recursionSafeguard to print a warning to
+ // the user.
+ int recursionSafeguard = INT_MAX;
+ while (!itemsToPolish.isEmpty() && --recursionSafeguard > 0) {
+ QQuickItem *item = *itemsToPolish.begin();
+ itemsToPolish.remove(item);
+ QQuickItemPrivate::get(item)->polishScheduled = false;
+ item->updatePolish();
}
- if (maxPolishCycles == 0)
+ if (recursionSafeguard == 0)
qWarning("QQuickWindow: possible QQuickItem::polish() loop");
updateFocusItemTransform();
@@ -1395,7 +1397,7 @@ bool QQuickWindow::event(QEvent *e)
break;
}
case QEvent::NativeGesture:
- d->deliverGestureEvent(d->contentItem, static_cast<QNativeGestureEvent*>(e));
+ d->deliverNativeGestureEvent(d->contentItem, static_cast<QNativeGestureEvent*>(e));
break;
default:
break;
@@ -1754,7 +1756,23 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
return false;
}
-bool QQuickWindowPrivate::deliverGestureEvent(QQuickItem *item, QNativeGestureEvent *event)
+/*! \reimp */
+void QQuickWindow::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickWindow);
+ qCDebug(DBG_MOUSE) << "QQuickWindow::wheelEvent()" << event->pixelDelta() << event->angleDelta() << event->phase();
+
+ //if the actual wheel event was accepted, accept the compatibility wheel event and return early
+ if (d->lastWheelEventAccepted && event->angleDelta().isNull() && event->phase() == Qt::ScrollUpdate)
+ return;
+
+ event->ignore();
+ d->deliverWheelEvent(d->contentItem, event);
+ d->lastWheelEventAccepted = event->isAccepted();
+}
+#endif // QT_NO_WHEELEVENT
+
+bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGestureEvent *event)
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -1766,7 +1784,7 @@ bool QQuickWindowPrivate::deliverGestureEvent(QQuickItem *item, QNativeGestureEv
QQuickItem *child = children.at(ii);
if (!child->isVisible() || !child->isEnabled() || QQuickItemPrivate::get(child)->culled)
continue;
- if (deliverGestureEvent(child, event))
+ if (deliverNativeGestureEvent(child, event))
return true;
}
@@ -1786,23 +1804,6 @@ bool QQuickWindowPrivate::deliverGestureEvent(QQuickItem *item, QNativeGestureEv
return false;
}
-/*! \reimp */
-void QQuickWindow::wheelEvent(QWheelEvent *event)
-{
- Q_D(QQuickWindow);
- qCDebug(DBG_MOUSE) << "QQuickWindow::wheelEvent()" << event->pixelDelta() << event->angleDelta() << event->phase();
-
- //if the actual wheel event was accepted, accept the compatibility wheel event and return early
- if (d->lastWheelEventAccepted && event->angleDelta().isNull() && event->phase() == Qt::ScrollUpdate)
- return;
-
- event->ignore();
- d->deliverWheelEvent(d->contentItem, event);
- d->lastWheelEventAccepted = event->isAccepted();
-}
-#endif // QT_NO_WHEELEVENT
-
-
bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
{
qCDebug(DBG_TOUCH) << event;
@@ -2673,8 +2674,7 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown()
Q_Q(QQuickWindow);
cleanupNodes();
cleanupNodesOnShutdown(contentItem);
- QSet<QQuickItem *>::const_iterator it = parentlessItems.begin();
- for (; it != parentlessItems.end(); ++it)
+ for (QSet<QQuickItem *>::const_iterator it = parentlessItems.begin(), cend = parentlessItems.end(); it != cend; ++it)
cleanupNodesOnShutdown(*it);
animationController->windowNodesDestroyed();
q->cleanupSceneGraph();
@@ -3143,7 +3143,7 @@ bool QQuickWindow::isSceneGraphInitialized() const
(e.g. the user clicked the title bar close button). The CloseEvent contains
an accepted property which can be set to false to abort closing the window.
- \sa Window.closing()
+ \sa QQuickWindow::closing()
*/
/*!
@@ -3154,11 +3154,11 @@ bool QQuickWindow::isSceneGraphInitialized() const
*/
/*!
- \fn void QQuickWindow::closing()
+ \fn void QQuickWindow::closing(QQuickCloseEvent *close)
\since 5.1
- This signal is emitted when the window receives a QCloseEvent from the
- windowing system.
+ This signal is emitted when the window receives the event \a close from
+ the windowing system.
*/
/*!
@@ -3167,7 +3167,7 @@ bool QQuickWindow::isSceneGraphInitialized() const
This signal is emitted when the user tries to close the window.
- This signal includes a \a close parameter. The \a close \l accepted
+ This signal includes a \a close parameter. The \c {close.accepted}
property is true by default so that the window is allowed to close; but you
can implement an \c onClosing handler and set \c {close.accepted = false} if
you need to do something else before the window can be closed.
@@ -4038,7 +4038,7 @@ void QQuickWindow::resetOpenGLState()
This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(),
depending on the platform's default behavior for the window type and flags.
- \sa showFullScreen(), showMaximized(), showNormal(), hide(), flags()
+ \sa showFullScreen(), showMaximized(), showNormal(), hide(), QQuickItem::flags()
*/
/*!
@@ -4084,14 +4084,14 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \enum QQuickWindow::RenderJobSchedule
+ \enum QQuickWindow::RenderStage
\since 5.4
- \value ScheduleBeforeSynchronizing Before synchronization.
- \value ScheduleAfterSynchronizing After synchronization.
- \value ScheduleBeforeRendering Before rendering.
- \value ScheduleAfterRendering After rendering.
- \value ScheduleAfterSwap After the frame is swapped.
+ \value BeforeSynchronizingStage Before synchronization.
+ \value AfterSynchronizingStage After synchronization.
+ \value BeforeRenderingStage Before rendering.
+ \value AfterRenderingStage After rendering.
+ \value AfterSwapStage After the frame is swapped.
\sa {Scene Graph and Rendering}
*/
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 4d5f831e92..c3ae6c054c 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -141,7 +141,7 @@ public:
#ifndef QT_NO_WHEELEVENT
bool deliverWheelEvent(QQuickItem *, QWheelEvent *);
#endif
- bool deliverGestureEvent(QQuickItem *, QNativeGestureEvent *);
+ bool deliverNativeGestureEvent(QQuickItem *, QNativeGestureEvent *);
bool deliverTouchPoints(QQuickItem *, QTouchEvent *, const QList<QTouchEvent::TouchPoint> &, QSet<int> *,
QHash<QQuickItem *, QList<QTouchEvent::TouchPoint> > *, QSet<QQuickItem*> *filtered);
void deliverTouchEvent(QTouchEvent *);
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index b9d191abec..c68c0b93d2 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -385,6 +385,7 @@ void QSGMaterialShader::compile()
\class QSGMaterialShader::RenderState
\brief The QSGMaterialShader::RenderState encapsulates the current rendering state
during a call to QSGMaterialShader::updateState().
+ \inmodule QtQuick
The render state contains a number of accessors that the shader needs to respect
in order to conform to the current state of the scene graph.
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 4232bf125c..4f5c4efe14 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -62,7 +62,9 @@ QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCach
m_doubleGlyphResolution = qt_fontHasNarrowOutlines(font) && m_glyphCount < QT_DISTANCEFIELD_HIGHGLYPHCOUNT;
m_referenceFont = font;
- m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution));
+ // we set the same pixel size as used by the distance field internally.
+ // this allows us to call pathForGlyph once and reuse the result.
+ m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution) * QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution));
Q_ASSERT(m_referenceFont.isValid());
m_coreProfile = (c->format().profile() == QSurfaceFormat::CoreProfile);
@@ -78,8 +80,12 @@ QSGDistanceFieldGlyphCache::GlyphData &QSGDistanceFieldGlyphCache::glyphData(gly
if (data == m_glyphsData.end()) {
GlyphData gd;
gd.texture = &s_emptyTexture;
- QPainterPath path = m_referenceFont.pathForGlyph(glyph);
- gd.boundingRect = path.boundingRect();
+ gd.path = m_referenceFont.pathForGlyph(glyph);
+ // need bounding rect in base font size scale
+ qreal scaleFactor = qreal(1) / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution);
+ QTransform scaleDown;
+ scaleDown.scale(scaleFactor, scaleFactor);
+ gd.boundingRect = scaleDown.mapRect(gd.path.boundingRect());
data = m_glyphsData.insert(glyph, gd);
}
return data.value();
@@ -160,9 +166,11 @@ void QSGDistanceFieldGlyphCache::update()
QList<QDistanceField> distanceFields;
for (int i = 0; i < m_pendingGlyphs.size(); ++i) {
- distanceFields.append(QDistanceField(m_referenceFont,
+ GlyphData &gd = glyphData(m_pendingGlyphs.at(i));
+ distanceFields.append(QDistanceField(gd.path,
m_pendingGlyphs.at(i),
m_doubleGlyphResolution));
+ gd.path = QPainterPath(); // no longer needed, so release memory used by the painter path
}
qint64 renderTime = 0;
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index e5923fc564..1253711a94 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -323,6 +323,7 @@ protected:
Texture *texture;
TexCoord texCoord;
QRectF boundingRect;
+ QPainterPath path;
quint32 ref;
GlyphData() : texture(0), ref(0) { }
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
index 9ef0d50dfc..136f23f339 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
@@ -47,6 +47,7 @@
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlUseGlyphCacheWorkaround, QML_USE_GLYPHCACHE_WORKAROUND)
+DEFINE_BOOL_CONFIG_OPTION(qsgPreferFullSizeGlyphCacheTextures, QSG_PREFER_FULLSIZE_GLYPHCACHE_TEXTURES)
#if !defined(QSG_DEFAULT_DISTANCEFIELD_GLYPH_CACHE_PADDING)
# define QSG_DEFAULT_DISTANCEFIELD_GLYPH_CACHE_PADDING 2
@@ -145,7 +146,10 @@ void QSGDefaultDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyph
void QSGDefaultDistanceFieldGlyphCache::storeGlyphs(const QList<QDistanceField> &glyphs)
{
- QHash<TextureInfo *, QVector<glyph_t> > glyphTextures;
+ typedef QHash<TextureInfo *, QVector<glyph_t> > GlyphTextureHash;
+ typedef GlyphTextureHash::const_iterator GlyphTextureHashConstIt;
+
+ GlyphTextureHash glyphTextures;
GLint alignment = 4; // default value
m_funcs->glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
@@ -202,8 +206,7 @@ void QSGDefaultDistanceFieldGlyphCache::storeGlyphs(const QList<QDistanceField>
// restore to previous alignment
m_funcs->glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
- QHash<TextureInfo *, QVector<glyph_t> >::const_iterator i;
- for (i = glyphTextures.constBegin(); i != glyphTextures.constEnd(); ++i) {
+ for (GlyphTextureHashConstIt i = glyphTextures.constBegin(), cend = glyphTextures.constEnd(); i != cend; ++i) {
Texture t;
t.textureId = i.key()->texture;
t.size = i.key()->size;
@@ -491,6 +494,11 @@ bool QSGDefaultDistanceFieldGlyphCache::useTextureUploadWorkaround() const
return useWorkaround;
}
+bool QSGDefaultDistanceFieldGlyphCache::createFullSizeTextures() const
+{
+ return qsgPreferFullSizeGlyphCacheTextures() && glyphCount() > QT_DISTANCEFIELD_HIGHGLYPHCOUNT;
+}
+
int QSGDefaultDistanceFieldGlyphCache::maxTextureSize() const
{
if (!m_maxTextureSize)
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
index 3b64eadc6f..cffe02330a 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
@@ -62,6 +62,7 @@ public:
bool useTextureResizeWorkaround() const;
bool useTextureUploadWorkaround() const;
+ bool createFullSizeTextures() const;
int maxTextureSize() const;
void setMaxTextureCount(int max) { m_maxTextureCount = max; }
@@ -75,7 +76,7 @@ private:
QDistanceField image;
int padding;
- TextureInfo() : texture(0), padding(-1)
+ TextureInfo(const QRect &preallocRect = QRect()) : texture(0), allocatedArea(preallocRect), padding(-1)
{ }
};
@@ -84,8 +85,12 @@ private:
TextureInfo *textureInfo(int index)
{
- for (int i = m_textures.count(); i <= index; ++i)
- m_textures.append(TextureInfo());
+ for (int i = m_textures.count(); i <= index; ++i) {
+ if (createFullSizeTextures())
+ m_textures.append(QRect(0, 0, maxTextureSize(), maxTextureSize()));
+ else
+ m_textures.append(TextureInfo());
+ }
return &m_textures[index];
}
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index d70dc7bdaa..ffee43852d 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -53,6 +53,10 @@ QT_BEGIN_NAMESPACE
#define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif
+#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE
+#define GL_FRAMEBUFFER_SRGB_CAPABLE 0x8DBA
+#endif
+
static inline QVector4D qsg_premultiply(const QVector4D &c, float globalOpacity)
{
float o = c.w() * globalOpacity;
@@ -199,7 +203,11 @@ void QSG24BitTextMaskShader::initialize()
if (QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_ARB_framebuffer_sRGB"))
&& m_glyphFormat == QFontEngine::Format_A32
&& qAbs(fontSmoothingGamma() - 2.2) < 0.25) {
- m_useSRGB = true;
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ GLint srgbCapable = 0;
+ funcs->glGetIntegerv(GL_FRAMEBUFFER_SRGB_CAPABLE, &srgbCapable);
+ if (srgbCapable)
+ m_useSRGB = true;
}
}
diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
index e921e63fcb..f1cc9d1a86 100644
--- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
@@ -251,6 +251,8 @@ QSGSharedDistanceFieldGlyphCache::~QSGSharedDistanceFieldGlyphCache()
void QSGSharedDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyphs)
{
+ typedef QSet<glyph_t>::const_iterator GlyphSetConstIt;
+
QMutexLocker locker(&m_pendingGlyphsMutex);
#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG)
@@ -264,8 +266,7 @@ void QSGSharedDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyphs
QVector<quint32> glyphsVector;
glyphsVector.reserve(glyphs.size());
- QSet<glyph_t>::const_iterator it;
- for (it = glyphs.constBegin(); it != glyphs.constEnd(); ++it) {
+ for (GlyphSetConstIt it = glyphs.constBegin(), cend = glyphs.constEnd(); it != cend; ++it) {
Q_ASSERT(!m_bufferForGlyph.contains(*it));
glyphsVector.append(*it);
}
@@ -335,6 +336,8 @@ void QSGSharedDistanceFieldGlyphCache::referenceGlyphs(const QSet<glyph_t> &glyp
void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs)
{
+ typedef QSet<glyph_t>::const_iterator GlyphSetConstIt;
+
#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG)
qDebug("QSGSharedDistanceFieldGlyphCache::releaseGlyphs() called for %s (%d glyphs)",
m_cacheId.constData(), glyphs.size());
@@ -345,8 +348,7 @@ void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs
QVector<quint32> glyphsVector;
glyphsVector.reserve(glyphs.size());
- QSet<glyph_t>::const_iterator glyphsIt;
- for (glyphsIt = glyphs.constBegin(); glyphsIt != glyphs.constEnd(); ++glyphsIt) {
+ for (GlyphSetConstIt glyphsIt = glyphs.constBegin(), cend = glyphs.constEnd(); glyphsIt != cend; ++glyphsIt) {
QHash<glyph_t, void *>::iterator bufferIt = m_bufferForGlyph.find(*glyphsIt);
if (bufferIt != m_bufferForGlyph.end()) {
void *buffer = bufferIt.value();
diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
index 22d52878ae..5d2260923b 100644
--- a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
+++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
@@ -151,7 +151,7 @@ void QSGDefaultDepthStencilBuffer::free()
QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager()
{
- for (Hash::const_iterator it = m_buffers.constBegin(); it != m_buffers.constEnd(); ++it) {
+ for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend; ++it) {
QSGDepthStencilBuffer *buffer = it.value().data();
buffer->free();
buffer->m_manager = 0;
diff --git a/src/quick/scenegraph/util/qsgsimplerectnode.cpp b/src/quick/scenegraph/util/qsgsimplerectnode.cpp
index 1ee2dbee81..17aeb515a1 100644
--- a/src/quick/scenegraph/util/qsgsimplerectnode.cpp
+++ b/src/quick/scenegraph/util/qsgsimplerectnode.cpp
@@ -41,6 +41,7 @@ QT_BEGIN_NAMESPACE
\brief The QSGSimpleRectNode class is a convenience class for drawing
solid filled rectangles using scenegraph.
+ \inmodule QtQuick
*/
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index 91d2c8674d..c89ad7a608 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -35,6 +35,7 @@
#include <qopenglfunctions.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <qthread.h>
+#include <qmath.h>
#include <private/qquickprofiler_p.h>
#include <private/qqmlglobal_p.h>
#include <QtGui/qguiapplication.h>
@@ -75,13 +76,11 @@ static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty();
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DEBUG
inline static bool isPowerOfTwo(int x)
{
// Assumption: x >= 1
return x == (x & -x);
}
-#endif
QSGTexturePrivate::QSGTexturePrivate()
: wrapChanged(false)
@@ -688,6 +687,16 @@ void QSGPlainTexture::bind()
m_texture_size = tmp.size();
}
+ // Scale to a power of two size if mipmapping is requested and the
+ // texture is npot and npot textures are not properly supported.
+ if (mipmapFiltering() != QSGTexture::None
+ && (!isPowerOfTwo(m_texture_size.width()) || !isPowerOfTwo(m_texture_size.height()))
+ && !funcs->hasOpenGLFeature(QOpenGLFunctions::NPOTTextures)) {
+ tmp = tmp.scaled(qNextPowerOfTwo(m_texture_size.width()), qNextPowerOfTwo(m_texture_size.height()),
+ Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ m_texture_size = tmp.size();
+ }
+
if (tmp.width() * 4 != tmp.bytesPerLine())
tmp = tmp.copy();
diff --git a/src/quick/scenegraph/util/qsgtextureprovider.cpp b/src/quick/scenegraph/util/qsgtextureprovider.cpp
index 76328215d4..b9f9bde476 100644
--- a/src/quick/scenegraph/util/qsgtextureprovider.cpp
+++ b/src/quick/scenegraph/util/qsgtextureprovider.cpp
@@ -38,6 +38,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QSGTextureProvider
\brief The QSGTextureProvider class encapsulates texture based entities in QML.
+ \inmodule QtQuick
The QSGTextureProvider lives primarily in the scene graph rendering thread.
diff --git a/src/quick/util/qquickfontmetrics.cpp b/src/quick/util/qquickfontmetrics.cpp
index 1d357ac11f..a87ec7d60a 100644
--- a/src/quick/util/qquickfontmetrics.cpp
+++ b/src/quick/util/qquickfontmetrics.cpp
@@ -277,7 +277,7 @@ qreal QQuickFontMetrics::lineWidth() const
\l {QQuickTextMetrics::advanceWidth}{advanceWidth} property of
\l {QQuickTextMetrics::advanceWidth}{TextMetrics}.
- \sa {QFontMetricsF::width()}, height()
+ \sa {QFontMetricsF::width()}, {QFontMetricsF::height()}
*/
qreal QQuickFontMetrics::advanceWidth(const QString &text) const
{
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index fe7334a513..a231209cd0 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -184,7 +184,8 @@ QImage QQuickTextureFactory::image() const
{
...
- QQmlEngine engine;
+ QQuickView view;
+ QQmlEngine *engine = view.engine();
engine->addImageProvider(QLatin1String("colors"), new ColorPixmapProvider);
...
diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp
index 55011f5a46..71dacfcb1d 100644
--- a/src/quick/util/qquicksmoothedanimation.cpp
+++ b/src/quick/util/qquicksmoothedanimation.cpp
@@ -378,11 +378,11 @@ QQuickSmoothedAnimationPrivate::QQuickSmoothedAnimationPrivate()
QQuickSmoothedAnimationPrivate::~QQuickSmoothedAnimationPrivate()
{
+ typedef QHash<QQmlProperty, QSmoothedAnimation* >::iterator ActiveAnimationsHashIt;
+
delete anim;
- QHash<QQmlProperty, QSmoothedAnimation* >::iterator it;
- for (it = activeAnimations.begin(); it != activeAnimations.end(); ++it) {
+ for (ActiveAnimationsHashIt it = activeAnimations.begin(), end = activeAnimations.end(); it != end; ++it)
it.value()->clearTemplate();
- }
}
void QQuickSmoothedAnimationPrivate::updateRunningAnimations()
diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp
index f2eee6a802..b68afbecdd 100644
--- a/src/quick/util/qquickspringanimation.cpp
+++ b/src/quick/util/qquickspringanimation.cpp
@@ -86,6 +86,7 @@ public:
bool haveModulus : 1;
bool skipUpdate : 1;
typedef QHash<QQmlProperty, QSpringAnimation*> ActiveAnimationHash;
+ typedef ActiveAnimationHash::Iterator ActiveAnimationHashIt;
void clearTemplate() { animationTemplate = 0; }
@@ -161,14 +162,12 @@ QSpringAnimation::~QSpringAnimation()
{
if (animationTemplate) {
if (target.object()) {
- QSpringAnimation::ActiveAnimationHash::iterator it =
- animationTemplate->activeAnimations.find(target);
+ ActiveAnimationHashIt it = animationTemplate->activeAnimations.find(target);
if (it != animationTemplate->activeAnimations.end() && it.value() == this)
animationTemplate->activeAnimations.erase(it);
} else {
//target is no longer valid, need to search linearly
- QSpringAnimation::ActiveAnimationHash::iterator it;
- for (it = animationTemplate->activeAnimations.begin(); it != animationTemplate->activeAnimations.end(); ++it) {
+ for (ActiveAnimationHashIt it = animationTemplate->activeAnimations.begin(); it != animationTemplate->activeAnimations.end(); ++it) {
if (it.value() == this) {
animationTemplate->activeAnimations.erase(it);
break;
@@ -329,8 +328,7 @@ void QQuickSpringAnimationPrivate::updateMode()
mode = QSpringAnimation::Spring;
else {
mode = QSpringAnimation::Velocity;
- QSpringAnimation::ActiveAnimationHash::iterator it;
- for (it = activeAnimations.begin(); it != activeAnimations.end(); ++it) {
+ for (QSpringAnimation::ActiveAnimationHashIt it = activeAnimations.begin(), end = activeAnimations.end(); it != end; ++it) {
QSpringAnimation *animation = *it;
animation->startTime = animation->lastTime;
qreal dist = qAbs(animation->currentValue - animation->to);
@@ -378,10 +376,8 @@ QQuickSpringAnimation::QQuickSpringAnimation(QObject *parent)
QQuickSpringAnimation::~QQuickSpringAnimation()
{
Q_D(QQuickSpringAnimation);
- QSpringAnimation::ActiveAnimationHash::iterator it;
- for (it = d->activeAnimations.begin(); it != d->activeAnimations.end(); ++it) {
+ for (QSpringAnimation::ActiveAnimationHashIt it = d->activeAnimations.begin(), end = d->activeAnimations.end(); it != end; ++it)
it.value()->clearTemplate();
- }
}
/*!
diff --git a/src/quick/util/qquicktextmetrics.cpp b/src/quick/util/qquicktextmetrics.cpp
index a0b8ecaa6e..1dd787f4a5 100644
--- a/src/quick/util/qquicktextmetrics.cpp
+++ b/src/quick/util/qquicktextmetrics.cpp
@@ -131,7 +131,7 @@ void QQuickTextMetrics::setText(const QString &text)
\li \c Qt::ElideRight - For example: "Hello..."
\endlist
- \sa elideWidth, elidedText
+ \sa elideWidth, QFontMetrics::elidedText
*/
Qt::TextElideMode QQuickTextMetrics::elide() const
{
@@ -153,7 +153,7 @@ void QQuickTextMetrics::setElide(Qt::TextElideMode elide)
This property holds the largest width the text can have (in pixels) before
eliding will occur.
- \sa elide, elidedText
+ \sa elide, QFontMetrics::elidedText
*/
qreal QQuickTextMetrics::elideWidth() const
{
diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp
index 04b66800d2..8cd9b349d8 100644
--- a/src/quick/util/qquicktimeline.cpp
+++ b/src/quick/util/qquicktimeline.cpp
@@ -659,7 +659,7 @@ void QQuickTimeLine::complete()
*/
void QQuickTimeLine::clear()
{
- for (QQuickTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
+ for (QQuickTimeLinePrivate::Ops::const_iterator iter = d->ops.begin(), cend = d->ops.end(); iter != cend; ++iter)
iter.key()->_t = 0;
d->ops.clear();
d->length = 0;
@@ -735,9 +735,9 @@ int QQuickTimeLinePrivate::advance(int t)
pauseTime = -1;
// Minimal advance time
int advanceTime = t;
- for (Ops::Iterator iter = ops.begin(); iter != ops.end(); ++iter) {
- TimeLine &tl = *iter;
- Op &op = tl.ops.first();
+ for (Ops::const_iterator iter = ops.constBegin(), cend = ops.constEnd(); iter != cend; ++iter) {
+ const TimeLine &tl = *iter;
+ const Op &op = tl.ops.first();
int length = op.length - tl.consumedOpLength;
if (length < advanceTime) {