aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-04-13 09:46:15 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-04-13 09:46:15 +0200
commit4b72f48637a87c95deedcc501cd9cc8f717117fa (patch)
tree80f00ade2cc3f3845e0f309f39a2649040d203e3 /src/quick
parent3d30c6d7b40ce86f49bc7bdc5c2c74ce180bb3dd (diff)
parentf7e1f7b2f1f1577fd94dfffb93ef15ded5d09031 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/quick/util/qquickpixmapcache.cpp tests/auto/quick/qquickwindow/BLACKLIST Change-Id: Ie81612f2884f8ea508c48ba2735ec54ea1c2eca5
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickitem.cpp160
-rw-r--r--src/quick/items/qquicktext.cpp5
-rw-r--r--src/quick/items/qquicktextedit.cpp11
-rw-r--r--src/quick/items/qquicktextinput.cpp28
-rw-r--r--src/quick/items/qquicktextinput_p.h1
-rw-r--r--src/quick/items/qquickwindow.cpp25
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp10
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp7
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp6
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp1
-rw-r--r--src/quick/scenegraph/shaders/smoothtexture.vert5
-rw-r--r--src/quick/util/qquickanimator.cpp6
-rw-r--r--src/quick/util/qquickanimatorjob.cpp15
-rw-r--r--src/quick/util/qquickanimatorjob_p.h2
-rw-r--r--src/quick/util/qquickstate.cpp5
15 files changed, 172 insertions, 115 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 776da86b7e..4d1bb696fa 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -49,7 +49,6 @@
#include <QtGui/qstylehints.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qinputmethod.h>
-#include <QtCore/qdebug.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qnumeric.h>
#include <QtGui/qpa/qplatformtheme.h>
@@ -66,6 +65,7 @@
#include <private/qv4engine_p.h>
#include <private/qv4object_p.h>
+#include <private/qdebug_p.h>
#ifndef QT_NO_CURSOR
# include <QtGui/qcursor.h>
@@ -4113,8 +4113,8 @@ void QQuickItem::polish()
\qmlmethod object QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in \a
- item's coordinate system, to this item's coordinate system, and returns an object with \c x and
- \c y (and optionally \c width and \c height) properties matching the mapped coordinate.
+ item's coordinate system, to this item's coordinate system, and returns a \l point or \rect
+ matching the mapped coordinate.
If \a item is a \c null value, this maps the point or rect from the coordinate system of
the root QML view.
@@ -4124,50 +4124,43 @@ void QQuickItem::polish()
*/
void QQuickItem::mapFromItem(QQmlV4Function *args) const
{
- if (args->length() != 0) {
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
- QV4::ScopedValue item(scope, (*args)[0]);
-
- QQuickItem *itemObj = 0;
- if (!item->isNull()) {
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
- if (qobjectWrapper)
- itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
- }
-
- if (!itemObj && !item->isNull()) {
- qmlInfo(this) << "mapFromItem() given argument \"" << item->toQStringNoThrow()
- << "\" which is neither null nor an Item";
- return;
- }
+ if (args->length() == 0)
+ return;
- QV4::ScopedObject rv(scope, v4->newObject());
- args->setReturnValue(rv.asReturnedValue());
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+ QV4::ScopedValue item(scope, (*args)[0]);
- QV4::ScopedString s(scope);
- QV4::ScopedValue v(scope);
+ QQuickItem *itemObj = 0;
+ if (!item->isNull()) {
+ QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
+ if (qobjectWrapper)
+ itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
+ }
- qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
- qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
+ if (!itemObj && !item->isNull()) {
+ qmlInfo(this) << "mapFromItem() given argument \"" << item->toQStringNoThrow()
+ << "\" which is neither null nor an Item";
+ return;
+ }
- if (args->length() > 3) {
- qreal w = (v = (*args)[3])->asDouble();
- qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
+ QV4::ScopedValue v(scope);
- QRectF r = mapRectFromItem(itemObj, QRectF(x, y, w, h));
+ qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
+ qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
- rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(r.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(r.y())));
- rv->put((s = v4->newString(QStringLiteral("width"))), (v = QV4::Primitive::fromDouble(r.width())));
- rv->put((s = v4->newString(QStringLiteral("height"))), (v = QV4::Primitive::fromDouble(r.height())));
- } else {
- QPointF p = mapFromItem(itemObj, QPointF(x, y));
+ QVariant result;
- rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(p.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(p.y())));
- }
+ if (args->length() > 3) {
+ qreal w = (v = (*args)[3])->asDouble();
+ qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
+ result = mapRectFromItem(itemObj, QRectF(x, y, w, h));
+ } else {
+ result = mapFromItem(itemObj, QPointF(x, y));
}
+
+ QV4::ScopedObject rv(scope, v4->fromVariant(result));
+ args->setReturnValue(rv.asReturnedValue());
}
/*!
@@ -4192,8 +4185,8 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const
\qmlmethod object QtQuick::Item::mapToItem(Item item, real x, real y, real width, real height)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in this
- item's coordinate system, to \a item's coordinate system, and returns an object with \c x and
- \c y (and optionally \c width and \c height) properties matching the mapped coordinate.
+ item's coordinate system, to \a item's coordinate system, and returns a \l point or \l rect
+ matching the mapped coordinate.
If \a item is a \c null value, this maps the point or rect to the coordinate system of the
root QML view.
@@ -4203,51 +4196,43 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const
*/
void QQuickItem::mapToItem(QQmlV4Function *args) const
{
- if (args->length() != 0) {
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
- QV4::ScopedValue item(scope, (*args)[0]);
-
- QQuickItem *itemObj = 0;
- if (!item->isNull()) {
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
- if (qobjectWrapper)
- itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
- }
-
- if (!itemObj && !item->isNull()) {
- qmlInfo(this) << "mapToItem() given argument \"" << item->toQStringNoThrow()
- << "\" which is neither null nor an Item";
- return;
- }
-
- QV4::ScopedObject rv(scope, v4->newObject());
- args->setReturnValue(rv.asReturnedValue());
+ if (args->length() == 0)
+ return;
- QV4::ScopedValue v(scope);
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+ QV4::ScopedValue item(scope, (*args)[0]);
- qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
- qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
+ QQuickItem *itemObj = 0;
+ if (!item->isNull()) {
+ QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
+ if (qobjectWrapper)
+ itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
+ }
- QV4::ScopedString s(scope);
+ if (!itemObj && !item->isNull()) {
+ qmlInfo(this) << "mapToItem() given argument \"" << item->toQStringNoThrow()
+ << "\" which is neither null nor an Item";
+ return;
+ }
- if (args->length() > 3) {
- qreal w = (v = (*args)[3])->asDouble();
- qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
+ QV4::ScopedValue v(scope);
+ QVariant result;
- QRectF r = mapRectToItem(itemObj, QRectF(x, y, w, h));
+ qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
+ qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
- rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(r.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(r.y())));
- rv->put((s = v4->newString(QStringLiteral("width"))), (v = QV4::Primitive::fromDouble(r.width())));
- rv->put((s = v4->newString(QStringLiteral("height"))), (v = QV4::Primitive::fromDouble(r.height())));
- } else {
- QPointF p = mapToItem(itemObj, QPointF(x, y));
+ if (args->length() > 3) {
+ qreal w = (v = (*args)[3])->asDouble();
+ qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
- rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(p.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(p.y())));
- }
+ result = mapRectToItem(itemObj, QRectF(x, y, w, h));
+ } else {
+ result = mapToItem(itemObj, QPointF(x, y));
}
+
+ QV4::ScopedObject rv(scope, v4->fromVariant(result));
+ args->setReturnValue(rv.asReturnedValue());
}
/*!
@@ -7315,18 +7300,27 @@ bool QQuickItem::event(QEvent *ev)
}
#ifndef QT_NO_DEBUG_STREAM
+// FIXME: Qt 6: Make this QDebug operator<<(QDebug debug, const QQuickItem *item)
QDebug operator<<(QDebug debug, QQuickItem *item)
{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
if (!item) {
debug << "QQuickItem(0)";
return debug;
}
- debug << item->metaObject()->className() << "(this =" << ((void*)item)
- << ", name=" << item->objectName()
- << ", parent =" << ((void*)item->parentItem())
- << ", geometry =" << QRectF(item->position(), QSizeF(item->width(), item->height()))
- << ", z =" << item->z() << ')';
+ const QRectF rect(item->position(), QSizeF(item->width(), item->height()));
+
+ debug << item->metaObject()->className() << '(' << static_cast<void *>(item);
+ if (!item->objectName().isEmpty())
+ debug << ", name=" << item->objectName();
+ debug << ", parent=" << static_cast<void *>(item->parentItem())
+ << ", geometry=";
+ QtDebugUtils::formatQRect(debug, rect);
+ if (const qreal z = item->z())
+ debug << ", z=" << z;
+ debug << ')';
return debug;
}
#endif
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index f33f171738..9db5fa2059 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -1667,7 +1667,10 @@ void QQuickText::setLinkColor(const QColor &color)
return;
d->linkColor = rgb;
- update();
+ if (isComponentComplete()) {
+ d->updateType = QQuickTextPrivate::UpdatePaintNode;
+ update();
+ }
emit linkColorChanged();
}
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 29300644b9..e10aec229e 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1890,6 +1890,10 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
int currentNodeSize = 0;
int nodeStart = firstDirtyPos;
QPointF basePosition(d->xoff, d->yoff);
+ QMatrix4x4 basePositionMatrix;
+ basePositionMatrix.translate(basePosition.x(), basePosition.y());
+ rootNode->setMatrix(basePositionMatrix);
+
QPointF nodeOffset;
TextNode *firstCleanNode = (nodeIterator != d->textNodeMap.end()) ? *nodeIterator : 0;
@@ -1901,7 +1905,6 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
frames.append(textFrame->childFrames());
rootNode->frameDecorationsNode->m_engine->addFrameDecorations(d->document, textFrame);
-
if (textFrame->lastPosition() < firstDirtyPos || (firstCleanNode && textFrame->firstPosition() >= firstCleanNode->startPos()))
continue;
node = d->createTextNode();
@@ -1922,7 +1925,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
nodeOffset = d->document->documentLayout()->frameBoundingRect(textFrame).topLeft();
updateNodeTransform(node, nodeOffset);
while (!it.atEnd())
- node->m_engine->addTextBlock(d->document, (it++).currentBlock(), basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
+ node->m_engine->addTextBlock(d->document, (it++).currentBlock(), -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
nodeStart = textFrame->firstPosition();
} else {
// Having nodes spanning across frame boundaries will break the current bookkeeping mechanism. We need to prevent that.
@@ -1945,7 +1948,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
nodeStart = block.position();
}
- node->m_engine->addTextBlock(d->document, block, basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
+ node->m_engine->addTextBlock(d->document, block, -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
currentNodeSize += block.length();
if ((it.atEnd()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the frame
@@ -1989,7 +1992,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
if (d->cursorComponent == 0 && !isReadOnly()) {
QSGRectangleNode* cursor = 0;
if (d->cursorVisible && d->control->cursorOn())
- cursor = d->sceneGraphContext()->createRectangleNode(cursorRectangle(), d->color);
+ cursor = d->sceneGraphContext()->createRectangleNode(d->control->cursorRect(), d->color);
rootNode->resetCursorNode(cursor);
}
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index c6a6bd9c45..db19f12f83 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1398,15 +1398,8 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event)
int cursor = d->positionAt(event->localPos());
d->moveCursor(cursor, mark);
- if (d->focusOnPress) {
- bool hadActiveFocus = hasActiveFocus();
- forceActiveFocus();
-#ifndef QT_NO_IM
- // re-open input panel on press if already focused
- if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly)
- qGuiApp->inputMethod()->show();
-#endif
- }
+ if (d->focusOnPress && !qGuiApp->styleHints()->setFocusOnTouchRelease())
+ ensureActiveFocus();
event->setAccepted(true);
}
@@ -1456,6 +1449,10 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event)
}
}
#endif
+
+ if (d->focusOnPress && qGuiApp->styleHints()->setFocusOnTouchRelease())
+ ensureActiveFocus();
+
if (!event->isAccepted())
QQuickImplicitSizeItem::mouseReleaseEvent(event);
}
@@ -1688,6 +1685,19 @@ void QQuickTextInput::invalidateFontCaches()
d->m_textLayout.engine()->resetFontEngineCache();
}
+void QQuickTextInput::ensureActiveFocus()
+{
+ Q_D(QQuickTextInput);
+
+ bool hadActiveFocus = hasActiveFocus();
+ forceActiveFocus();
+#ifndef QT_NO_IM
+ // re-open input panel on press if already focused
+ if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly)
+ qGuiApp->inputMethod()->show();
+#endif
+}
+
QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
Q_UNUSED(data);
diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h
index 1550e4eef7..333f55b35f 100644
--- a/src/quick/items/qquicktextinput_p.h
+++ b/src/quick/items/qquicktextinput_p.h
@@ -334,6 +334,7 @@ Q_SIGNALS:
private:
void invalidateFontCaches();
+ void ensureActiveFocus();
protected:
void geometryChanged(const QRectF &newGeometry,
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 696f8f9080..bccebb1a14 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -72,6 +72,7 @@
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(DBG_TOUCH, "qt.quick.touch");
+Q_LOGGING_CATEGORY(DBG_TOUCH_TARGET, "qt.quick.touch.target");
Q_LOGGING_CATEGORY(DBG_MOUSE, "qt.quick.mouse");
Q_LOGGING_CATEGORY(DBG_FOCUS, "qt.quick.focus");
Q_LOGGING_CATEGORY(DBG_DIRTY, "qt.quick.dirty");
@@ -552,6 +553,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
// handler spins the event loop all subsequent moves and releases get lost.
touchMouseId = p.id();
itemForTouchPointId[touchMouseId] = item;
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << item;
QScopedPointer<QMouseEvent> mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event, item, false));
// Send a single press and see if that's accepted
@@ -563,8 +565,10 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
event->setAccepted(mousePress->isAccepted());
if (!mousePress->isAccepted()) {
touchMouseId = -1;
- if (itemForTouchPointId.value(p.id()) == item)
+ if (itemForTouchPointId.value(p.id()) == item) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "disassociated";
itemForTouchPointId.remove(p.id());
+ }
if (mouseGrabberItem == item)
item->ungrabMouse();
@@ -599,6 +603,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
QCoreApplication::sendEvent(item, me.data());
event->setAccepted(me->isAccepted());
if (me->isAccepted()) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << mouseGrabberItem;
itemForTouchPointId[p.id()] = mouseGrabberItem; // N.B. the mouseGrabberItem may be different after returning from sendEvent()
return true;
}
@@ -650,8 +655,10 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber)
if (touchMouseId != -1) {
// update the touch item for mouse touch id to the new grabber
itemForTouchPointId.remove(touchMouseId);
- if (grabber)
+ if (grabber) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << touchMouseId << "->" << mouseGrabberItem;
itemForTouchPointId[touchMouseId] = grabber;
+ }
}
if (oldGrabber) {
@@ -1972,6 +1979,7 @@ void QQuickWindowPrivate::reallyDeliverTouchEvent(QTouchEvent *event)
if (event->touchPointStates() & Qt::TouchPointReleased) {
for (int i=0; i<touchPoints.count(); i++) {
if (touchPoints[i].state() == Qt::TouchPointReleased) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << touchPoints[i].id() << "released";
itemForTouchPointId.remove(touchPoints[i].id());
if (touchPoints[i].id() == touchMouseId)
touchMouseId = -1;
@@ -2079,7 +2087,7 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEv
touchEvent.data()->setTarget(item);
bool touchEventAccepted = false;
- qCDebug(DBG_TOUCH) << " - considering delivering " << touchEvent << " to " << item;
+ qCDebug(DBG_TOUCH) << " - considering delivering " << touchEvent.data() << " to " << item;
// First check whether the parent wants to be a filter,
// and if the parent accepts the event we are done.
@@ -2093,11 +2101,13 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEv
}
// Since it can change in sendEvent, update itemForTouchPointId now
- foreach (int id, matchingNewPoints)
+ foreach (int id, matchingNewPoints) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << id << "->" << item;
itemForTouchPointId[id] = item;
+ }
// Deliver the touch event to the given item
- qCDebug(DBG_TOUCH) << " - actually delivering " << touchEvent << " to " << item;
+ qCDebug(DBG_TOUCH) << " - actually delivering " << touchEvent.data() << " to " << item;
QCoreApplication::sendEvent(item, touchEvent.data());
touchEventAccepted = touchEvent->isAccepted();
@@ -2120,8 +2130,10 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEv
// But if the event was not accepted then we know this item
// will not be interested in further updates for those touchpoint IDs either.
foreach (int id, matchingNewPoints)
- if (itemForTouchPointId[id] == item)
+ if (itemForTouchPointId[id] == item) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << id << "disassociated";
itemForTouchPointId.remove(id);
+ }
}
return touchEventAccepted;
@@ -2410,6 +2422,7 @@ bool QQuickWindowPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem
if (target->childMouseEventFilter(item, mouseEvent.data())) {
qCDebug(DBG_TOUCH) << " - second chance intercepted on childMouseEventFilter by " << target;
if (t != QEvent::MouseButtonRelease) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << tp.id() << "->" << target;
itemForTouchPointId[tp.id()] = target;
touchMouseId = tp.id();
target->grabMouse();
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index ec9106e86b..0c4b2f9af9 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -92,6 +92,7 @@ protected:
int m_matrix_id;
int m_color_id;
int m_textureScale_id;
+ float m_devicePixelRatio;
QFontEngine::GlyphFormat m_glyphFormat;
};
@@ -124,7 +125,8 @@ void QSGTextMaskShader::initialize()
m_matrix_id = program()->uniformLocation("matrix");
m_color_id = program()->uniformLocation("color");
m_textureScale_id = program()->uniformLocation("textureScale");
- program()->setUniformValue("dpr", (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext()));
+ m_devicePixelRatio = (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext());
+ program()->setUniformValue("dpr", m_devicePixelRatio);
}
void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
@@ -152,6 +154,12 @@ void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEf
}
}
+ float devicePixelRatio = (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext());
+ if (m_devicePixelRatio != devicePixelRatio) {
+ m_devicePixelRatio = devicePixelRatio;
+ program()->setUniformValue("dpr", m_devicePixelRatio);
+ }
+
if (state.isMatrixDirty())
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
}
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 61de81576c..ce3bf7d61d 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -91,12 +91,8 @@ void QSGRenderLoop::cleanup()
foreach (QQuickWindow *w, s_instance->windows()) {
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(w);
if (wd->windowManager == s_instance) {
- // windowDestroyed() triggers a sendPostedEvent(DeferredDelete),
- // so wd will be null if the window was deleteLater()'ed
- bool wasDeleted = wd->wasDeleted;
s_instance->windowDestroyed(w);
- if (!wasDeleted)
- wd->windowManager = 0;
+ wd->windowManager = 0;
}
}
delete s_instance;
@@ -300,7 +296,6 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
d->cleanupNodesOnShutdown();
if (m_windows.size() == 0) {
rc->invalidate();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
delete gl;
gl = 0;
} else if (gl && window == gl->surface() && current) {
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index e1a54810b7..7b1e24246b 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -767,9 +767,9 @@ void QSGThreadedRenderLoop::animationStopped()
void QSGThreadedRenderLoop::startOrStopAnimationTimer()
{
int exposedWindows = 0;
- Window *theOne = 0;
+ const Window *theOne = 0;
for (int i=0; i<m_windows.size(); ++i) {
- Window &w = m_windows[i];
+ const Window &w = m_windows.at(i);
if (w.window->isVisible() && w.window->isExposed()) {
++exposedWindows;
theOne = &w;
@@ -781,7 +781,7 @@ void QSGThreadedRenderLoop::startOrStopAnimationTimer()
m_animation_timer = 0;
// If animations are running, make sure we keep on animating
if (m_animation_driver->isRunning())
- maybePostPolishRequest(theOne);
+ maybePostPolishRequest(const_cast<Window *>(theOne));
} else if (m_animation_timer == 0 && exposedWindows != 1 && m_animation_driver->isRunning()) {
m_animation_timer = startTimer(qsgrl_animation_interval());
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index e4db348ef0..b88d21ce66 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -234,7 +234,6 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
d->cleanupNodesOnShutdown();
if (m_windows.size() == 0) {
d->context->invalidate();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
delete m_gl;
m_gl = 0;
} else if (m_gl && current) {
diff --git a/src/quick/scenegraph/shaders/smoothtexture.vert b/src/quick/scenegraph/shaders/smoothtexture.vert
index 1ce824a68f..900fbc6a72 100644
--- a/src/quick/scenegraph/shaders/smoothtexture.vert
+++ b/src/quick/scenegraph/shaders/smoothtexture.vert
@@ -48,5 +48,8 @@ void main()
bool onEdge = any(notEqual(vertexOffset, vec2(0.)));
bool outerEdge = all(equal(texCoordOffset, vec2(0.)));
- vertexOpacity = onEdge && outerEdge ? 0. : opacity;
+ if (onEdge && outerEdge)
+ vertexOpacity = 0.;
+ else
+ vertexOpacity = opacity;
} \ No newline at end of file
diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp
index 1a355a5eac..61fb7481d9 100644
--- a/src/quick/util/qquickanimator.cpp
+++ b/src/quick/util/qquickanimator.cpp
@@ -293,6 +293,7 @@ QAbstractAnimationJob *QQuickAnimator::transition(QQuickStateActions &actions,
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The XAnimator type animates the x position of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -325,6 +326,7 @@ QQuickAnimatorJob *QQuickXAnimator::createJob() const { return new QQuickXAnimat
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The YAnimator type animates the y position of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -357,6 +359,7 @@ QQuickAnimatorJob *QQuickYAnimator::createJob() const { return new QQuickYAnimat
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The ScaleAnimator type animates the scale factor of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -389,6 +392,7 @@ QQuickAnimatorJob *QQuickScaleAnimator::createJob() const { return new QQuickSca
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The OpacityAnimator type animates the opacity of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -420,6 +424,7 @@ QQuickAnimatorJob *QQuickOpacityAnimator::createJob() const { return new QQuickO
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The RotationAnimator type animates the rotation of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -491,6 +496,7 @@ QQuickRotationAnimator::RotationDirection QQuickRotationAnimator::direction() co
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The UniformAnimator type animates a uniform of a ShaderEffect.
\l{Animator} types are different from normal Animation types. When
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index dbd1a662df..8b617e5e3f 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -42,6 +42,7 @@
#include <private/qanimationgroupjob_p.h>
#include <qcoreapplication.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -133,6 +134,13 @@ void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState,
}
}
+void QQuickAnimatorProxyJob::debugAnimation(QDebug d) const
+{
+ d << "QuickAnimatorProxyJob("<< hex << (void *) this << dec
+ << "state:" << state() << "duration:" << duration()
+ << "proxying: (" << job() << ')';
+}
+
void QQuickAnimatorProxyJob::windowChanged(QQuickWindow *window)
{
setWindow(window);
@@ -215,6 +223,13 @@ QQuickAnimatorJob::QQuickAnimatorJob()
m_isRenderThreadJob = true;
}
+void QQuickAnimatorJob::debugAnimation(QDebug d) const
+{
+ d << "QuickAnimatorJob(" << hex << (void *) this << dec
+ << ") state:" << state() << "duration:" << duration()
+ << "target:" << m_target << "value:" << m_value;
+}
+
qreal QQuickAnimatorJob::value() const
{
qreal v;
diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h
index 4c0715bd11..34c106e89b 100644
--- a/src/quick/util/qquickanimatorjob_p.h
+++ b/src/quick/util/qquickanimatorjob_p.h
@@ -74,6 +74,7 @@ public:
protected:
void updateCurrentTime(int);
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
+ void debugAnimation(QDebug d) const Q_DECL_OVERRIDE;
public Q_SLOTS:
void windowChanged(QQuickWindow *window);
@@ -137,6 +138,7 @@ public:
protected:
QQuickAnimatorJob();
+ void debugAnimation(QDebug d) const Q_DECL_OVERRIDE;
QQuickItem *m_target;
QQuickAnimatorController *m_controller;
diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp
index c35ca46aa8..98d7a76c7e 100644
--- a/src/quick/util/qquickstate.cpp
+++ b/src/quick/util/qquickstate.cpp
@@ -157,6 +157,11 @@ QQuickState::~QQuickState()
Q_D(QQuickState);
if (d->group)
d->group->removeState(this);
+
+ foreach (const QQuickSimpleAction &action, d->revertList) {
+ if (action.binding())
+ action.binding()->destroy();
+ }
}
/*!