aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-30 10:42:34 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2018-02-02 15:59:32 +0100
commita9a9fa0c4737017aa4fc72b467eb45645d0912f0 (patch)
tree4753218705648384e6555be0e2bf3165bfb391d9 /src/quick
parenteace041161a03a849d3896af65493b7885cecc04 (diff)
parente6d4df156e9aec62054740dc99ab8ba2855eaafc (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp src/qml/compiler/qqmlirbuilder.cpp src/qml/compiler/qqmlirbuilder_p.h src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4compilercontext_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4jsir.cpp src/qml/compiler/qv4jsir_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtimecodegen.cpp src/qml/jsruntime/qv4script.cpp src/qml/jsruntime/qv4script_p.h src/qml/qml/qqmltypeloader.cpp src/quick/items/qquickanimatedimage.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp tests/auto/qml/qmlplugindump/qmlplugindump.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp tools/qmljs/qmljs.cpp Done-with: Shawn Rutledge <shawn.rutledge@qt.io> Done-with: Lars Knoll <lars.knoll@qt.io> Done-with: Ulf Hermann <ulf.hermann@qt.io> Change-Id: I010e6525440a85f3b9a10bb9083f8e4352751b1d
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc53
-rw-r--r--src/quick/doc/src/qtquick.qdoc3
-rw-r--r--src/quick/items/qquickanimatedimage.cpp120
-rw-r--r--src/quick/items/qquickanimatedimage_p_p.h21
-rw-r--r--src/quick/items/qquickflickable.cpp14
-rw-r--r--src/quick/items/qquickflickable_p_p.h4
-rw-r--r--src/quick/items/qquickframebufferobject.cpp1
-rw-r--r--src/quick/items/qquickgridview.cpp14
-rw-r--r--src/quick/items/qquickitem.cpp35
-rw-r--r--src/quick/items/qquickitem_p.h3
-rw-r--r--src/quick/items/qquickitemsmodule.cpp6
-rw-r--r--src/quick/items/qquickitemview.cpp76
-rw-r--r--src/quick/items/qquickitemviewtransition_p.h18
-rw-r--r--src/quick/items/qquicklistview.cpp3
-rw-r--r--src/quick/items/qquickloader.cpp2
-rw-r--r--src/quick/items/qquickrepeater.cpp5
-rw-r--r--src/quick/items/qquickwindow.cpp56
-rw-r--r--src/quick/items/qquickwindow.h6
-rw-r--r--src/quick/items/qquickwindowmodule.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp10
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h4
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp3
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp2
-rw-r--r--src/quick/util/qquickanimationcontroller.cpp2
-rw-r--r--src/quick/util/qquickpropertychanges.cpp33
-rw-r--r--src/quick/util/qquickshortcut.cpp3
-rw-r--r--src/quick/util/qquickstate.cpp5
-rw-r--r--src/quick/util/qquickstate_p.h4
-rw-r--r--src/quick/util/qquicktransition.cpp29
-rw-r--r--src/quick/util/qquicktransition_p.h15
31 files changed, 331 insertions, 223 deletions
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
index 27576d488c..99175ab94e 100644
--- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -176,8 +176,8 @@ attach application code. This can be used to add custom scene graph
content or render raw OpenGL content. The integration points are
defined by the render loop.
-For detailed description of how the scene graph renderer works, see
-\l {Qt Quick Scene Graph Renderer}.
+For detailed description of how the scene graph renderer for OpenGL
+works, see \l {Qt Quick Scene Graph OpenGL Renderer}.
There are three render loop variants available: \c basic, \c windows,
and \c threaded. Out of these, \c basic and \c windows are
@@ -413,10 +413,11 @@ with multiple windows.
*/
/*!
- \title Qt Quick Scene Graph Renderer
+ \title Qt Quick Scene Graph OpenGL Renderer
\page qtquick-visualcanvas-scenegraph-renderer.html
- This document explains how the scene graph renderer works internally
+ This document explains how the scene graph renderer for OpenGL
+ works internally
so that one can write code that uses it in an optimal fashion, both
performance-wise and feature-wise.
@@ -428,7 +429,7 @@ with multiple windows.
\note Even in the case where every frame is unique and everything is
uploaded from scratch, the default renderer will perform well.
- The Qt Quick items in a QML scene populates a tree of QSGNode
+ The Qt Quick items in a QML scene populate a tree of QSGNode
instances. Once created, this tree is a complete description of how
a certain frame should be rendered. It does not contain any
references back to the Qt Quick items at all and will on most
@@ -441,11 +442,11 @@ with multiple windows.
If needed, the renderer can be completely replaced using the
internal scene graph back-end API. This is mostly interesting for
platform vendors who wish to take advantage of non-standard hardware
- features. For majority of use cases, the default renderer will be
+ features. For the majority of use cases, the default renderer will be
sufficient.
The default renderer focuses on two primary strategies to optimize
- the rendering. Batching of draw calls and retention of geometry on
+ the rendering: Batching of draw calls, and retention of geometry on
the GPU.
\section1 Batching
@@ -458,7 +459,7 @@ with multiple windows.
\image visualcanvas_list.png
- The simplest way of drawing this list is on a cell-by-cell basis. First
+ The simplest way of drawing this list is on a cell-by-cell basis. First,
the background is drawn. This is a rectangle of a specific color. In
OpenGL terms this means selecting a shader program to do solid color
fills, setting up the fill color, setting the transformation matrix
@@ -495,8 +496,8 @@ with multiple windows.
batches. From Qt Quick core item set, this includes Rectangle items
with opaque colors and fully opaque images, such as JPEGs or BMPs.
- Another benefit of using opaque primitives, is that opaque
- primitives does not require \c GL_BLEND to be enabled which can be
+ Another benefit of using opaque primitives is that opaque
+ primitives do not require \c GL_BLEND to be enabled, which can be
quite costly, especially on mobile and embedded GPUs.
Opaque primitives are rendered in a front-to-back manner with
@@ -533,7 +534,7 @@ with multiple windows.
and the two text elements in another call, as the texts only overlap
a background which they are stacked in front of. In the right-most
case, the background of "Item 4" overlaps the text of "Item 3" so in
- this case, each of backgrounds and texts need to be drawn using
+ this case, each of backgrounds and texts needs to be drawn using
separate calls.
Z-wise, the alpha primitives are interleaved with the opaque nodes
@@ -550,7 +551,7 @@ with multiple windows.
The renderer modifies the vertex shader returned from
QSGMaterialShader::vertexShader() and compresses the z values of the
- vertex after the model-view and projection matrices has been applied
+ vertex after the model-view and projection matrices have been applied
and then adds a small translation on the z to position it the
correct z position.
@@ -561,7 +562,7 @@ with multiple windows.
The active texture is a unique OpenGL state, which means that
multiple primitives using different OpenGL textures cannot be
- batched. The Qt Quick scene graph for this reason allows multiple
+ batched. The Qt Quick scene graph, for this reason, allows multiple
QSGTexture instances to be allocated as smaller sub-regions of a
larger texture; a texture atlas.
@@ -603,10 +604,10 @@ with multiple windows.
Each Qt Quick Item inserts a QSGTransformNode into the scene graph
tree to manage its x, y, scale or rotation. Child items will be
populated under this transform node. The default renderer tracks
- the state of transform nodes between frames, and will look at
+ the state of transform nodes between frames and will look at
subtrees to decide if a transform node is a good candidate to become
a root for a set of batches. A transform node which changes between
- frames and which has a fairly complex subtree, can become a batch
+ frames and which has a fairly complex subtree can become a batch
root.
QSGGeometryNodes in the subtree of a batch root are pre-transformed
@@ -621,7 +622,7 @@ with multiple windows.
removed nodes when panning through a grid or list.
Another benefit of identifying transform nodes as batch roots is
- that it allows the renderer to retain the parts of the tree that has
+ that it allows the renderer to retain the parts of the tree that have
not changed. For instance, say a UI consists of a list and a button
row. When the list is being scrolled and delegates are being added
and removed, the rest of the UI, the button row, is unchanged and
@@ -684,7 +685,7 @@ with multiple windows.
to either \c vertex or \c {msaa}.
Vertex antialiasing can produce seams between edges of adjacent
- primitives, even when the two edges are mathmatically the same.
+ primitives, even when the two edges are mathematically the same.
Multisample antialiasing does not.
@@ -722,7 +723,7 @@ with multiple windows.
job when creating batches and can rely on early-z to avoid overdraw.
When multisample antialiasing is used, content rendered into
- framebuffer objects, need additional extensions to support multisampling
+ framebuffer objects need additional extensions to support multisampling
of framebuffers. Typically \c GL_EXT_framebuffer_multisample and
\c GL_EXT_framebuffer_blit. Most desktop chips have these extensions
present, but they are less common in embedded chips. When framebuffer
@@ -736,7 +737,7 @@ with multiple windows.
As stated in the beginning, understanding the finer details of the
renderer is not required to get good performance. It is written to
optimize for common use cases and will perform quite well under
- almost any circumstance.
+ almost any circumstances.
\list
@@ -744,7 +745,7 @@ with multiple windows.
as possible of the geometry being uploaded again and again. By
setting the environment variable \c {QSG_RENDERER_DEBUG=render}, the
renderer will output statistics on how well the batching goes, how
- many batches, which batches are retained and which are opaque and
+ many batches are used, which batches are retained and which are opaque and
not. When striving for optimal performance, uploads should happen
only when really needed, batches should be fewer than 10 and at
least 3-4 of them should be opaque.
@@ -772,16 +773,16 @@ with multiple windows.
QQuickWindow::createTextureFromImage(), let the image have
QImage::Format_RGB32, when possible.
- \li Be aware of that overlapping compond items, like in the
- illustration above, can not be batched.
+ \li Be aware of that overlapping compound items, like in the
+ illustration above, cannot be batched.
\li Clipping breaks batching. Never use on a per-item basis, inside
- tables cells, item delegates or similar. Instead of clipping text,
+ table cells, item delegates or similar. Instead of clipping text,
use eliding. Instead of clipping an image, create a
QQuickImageProvider that returns a cropped image.
\li Batching only works for 16-bit indices. All built-in items use
- 16-bit indices, but custom geometry is free to also use 32-bit
+ 16-bit indices, but a custom geometry is free to also use 32-bit
indices.
\li Some material flags prevent batching, the most limiting one
@@ -792,7 +793,7 @@ with multiple windows.
QQuickWindow::setColor() will be used in a call to \c glClear(),
which is potentially faster.
- \li Mipmapped Image items are not placed in global atlas and will
+ \li Mipmapped Image items are not placed in the global atlas and will
not be batched.
\endlist
diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc
index e2d4f16dae..ece66cb589 100644
--- a/src/quick/doc/src/qtquick.qdoc
+++ b/src/quick/doc/src/qtquick.qdoc
@@ -89,7 +89,8 @@ To find out more about using the QML language, see the \l{Qt QML} module documen
\section1 Licenses and Attributions
Qt Quick is available under commercial licenses from \l{The Qt Company}.
-In addition, it is available under the
+In addition, it is available under free software licenses. Since Qt 5.4,
+these free software licenses are
\l{GNU Lesser General Public License, version 3}, or
the \l{GNU General Public License, version 2}.
See \l{Qt Licensing} for further details.
diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp
index 4180714f86..5c9f893b63 100644
--- a/src/quick/items/qquickanimatedimage.cpp
+++ b/src/quick/items/qquickanimatedimage.cpp
@@ -54,26 +54,26 @@ QT_BEGIN_NAMESPACE
QQuickPixmap* QQuickAnimatedImagePrivate::infoForCurrentFrame(QQmlEngine *engine)
{
- if (!_movie)
+ if (!movie)
return 0;
- int current = _movie->currentFrameNumber();
+ int current = movie->currentFrameNumber();
if (!frameMap.contains(current)) {
QUrl requestedUrl;
QQuickPixmap *pixmap = 0;
- if (engine && !_movie->fileName().isEmpty()) {
+ if (engine && !movie->fileName().isEmpty()) {
requestedUrl.setUrl(QString::fromUtf8("quickanimatedimage://%1#%2")
- .arg(_movie->fileName())
+ .arg(movie->fileName())
.arg(current));
}
if (!requestedUrl.isEmpty()) {
if (QQuickPixmap::isCached(requestedUrl, QSize(), QQuickImageProviderOptions()))
pixmap = new QQuickPixmap(engine, requestedUrl);
else
- pixmap = new QQuickPixmap(requestedUrl, _movie->currentImage());
+ pixmap = new QQuickPixmap(requestedUrl, movie->currentImage());
} else {
pixmap = new QQuickPixmap;
- pixmap->setImage(_movie->currentImage());
+ pixmap->setImage(movie->currentImage());
}
frameMap.insert(current, pixmap);
}
@@ -138,7 +138,7 @@ QQuickPixmap* QQuickAnimatedImagePrivate::infoForCurrentFrame(QQmlEngine *engine
QQuickAnimatedImage::QQuickAnimatedImage(QQuickItem *parent)
: QQuickImage(*(new QQuickAnimatedImagePrivate), parent)
{
- QObject::connect(this, &QQuickImageBase::cacheChanged, this, &QQuickAnimatedImage::onCacheChanged);
+ connect(this, &QQuickImageBase::cacheChanged, this, &QQuickAnimatedImage::onCacheChanged);
}
QQuickAnimatedImage::~QQuickAnimatedImage()
@@ -148,7 +148,7 @@ QQuickAnimatedImage::~QQuickAnimatedImage()
if (d->reply)
d->reply->deleteLater();
#endif
- delete d->_movie;
+ delete d->movie;
qDeleteAll(d->frameMap);
d->frameMap.clear();
}
@@ -164,9 +164,9 @@ QQuickAnimatedImage::~QQuickAnimatedImage()
bool QQuickAnimatedImage::isPaused() const
{
Q_D(const QQuickAnimatedImage);
- if (!d->_movie)
+ if (!d->movie)
return d->paused;
- return d->_movie->state()==QMovie::Paused;
+ return d->movie->state()==QMovie::Paused;
}
void QQuickAnimatedImage::setPaused(bool pause)
@@ -174,11 +174,11 @@ void QQuickAnimatedImage::setPaused(bool pause)
Q_D(QQuickAnimatedImage);
if (pause == d->paused)
return;
- if (!d->_movie) {
+ if (!d->movie) {
d->paused = pause;
emit pausedChanged();
} else {
- d->_movie->setPaused(pause);
+ d->movie->setPaused(pause);
}
}
@@ -203,9 +203,9 @@ void QQuickAnimatedImage::setPaused(bool pause)
bool QQuickAnimatedImage::isPlaying() const
{
Q_D(const QQuickAnimatedImage);
- if (!d->_movie)
+ if (!d->movie)
return d->playing;
- return d->_movie->state()!=QMovie::NotRunning;
+ return d->movie->state()!=QMovie::NotRunning;
}
void QQuickAnimatedImage::setPlaying(bool play)
@@ -213,15 +213,15 @@ void QQuickAnimatedImage::setPlaying(bool play)
Q_D(QQuickAnimatedImage);
if (play == d->playing)
return;
- if (!d->_movie) {
+ if (!d->movie) {
d->playing = play;
emit playingChanged();
return;
}
if (play)
- d->_movie->start();
+ d->movie->start();
else
- d->_movie->stop();
+ d->movie->stop();
}
/*!
@@ -237,27 +237,27 @@ void QQuickAnimatedImage::setPlaying(bool play)
int QQuickAnimatedImage::currentFrame() const
{
Q_D(const QQuickAnimatedImage);
- if (!d->_movie)
- return d->preset_currentframe;
- return d->_movie->currentFrameNumber();
+ if (!d->movie)
+ return d->presetCurrentFrame;
+ return d->movie->currentFrameNumber();
}
void QQuickAnimatedImage::setCurrentFrame(int frame)
{
Q_D(QQuickAnimatedImage);
- if (!d->_movie) {
- d->preset_currentframe = frame;
+ if (!d->movie) {
+ d->presetCurrentFrame = frame;
return;
}
- d->_movie->jumpToFrame(frame);
+ d->movie->jumpToFrame(frame);
}
int QQuickAnimatedImage::frameCount() const
{
Q_D(const QQuickAnimatedImage);
- if (!d->_movie)
+ if (!d->movie)
return 0;
- return d->_movie->frameCount();
+ return d->movie->frameCount();
}
/*!
@@ -280,8 +280,8 @@ void QQuickAnimatedImage::setSpeed(qreal speed)
Q_D(QQuickAnimatedImage);
if (d->speed != speed) {
d->speed = speed;
- if (d->_movie)
- d->_movie->setSpeed(qRound(speed * 100.0));
+ if (d->movie)
+ d->movie->setSpeed(qRound(speed * 100.0));
emit speedChanged();
}
}
@@ -304,10 +304,7 @@ void QQuickAnimatedImage::setSource(const QUrl &url)
d->frameMap.clear();
d->oldPlaying = isPlaying();
- if (d->_movie) {
- d->setMovie(nullptr);
- }
-
+ d->setMovie(nullptr);
d->url = url;
emit sourceChanged(d->url);
@@ -361,10 +358,8 @@ void QQuickAnimatedImage::load()
req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
d->reply = qmlEngine(this)->networkAccessManager()->get(req);
- QObject::connect(d->reply, SIGNAL(finished()),
- this, SLOT(movieRequestFinished()));
- QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)),
- this, SLOT(requestProgress(qint64,qint64)));
+ connect(d->reply, &QNetworkReply::finished, this, &QQuickAnimatedImage::movieRequestFinished);
+ connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(requestProgress(qint64,qint64)));
#endif
}
}
@@ -395,7 +390,7 @@ void QQuickAnimatedImage::movieRequestFinished()
}
#endif
- if (!d->_movie || !d->_movie->isValid()) {
+ if (!d->movie || !d->movie->isValid()) {
qmlWarning(this) << "Error Reading Animated Image File " << d->url.toString();
d->setMovie(nullptr);
d->setImage(QImage());
@@ -416,13 +411,11 @@ void QQuickAnimatedImage::movieRequestFinished()
return;
}
- connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)),
- this, SLOT(playingStatusChanged()));
- connect(d->_movie, SIGNAL(frameChanged(int)),
- this, SLOT(movieUpdate()));
+ connect(d->movie, &QMovie::stateChanged, this, &QQuickAnimatedImage::playingStatusChanged);
+ connect(d->movie, &QMovie::frameChanged, this, &QQuickAnimatedImage::movieUpdate);
if (d->cache)
- d->_movie->setCacheMode(QMovie::CacheAll);
- d->_movie->setSpeed(qRound(d->speed * 100.0));
+ d->movie->setCacheMode(QMovie::CacheAll);
+ d->movie->setSpeed(qRound(d->speed * 100.0));
d->status = Ready;
emit statusChanged(d->status);
@@ -433,22 +426,21 @@ void QQuickAnimatedImage::movieRequestFinished()
}
bool pausedAtStart = d->paused;
- if (d->playing) {
- d->_movie->start();
- }
+ if (d->playing)
+ d->movie->start();
if (pausedAtStart)
- d->_movie->setPaused(true);
+ d->movie->setPaused(true);
if (d->paused || !d->playing) {
- d->_movie->jumpToFrame(d->preset_currentframe);
- d->preset_currentframe = 0;
+ d->movie->jumpToFrame(d->presetCurrentFrame);
+ d->presetCurrentFrame = 0;
}
d->setPixmap(*d->infoForCurrentFrame(qmlEngine(this)));
if (isPlaying() != d->oldPlaying)
emit playingChanged();
- if (d->_movie)
- d->currentSourceSize = d->_movie->currentPixmap().size();
+ if (d->movie)
+ d->currentSourceSize = d->movie->currentPixmap().size();
else
d->currentSourceSize = QSize(0, 0);
@@ -467,7 +459,7 @@ void QQuickAnimatedImage::movieUpdate()
d->frameMap.clear();
}
- if (d->_movie) {
+ if (d->movie) {
d->setPixmap(*d->infoForCurrentFrame(qmlEngine(this)));
emit frameChanged();
}
@@ -477,12 +469,12 @@ void QQuickAnimatedImage::playingStatusChanged()
{
Q_D(QQuickAnimatedImage);
- if ((d->_movie->state() != QMovie::NotRunning) != d->playing) {
- d->playing = (d->_movie->state() != QMovie::NotRunning);
+ if ((d->movie->state() != QMovie::NotRunning) != d->playing) {
+ d->playing = (d->movie->state() != QMovie::NotRunning);
emit playingChanged();
}
- if ((d->_movie->state() == QMovie::Paused) != d->paused) {
- d->paused = (d->_movie->state() == QMovie::Paused);
+ if ((d->movie->state() == QMovie::Paused) != d->paused) {
+ d->paused = (d->movie->state() == QMovie::Paused);
emit pausedChanged();
}
}
@@ -493,13 +485,11 @@ void QQuickAnimatedImage::onCacheChanged()
if (!cache()) {
qDeleteAll(d->frameMap);
d->frameMap.clear();
- if (d->_movie) {
- d->_movie->setCacheMode(QMovie::CacheNone);
- }
+ if (d->movie)
+ d->movie->setCacheMode(QMovie::CacheNone);
} else {
- if (d->_movie) {
- d->_movie->setCacheMode(QMovie::CacheAll);
- }
+ if (d->movie)
+ d->movie->setCacheMode(QMovie::CacheAll);
}
}
@@ -515,13 +505,15 @@ void QQuickAnimatedImage::componentComplete()
load();
}
-void QQuickAnimatedImagePrivate::setMovie(QMovie *movie)
+void QQuickAnimatedImagePrivate::setMovie(QMovie *m)
{
+ if (movie == m)
+ return;
Q_Q(QQuickAnimatedImage);
const int oldFrameCount = q->frameCount();
- delete _movie;
- _movie = movie;
+ delete movie;
+ movie = m;
if (oldFrameCount != q->frameCount())
emit q->frameCountChanged();
diff --git a/src/quick/items/qquickanimatedimage_p_p.h b/src/quick/items/qquickanimatedimage_p_p.h
index ef30c39fed..1a74f67424 100644
--- a/src/quick/items/qquickanimatedimage_p_p.h
+++ b/src/quick/items/qquickanimatedimage_p_p.h
@@ -70,29 +70,30 @@ class QQuickAnimatedImagePrivate : public QQuickImagePrivate
public:
QQuickAnimatedImagePrivate()
- : playing(true), paused(false), speed(1.0), preset_currentframe(0), _movie(0), oldPlaying(false)
+ : playing(true), paused(false), oldPlaying(false), padding(0)
+ , presetCurrentFrame(0), speed(1.0), currentSourceSize(0, 0), movie(nullptr)
#if QT_CONFIG(qml_network)
- , reply(0), redirectCount(0)
+ , reply(nullptr), redirectCount(0)
#endif
- , currentSourceSize(0, 0)
{
}
QQuickPixmap *infoForCurrentFrame(QQmlEngine *engine);
+ void setMovie(QMovie *movie);
- bool playing;
- bool paused;
+ bool playing : 1;
+ bool paused : 1;
+ bool oldPlaying : 1;
+ unsigned padding: 29;
+ int presetCurrentFrame;
qreal speed;
- int preset_currentframe;
- QMovie *_movie;
- bool oldPlaying;
+ QSize currentSourceSize;
+ QMovie *movie;
#if QT_CONFIG(qml_network)
QNetworkReply *reply;
int redirectCount;
#endif
QMap<int, QQuickPixmap *> frameMap;
- QSize currentSourceSize;
- void setMovie(QMovie *movie);
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index bec5f06d72..95d1229c8d 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1435,17 +1435,23 @@ void QQuickFlickable::wheelEvent(QWheelEvent *event)
case Qt::ScrollUpdate:
if (d->scrollingPhase)
d->pressed = true;
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
+ // TODO eliminate this timer when ScrollMomentum has been added
d->movementEndingTimer.start(MovementEndingTimerInterval, this);
#endif
break;
case Qt::ScrollEnd:
+ // TODO most of this should be done at transition to ScrollMomentum phase,
+ // then do what the movementEndingTimer triggers at transition to ScrollEnd phase
d->pressed = false;
d->scrollingPhase = false;
d->draggingEnding();
event->accept();
returnToBounds();
d->lastPosTime = -1;
+#ifdef Q_OS_MACOS
+ d->movementEndingTimer.start(MovementEndingTimerInterval, this);
+#endif
return;
}
@@ -2670,13 +2676,15 @@ void QQuickFlickable::movementEnding(bool hMovementEnding, bool vMovementEnding)
if (hMovementEnding && d->hData.moving
&& (!d->pressed && !d->stealMouse)) {
d->hData.moving = false;
- d->hMoved = false;
+ if (!d->scrollingPhase)
+ d->hMoved = false;
emit movingHorizontallyChanged();
}
if (vMovementEnding && d->vData.moving
&& (!d->pressed && !d->stealMouse)) {
d->vData.moving = false;
- d->vMoved = false;
+ if (!d->scrollingPhase)
+ d->vMoved = false;
emit movingVerticallyChanged();
}
if (wasMoving && !isMoving()) {
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index 54cc67875a..c2531e6012 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -106,9 +106,10 @@ public:
, continuousFlickVelocity(0), velocityTime(), vTime(0)
, smoothVelocity(fp), atEnd(false), atBeginning(true)
, transitionToSet(false)
- , fixingUp(false), inOvershoot(false), moving(false), flicking(false)
+ , fixingUp(false), inOvershoot(false), inRebound(false), moving(false), flicking(false)
, dragging(false), extentsChanged(false)
, explicitValue(false), minExtentDirty(true), maxExtentDirty(true)
+ , unused(0)
{}
~AxisData();
@@ -168,6 +169,7 @@ public:
bool explicitValue : 1;
mutable bool minExtentDirty : 1;
mutable bool maxExtentDirty : 1;
+ uint unused : 19;
};
bool flickX(qreal velocity);
diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp
index 5a40d6b705..9b133a823e 100644
--- a/src/quick/items/qquickframebufferobject.cpp
+++ b/src/quick/items/qquickframebufferobject.cpp
@@ -313,6 +313,7 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
desiredFboSize *= n->devicePixelRatio;
if (n->fbo && ((d->followsItemSize && n->fbo->size() != desiredFboSize) || n->invalidatePending)) {
+ delete n->texture();
delete n->fbo;
n->fbo = 0;
delete n->msDisplayFbo;
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index f68dfbf581..b2adf96f0e 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -537,13 +537,12 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal
if (visibleItems.count()) {
FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.constFirst());
rowPos = firstItem->rowPos();
- colNum = qFloor((firstItem->colPos()+colSize()/2) / colSize());
- if (--colNum < 0) {
- colNum = columns - 1;
- rowPos -= rowSize();
- }
- } else {
- colNum = qFloor((colPos+colSize()/2) / colSize());
+ colPos = firstItem->colPos();
+ }
+ colNum = qFloor((colPos+colSize()/2) / colSize());
+ if (--colNum < 0) {
+ colNum = columns - 1;
+ rowPos -= rowSize();
}
// Prepend
@@ -894,7 +893,6 @@ void QQuickGridViewPrivate::initializeCurrentItem()
void QQuickGridViewPrivate::fixupPosition()
{
- moveReason = Other;
if (flow == QQuickGridView::FlowLeftToRight)
fixupY();
else
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index f4d11e32bd..f615e85e1b 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -87,6 +87,7 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(DBG_MOUSE_TARGET)
Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE)
+Q_DECLARE_LOGGING_CATEGORY(lcTransient)
void debugFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1)
{
@@ -970,7 +971,7 @@ bool QQuickKeysAttached::isConnected(const char *signalName) const
Keys.onEscapePressed: {
console.log("escapeItem is handling escape");
- event.accepted = true;
+ // event.accepted is set to true by default for the specific key handlers
}
}
@@ -3264,11 +3265,13 @@ void QQuickItemPrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o)
}
if (thisWindow) {
- if (itemWindow)
+ if (itemWindow) {
+ qCDebug(lcTransient) << thisWindow << "is transient for" << itemWindow;
thisWindow->setTransientParent(itemWindow);
- else
+ } else {
QObject::connect(item, SIGNAL(windowChanged(QQuickWindow*)),
thisWindow, SLOT(setTransientParent_helper(QQuickWindow*)));
+ }
}
o->setParent(that);
}
@@ -3667,8 +3670,9 @@ QQmlListProperty<QObject> QQuickItemPrivate::data()
\qmlproperty real QtQuick::Item::childrenRect.y
\qmlproperty real QtQuick::Item::childrenRect.width
\qmlproperty real QtQuick::Item::childrenRect.height
+ \readonly
- This property holds the collective position and size of the item's
+ This read-only property holds the collective position and size of the item's
children.
This property is useful if you need to access the collective geometry
@@ -5806,19 +5810,24 @@ bool QQuickItem::isVisible() const
return d->effectiveVisible;
}
-void QQuickItem::setVisible(bool v)
+void QQuickItemPrivate::setVisible(bool visible)
{
- Q_D(QQuickItem);
- if (v == d->explicitVisible)
+ if (visible == explicitVisible)
return;
- d->explicitVisible = v;
- if (!v)
- d->dirty(QQuickItemPrivate::Visible);
+ explicitVisible = visible;
+ if (!visible)
+ dirty(QQuickItemPrivate::Visible);
- const bool childVisibilityChanged = d->setEffectiveVisibleRecur(d->calcEffectiveVisible());
- if (childVisibilityChanged && d->parentItem)
- emit d->parentItem->visibleChildrenChanged(); // signal the parent, not this!
+ const bool childVisibilityChanged = setEffectiveVisibleRecur(calcEffectiveVisible());
+ if (childVisibilityChanged && parentItem)
+ emit parentItem->visibleChildrenChanged(); // signal the parent, not this!
+}
+
+void QQuickItem::setVisible(bool v)
+{
+ Q_D(QQuickItem);
+ d->setVisible(v);
}
/*!
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 0c02c66ef2..02e7424d1e 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -311,7 +311,6 @@ public:
static void transform_clear(QQmlListProperty<QQuickTransform> *list);
void _q_resourceObjectDeleted(QObject *);
- void _q_windowChanged(QQuickWindow *w);
quint64 _q_createJSWrapper(QV4::ExecutionEngine *engine);
enum ChangeType {
@@ -581,6 +580,8 @@ public:
virtual bool handlePointerEvent(QQuickPointerEvent *, bool avoidExclusiveGrabber = false);
+ virtual void setVisible(bool visible);
+
bool isTransparentForPositioner() const;
void setTransparentForPositioner(bool trans);
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index f03942ecee..51a91e1f7a 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -113,6 +113,10 @@
#include <private/qqmlmetatype_p.h>
#include <QtQuick/private/qquickaccessibleattached_p.h>
+QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcTransient)
+QT_END_NAMESPACE
+
static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject *parent)
{
// When setting a parent (especially during dynamic object creation) in QML,
@@ -127,6 +131,7 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject
QQuickWindow *win = qmlobject_cast<QQuickWindow *>(obj);
if (win) {
// A Window inside an Item should be transient for that item's window
+ qCDebug(lcTransient) << win << "is transient for" << parentItem->window();
win->setTransientParent(parentItem->window());
return QQmlPrivate::Parented;
}
@@ -136,6 +141,7 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject
QQuickWindow *win = qmlobject_cast<QQuickWindow *>(obj);
if (win) {
// A Window inside a Window should be transient for it
+ qCDebug(lcTransient) << win << "is transient for" << parentWindow;
win->setTransientParent(parentWindow);
return QQmlPrivate::Parented;
} else {
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 10f6c63170..856070634c 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1751,6 +1751,7 @@ void QQuickItemViewPrivate::updateCurrent(int modelIndex)
void QQuickItemViewPrivate::clear()
{
currentChanges.reset();
+ bufferedChanges.reset();
timeline.clear();
releaseVisibleItems();
@@ -1808,51 +1809,56 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to)
if (!isValid() || !q->isComponentComplete())
return;
- bufferPause.stop();
- currentChanges.reset();
+ do {
+ bufferPause.stop();
+ if (currentChanges.hasPendingChanges() || bufferedChanges.hasPendingChanges()) {
+ currentChanges.reset();
+ bufferedChanges.reset();
+ releaseVisibleItems();
+ }
- int prevCount = itemCount;
- itemCount = model->count();
- qreal bufferFrom = from - buffer;
- qreal bufferTo = to + buffer;
- qreal fillFrom = from;
- qreal fillTo = to;
-
- bool added = addVisibleItems(fillFrom, fillTo, bufferFrom, bufferTo, false);
- bool removed = removeNonVisibleItems(bufferFrom, bufferTo);
-
- if (requestedIndex == -1 && buffer && bufferMode != NoBuffer) {
- if (added) {
- // We've already created a new delegate this frame.
- // Just schedule a buffer refill.
- bufferPause.start();
- } else {
- if (bufferMode & BufferAfter)
- fillTo = bufferTo;
- if (bufferMode & BufferBefore)
- fillFrom = bufferFrom;
- added |= addVisibleItems(fillFrom, fillTo, bufferFrom, bufferTo, true);
+ int prevCount = itemCount;
+ itemCount = model->count();
+ qreal bufferFrom = from - buffer;
+ qreal bufferTo = to + buffer;
+ qreal fillFrom = from;
+ qreal fillTo = to;
+
+ bool added = addVisibleItems(fillFrom, fillTo, bufferFrom, bufferTo, false);
+ bool removed = removeNonVisibleItems(bufferFrom, bufferTo);
+
+ if (requestedIndex == -1 && buffer && bufferMode != NoBuffer) {
+ if (added) {
+ // We've already created a new delegate this frame.
+ // Just schedule a buffer refill.
+ bufferPause.start();
+ } else {
+ if (bufferMode & BufferAfter)
+ fillTo = bufferTo;
+ if (bufferMode & BufferBefore)
+ fillFrom = bufferFrom;
+ added |= addVisibleItems(fillFrom, fillTo, bufferFrom, bufferTo, true);
+ }
}
- }
- if (added || removed) {
- markExtentsDirty();
- updateBeginningEnd();
- visibleItemsChanged();
- updateHeader();
- updateFooter();
- updateViewport();
- }
+ if (added || removed) {
+ markExtentsDirty();
+ updateBeginningEnd();
+ visibleItemsChanged();
+ updateHeader();
+ updateFooter();
+ updateViewport();
+ }
- if (prevCount != itemCount)
- emit q->countChanged();
+ if (prevCount != itemCount)
+ emit q->countChanged();
+ } while (currentChanges.hasPendingChanges() || bufferedChanges.hasPendingChanges());
}
void QQuickItemViewPrivate::regenerate(bool orientationChanged)
{
Q_Q(QQuickItemView);
if (q->isComponentComplete()) {
- currentChanges.reset();
if (orientationChanged) {
delete header;
header = 0;
diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h
index 3d2f5361b1..29a62f7f10 100644
--- a/src/quick/items/qquickitemviewtransition_p.h
+++ b/src/quick/items/qquickitemviewtransition_p.h
@@ -58,6 +58,8 @@ QT_REQUIRE_CONFIG(quick_viewtransitions);
#include <QtCore/qobject.h>
#include <QtCore/qpoint.h>
#include <QtQml/qqml.h>
+#include <private/qqmlguard_p.h>
+#include <private/qquicktransition_p.h>
QT_BEGIN_NAMESPACE
@@ -115,14 +117,14 @@ public:
QList<QObject *> moveTransitionTargets;
QList<QObject *> removeTransitionTargets;
- QQuickTransition *populateTransition;
- QQuickTransition *addTransition;
- QQuickTransition *addDisplacedTransition;
- QQuickTransition *moveTransition;
- QQuickTransition *moveDisplacedTransition;
- QQuickTransition *removeTransition;
- QQuickTransition *removeDisplacedTransition;
- QQuickTransition *displacedTransition;
+ QQmlGuard<QQuickTransition> populateTransition;
+ QQmlGuard<QQuickTransition> addTransition;
+ QQmlGuard<QQuickTransition> addDisplacedTransition;
+ QQmlGuard<QQuickTransition> moveTransition;
+ QQmlGuard<QQuickTransition> moveDisplacedTransition;
+ QQmlGuard<QQuickTransition> removeTransition;
+ QQmlGuard<QQuickTransition> removeDisplacedTransition;
+ QQmlGuard<QQuickTransition> displacedTransition;
private:
friend class QQuickItemViewTransitionJob;
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 11eaf393ea..54dfbafaa2 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -1468,9 +1468,6 @@ void QQuickListViewPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometry
void QQuickListViewPrivate::fixupPosition()
{
- if ((haveHighlightRange && highlightRange == QQuickListView::StrictlyEnforceRange)
- || snapMode != QQuickListView::NoSnap)
- moveReason = Other;
if (orient == QQuickListView::Vertical)
fixupY();
else
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 27b8d32707..d5601292b7 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcTransient)
+
static const QQuickItemPrivate::ChangeTypes watchedChanges
= QQuickItemPrivate::Geometry | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 658a7de3d4..ba9460bf76 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -374,9 +374,12 @@ void QQuickRepeater::clear()
if (complete)
emit itemRemoved(i, item);
d->model->release(item);
- item->setParentItem(0);
}
}
+ for (QQuickItem *item : qAsConst(d->deletables)) {
+ if (item)
+ item->setParentItem(0);
+ }
}
d->deletables.clear();
d->itemCount = 0;
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index cfeaa6f22d..2e36f07fdb 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -78,6 +78,9 @@
# include <private/qopenglvertexarrayobject_p.h>
# include <private/qsgdefaultrendercontext_p.h>
#endif
+#ifndef QT_NO_DEBUG_STREAM
+#include <private/qdebug_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -88,6 +91,7 @@ Q_LOGGING_CATEGORY(DBG_MOUSE_TARGET, "qt.quick.mouse.target")
Q_LOGGING_CATEGORY(DBG_HOVER_TRACE, "qt.quick.hover.trace")
Q_LOGGING_CATEGORY(DBG_FOCUS, "qt.quick.focus")
Q_LOGGING_CATEGORY(DBG_DIRTY, "qt.quick.dirty")
+Q_LOGGING_CATEGORY(lcTransient, "qt.quick.window.transient")
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
@@ -576,13 +580,21 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
QObject::connect(q, SIGNAL(focusObjectChanged(QObject*)), q, SIGNAL(activeFocusItemChanged()));
QObject::connect(q, SIGNAL(screenChanged(QScreen*)), q, SLOT(handleScreenChanged(QScreen*)));
-
+ QObject::connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
+ q, SLOT(handleApplicationStateChanged(Qt::ApplicationState)));
QObject::connect(q, SIGNAL(frameSwapped()), q, SLOT(runJobsAfterSwap()), Qt::DirectConnection);
if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>())
service->addWindow(q);
}
+void QQuickWindow::handleApplicationStateChanged(Qt::ApplicationState state)
+{
+ Q_D(QQuickWindow);
+ if (state != Qt::ApplicationActive && d->contentItem)
+ d->contentItem->windowDeactivateEvent();
+}
+
/*!
\property QQuickWindow::data
\internal
@@ -2280,6 +2292,7 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QEvent *event) con
void QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent *event)
{
+ Q_Q(QQuickWindow);
// If users spin the eventloop as a result of event delivery, we disable
// event compression and send events directly. This is because we consider
// the usecase a bit evil, but we at least don't want to lose events.
@@ -2289,8 +2302,11 @@ void QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent *event)
if (event->asPointerMouseEvent()) {
deliverMouseEvent(event->asPointerMouseEvent());
// failsafe: never allow any kind of grab to persist after release
- if (event->isReleaseEvent() && event->buttons() == Qt::NoButton)
+ QQuickItem *grabber = q->mouseGrabberItem();
+ if (event->isReleaseEvent() && event->buttons() == Qt::NoButton && grabber) {
event->clearGrabbers();
+ sendUngrabEvent(grabber, false);
+ }
} else if (event->asPointerTouchEvent()) {
deliverTouchEvent(event->asPointerTouchEvent());
} else {
@@ -2961,8 +2977,10 @@ void QQuickWindowPrivate::data_append(QQmlListProperty<QObject> *property, QObje
if (!o)
return;
QQuickWindow *that = static_cast<QQuickWindow *>(property->object);
- if (QQuickWindow *window = qmlobject_cast<QQuickWindow *>(o))
+ if (QQuickWindow *window = qmlobject_cast<QQuickWindow *>(o)) {
+ qCDebug(lcTransient) << window << "is transient for" << that;
window->setTransientParent(that);
+ }
QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(that->contentItem())->data();
itemProperty.append(&itemProperty, o);
}
@@ -3493,6 +3511,7 @@ void QQuickWindow::cleanupSceneGraph()
void QQuickWindow::setTransientParent_helper(QQuickWindow *window)
{
+ qCDebug(lcTransient) << this << "is transient for" << window;
setTransientParent(window);
disconnect(sender(), SIGNAL(windowChanged(QQuickWindow*)),
this, SLOT(setTransientParent_helper(QQuickWindow*)));
@@ -4935,6 +4954,37 @@ void QQuickWindow::setTextRenderType(QQuickWindow::TextRenderType renderType)
QQuickWindowPrivate::textRenderType = renderType;
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QQuickWindow *win)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ if (!win) {
+ debug << "QQuickWindow(0)";
+ return debug;
+ }
+
+ debug << win->metaObject()->className() << '(' << static_cast<const void *>(win);
+ if (win->isActive())
+ debug << " active";
+ if (win->isExposed())
+ debug << " exposed";
+ debug << ", visibility=" << win->visibility() << ", flags=" << win->flags();
+ if (!win->title().isEmpty())
+ debug << ", title=" << win->title();
+ if (!win->objectName().isEmpty())
+ debug << ", name=" << win->objectName();
+ if (win->parent())
+ debug << ", parent=" << static_cast<const void *>(win->parent());
+ if (win->transientParent())
+ debug << ", transientParent=" << static_cast<const void *>(win->transientParent());
+ debug << ", geometry=";
+ QtDebugUtils::formatQRect(debug, win->geometry());
+ debug << ')';
+ return debug;
+}
+#endif
+
#include "moc_qquickwindow.cpp"
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 06af7bbf02..53e0581fbb 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -234,7 +234,7 @@ private Q_SLOTS:
void handleScreenChanged(QScreen *screen);
void setTransientParent_helper(QQuickWindow *window);
void runJobsAfterSwap();
-
+ void handleApplicationStateChanged(Qt::ApplicationState state);
private:
friend class QQuickItem;
friend class QQuickWidget;
@@ -243,6 +243,10 @@ private:
Q_DISABLE_COPY(QQuickWindow)
};
+#ifndef QT_NO_DEBUG_STREAM
+QDebug Q_QUICK_EXPORT operator<<(QDebug debug, const QQuickWindow *item);
+#endif
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QQuickWindow *)
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index 45e3f0004d..6165ce1ba1 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcTransient)
+
class QQuickWindowQmlImplPrivate : public QQuickWindowPrivate
{
public:
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
index 30088846a6..4cec84646e 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
@@ -233,11 +233,11 @@ void QSGAbstractSoftwareRenderer::setBackgroundColor(const QColor &color)
renderableNode(m_background)->markMaterialDirty();
}
-void QSGAbstractSoftwareRenderer::setBackgroundSize(const QSize &size)
+void QSGAbstractSoftwareRenderer::setBackgroundRect(const QRect &rect)
{
- if (m_background->rect().size().toSize() == size)
+ if (m_background->rect().toRect() == rect)
return;
- m_background->setRect(0.0f, 0.0f, size.width(), size.height());
+ m_background->setRect(rect);
renderableNode(m_background)->markGeometryDirty();
// Invalidate the whole scene when the background is resized
markDirty();
@@ -248,9 +248,9 @@ QColor QSGAbstractSoftwareRenderer::backgroundColor()
return m_background->color();
}
-QSize QSGAbstractSoftwareRenderer::backgroundSize()
+QRect QSGAbstractSoftwareRenderer::backgroundRect()
{
- return m_background->rect().size().toSize();
+ return m_background->rect().toRect();
}
void QSGAbstractSoftwareRenderer::nodeAdded(QSGNode *node)
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
index f20c2cf977..f6594d931a 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
@@ -83,9 +83,9 @@ protected:
QRegion optimizeRenderList();
void setBackgroundColor(const QColor &color);
- void setBackgroundSize(const QSize &size);
+ void setBackgroundRect(const QRect &rect);
QColor backgroundColor();
- QSize backgroundSize();
+ QRect backgroundRect();
// only known after calling optimizeRenderList()
bool isOpaque() const { return m_isOpaque; }
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
index 186fd92fb7..303f98c801 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
@@ -79,7 +79,7 @@ void QSGSoftwarePixmapRenderer::render(QPaintDevice *target)
QElapsedTimer renderTimer;
// Setup background item
- setBackgroundSize(QSize(target->width(), target->height()));
+ setBackgroundRect(m_projectionRect);
setBackgroundColor(clearColor());
renderTimer.start();
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp
index 85d04fe136..d403884b4e 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp
@@ -112,7 +112,8 @@ void QSGSoftwareRenderer::render()
QElapsedTimer renderTimer;
setBackgroundColor(clearColor());
- setBackgroundSize(QSize(m_paintDevice->width() / m_paintDevice->devicePixelRatio(),
+ setBackgroundRect(QRect(0, 0,
+ m_paintDevice->width() / m_paintDevice->devicePixelRatio(),
m_paintDevice->height() / m_paintDevice->devicePixelRatio()));
// Build Renderlist
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
index a67c659c99..03c5738e56 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -203,7 +203,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
updateTextureScale(QVector2D(1.0 / material->textureSize().width(),
1.0 / material->textureSize().height()));
- QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ QOpenGLFunctions *funcs = state.context()->functions();
funcs->glBindTexture(GL_TEXTURE_2D, material->texture()->textureId);
if (updated) {
diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp
index cebb0391ae..5e56460098 100644
--- a/src/quick/util/qquickanimationcontroller.cpp
+++ b/src/quick/util/qquickanimationcontroller.cpp
@@ -223,7 +223,7 @@ void QQuickAnimationController::updateProgress()
d->animationInstance->setDisableUserControl();
d->animationInstance->start();
- QQmlAnimationTimer::unregisterAnimation(d->animationInstance);
+ QQmlAnimationTimer::instance()->unregisterAnimation(d->animationInstance);
d->animationInstance->setCurrentTime(d->progress * d->animationInstance->duration());
}
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 4a9b4a95c1..b3f4faea3f 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -281,15 +281,19 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix,
return;
}
- QQmlProperty prop = property(propertyName); //### better way to check for signal property?
-
- if (prop.type() & QQmlProperty::SignalProperty) {
- QQuickReplaceSignalHandler *handler = new QQuickReplaceSignalHandler;
- handler->property = prop;
- handler->expression.take(new QQmlBoundSignalExpression(object, QQmlPropertyPrivate::get(prop)->signalIndex(),
- QQmlContextData::get(qmlContext(q)), object, compilationUnit->runtimeFunctions.at(binding->value.compiledScriptIndex)));
- signalReplacements << handler;
- return;
+ if (propertyName.count() >= 3 &&
+ propertyName.at(0) == QLatin1Char('o') &&
+ propertyName.at(1) == QLatin1Char('n') &&
+ propertyName.at(2).isUpper()) {
+ QQmlProperty prop = property(propertyName);
+ if (prop.isSignalProperty()) {
+ QQuickReplaceSignalHandler *handler = new QQuickReplaceSignalHandler;
+ handler->property = prop;
+ handler->expression.take(new QQmlBoundSignalExpression(object, QQmlPropertyPrivate::get(prop)->signalIndex(),
+ QQmlContextData::get(qmlContext(q)), object, compilationUnit->runtimeFunctions.at(binding->value.compiledScriptIndex)));
+ signalReplacements << handler;
+ return;
+ }
}
if (binding->type == QV4::CompiledData::Binding::Type_Script) {
@@ -395,7 +399,10 @@ QQmlProperty
QQuickPropertyChangesPrivate::property(const QString &property)
{
Q_Q(QQuickPropertyChanges);
- QQmlProperty prop(object, property, qmlContext(q));
+ QQmlContextData *context = nullptr;
+ if (QQmlData *ddata = QQmlData::get(q))
+ context = ddata->outerContext;
+ QQmlProperty prop = QQmlPropertyPrivate::create(object, property, context);
if (!prop.isValid()) {
qmlWarning(q) << QQuickPropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(property);
return QQmlProperty();
@@ -415,9 +422,10 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions()
ActionList list;
for (int ii = 0; ii < d->properties.count(); ++ii) {
+ QQmlProperty prop = d->property(d->properties.at(ii).first);
- QQuickStateAction a(d->object, d->properties.at(ii).first,
- qmlContext(this), d->properties.at(ii).second);
+ QQuickStateAction a(d->object, prop, d->properties.at(ii).first,
+ d->properties.at(ii).second);
if (a.property.isValid()) {
a.restore = restoreEntryValues();
@@ -426,7 +434,6 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions()
}
for (int ii = 0; ii < d->signalReplacements.count(); ++ii) {
-
QQuickReplaceSignalHandler *handler = d->signalReplacements.at(ii);
if (handler->property.isValid()) {
diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp
index 58f7fc8439..78dc855326 100644
--- a/src/quick/util/qquickshortcut.cpp
+++ b/src/quick/util/qquickshortcut.cpp
@@ -122,7 +122,8 @@ Q_QUICK_PRIVATE_EXPORT ContextMatcher qt_quick_shortcut_context_matcher()
Q_QUICK_PRIVATE_EXPORT void qt_quick_set_shortcut_context_matcher(ContextMatcher matcher)
{
- *ctxMatcher() = matcher;
+ if (!ctxMatcher.isDestroyed())
+ *ctxMatcher() = matcher;
}
QT_BEGIN_NAMESPACE
diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp
index 65e51feb81..3e0a2169a8 100644
--- a/src/quick/util/qquickstate.cpp
+++ b/src/quick/util/qquickstate.cpp
@@ -68,10 +68,9 @@ QQuickStateAction::QQuickStateAction(QObject *target, const QString &propertyNam
fromValue = property.read();
}
-QQuickStateAction::QQuickStateAction(QObject *target, const QString &propertyName,
- QQmlContext *context, const QVariant &value)
+QQuickStateAction::QQuickStateAction(QObject *target, const QQmlProperty &property, const QString &propertyName, const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
- property(target, propertyName, context), toValue(value),
+ property(property), toValue(value),
fromBinding(0), event(0),
specifiedObject(target), specifiedProperty(propertyName)
{
diff --git a/src/quick/util/qquickstate_p.h b/src/quick/util/qquickstate_p.h
index ac720f4189..f551402e80 100644
--- a/src/quick/util/qquickstate_p.h
+++ b/src/quick/util/qquickstate_p.h
@@ -69,8 +69,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStateAction
public:
QQuickStateAction();
QQuickStateAction(QObject *, const QString &, const QVariant &);
- QQuickStateAction(QObject *, const QString &,
- QQmlContext *, const QVariant &);
+ QQuickStateAction(QObject *, const QQmlProperty &property, const QString &,
+ const QVariant &);
bool restore:1;
bool actionDone:1;
diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp
index 29690a4857..6ae89c4ed4 100644
--- a/src/quick/util/qquicktransition.cpp
+++ b/src/quick/util/qquicktransition.cpp
@@ -109,7 +109,7 @@ protected:
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;
};
-class QQuickTransitionPrivate : public QObjectPrivate, QAnimationJobChangeListener
+class QQuickTransitionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QQuickTransition)
public:
@@ -120,11 +120,8 @@ public:
{
}
- void removeStateChangeListener(QAbstractAnimationJob *anim)
- {
- if (anim)
- anim->removeAnimationChangeListener(this, QAbstractAnimationJob::StateChange);
- }
+ static QQuickTransitionPrivate *get(QQuickTransition *q) { return q->d_func(); }
+ void animationStateChanged(QAbstractAnimationJob::State newState);
QString fromState;
QString toState;
@@ -134,7 +131,6 @@ public:
bool reversible;
bool enabled;
protected:
- void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State, QAbstractAnimationJob::State) override;
static void append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *a);
static int animation_count(QQmlListProperty<QQuickAbstractAnimation> *list);
@@ -171,7 +167,16 @@ void QQuickTransitionPrivate::clear_animations(QQmlListProperty<QQuickAbstractAn
}
}
-void QQuickTransitionPrivate::animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State)
+void QQuickTransitionInstance::animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State)
+{
+ if (!m_transition)
+ return;
+
+ QQuickTransitionPrivate *transition = QQuickTransitionPrivate::get(m_transition);
+ transition->animationStateChanged(newState);
+}
+
+void QQuickTransitionPrivate::animationStateChanged(QAbstractAnimationJob::State newState)
{
Q_Q(QQuickTransition);
@@ -197,15 +202,16 @@ void ParallelAnimationWrapper::updateState(QAbstractAnimationJob::State newState
}
}
-QQuickTransitionInstance::QQuickTransitionInstance(QQuickTransitionPrivate *transition, QAbstractAnimationJob *anim)
+QQuickTransitionInstance::QQuickTransitionInstance(QQuickTransition *transition, QAbstractAnimationJob *anim)
: m_transition(transition)
, m_anim(anim)
{
+ anim->addAnimationChangeListener(this, QAbstractAnimationJob::StateChange);
}
QQuickTransitionInstance::~QQuickTransitionInstance()
{
- m_transition->removeStateChangeListener(m_anim);
+ removeStateChangeListener();
delete m_anim;
}
@@ -270,8 +276,7 @@ QQuickTransitionInstance *QQuickTransition::prepare(QQuickStateOperation::Action
group->setDirection(d->reversed ? QAbstractAnimationJob::Backward : QAbstractAnimationJob::Forward);
- group->addAnimationChangeListener(d, QAbstractAnimationJob::StateChange);
- QQuickTransitionInstance *wrapper = new QQuickTransitionInstance(d, group);
+ QQuickTransitionInstance *wrapper = new QQuickTransitionInstance(this, group);
return wrapper;
}
diff --git a/src/quick/util/qquicktransition_p.h b/src/quick/util/qquicktransition_p.h
index d6f365f99e..6d2e41fc9d 100644
--- a/src/quick/util/qquicktransition_p.h
+++ b/src/quick/util/qquicktransition_p.h
@@ -53,6 +53,7 @@
#include "qquickstate_p.h"
#include <private/qabstractanimationjob_p.h>
+#include <private/qqmlguard_p.h>
#include <qqml.h>
#include <QtCore/qobject.h>
@@ -64,10 +65,10 @@ class QQuickTransitionPrivate;
class QQuickTransitionManager;
class QQuickTransition;
-class QQuickTransitionInstance
+class QQuickTransitionInstance : QAnimationJobChangeListener
{
public:
- QQuickTransitionInstance(QQuickTransitionPrivate *transition, QAbstractAnimationJob *anim);
+ QQuickTransitionInstance(QQuickTransition *transition, QAbstractAnimationJob *anim);
~QQuickTransitionInstance();
void start();
@@ -75,8 +76,16 @@ public:
bool isRunning() const;
+protected:
+ void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State, QAbstractAnimationJob::State) override;
+
+ void removeStateChangeListener()
+ {
+ m_anim->removeAnimationChangeListener(this, QAbstractAnimationJob::StateChange);
+ }
+
private:
- QQuickTransitionPrivate *m_transition;
+ QQmlGuard<QQuickTransition> m_transition;
QAbstractAnimationJob *m_anim;
friend class QQuickTransition;
};