From e05fbf5c8bf636db5c500c3371d673de17de8c33 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 16 Sep 2016 17:32:58 +1000 Subject: Fix MouseArea sticky grab with drag.filterChildren enabled Task-number: QTBUG-56036 Change-Id: Iad776f42cc776e0d397173b3d2f3922eb7914392 Reviewed-by: Andrew den Exter --- src/quick/items/qquickmousearea.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/quick') diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index d66e55aa12..a8a889d47b 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -666,6 +666,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event) Q_D(QQuickMouseArea); d->moved = false; d->stealMouse = d->preventStealing; + d->overThreshold = false; if (!d->enabled || !(event->button() & acceptedMouseButtons())) { QQuickItem::mousePressEvent(event); } else { @@ -944,6 +945,7 @@ bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event) if (!d->pressed) { // no other buttons are pressed d->stealMouse = false; + d->overThreshold = false; if (c && c->mouseGrabberItem() == this) ungrabMouse(); emit canceled(); -- cgit v1.2.3 From f5e2783acec1f46070330fc1ce90cb16901a5533 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 21 Sep 2016 12:29:50 +0200 Subject: Quick: Do not send SG updates when AnimatedSprite is not visible Task-number: QTBUG-55935 Change-Id: I475c1bb3e7aae9499b1b07a52f3c10f54c8b3481 Reviewed-by: Gunnar Sletta --- src/quick/items/qquickanimatedsprite.cpp | 32 ++++++++++++++++++++------------ src/quick/items/qquickanimatedsprite_p.h | 1 + 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index 44b5ff1e45..7fd89e21a1 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -35,6 +35,7 @@ #include "qquicksprite_p.h" #include "qquickspriteengine_p.h" #include +#include #include #include #include @@ -362,7 +363,7 @@ void QQuickAnimatedSprite::start() } emit currentFrameChanged(0); emit runningChanged(true); - update(); + maybeUpdate(); } void QQuickAnimatedSprite::stop() @@ -372,7 +373,7 @@ void QQuickAnimatedSprite::stop() return; m_pauseOffset = 0; emit runningChanged(false); - update(); + maybeUpdate(); } /*! @@ -390,7 +391,15 @@ void QQuickAnimatedSprite::advance(int frames) m_curFrame += m_spriteEngine->maxFrames(); m_curFrame = m_curFrame % m_spriteEngine->maxFrames(); emit currentFrameChanged(m_curFrame); - update(); + maybeUpdate(); +} + +void QQuickAnimatedSprite::maybeUpdate() +{ + QQuickItemPrivate *priv = QQuickItemPrivate::get(this); + const QLazilyAllocated &extraData = priv->extra; + if ((extraData.isAllocated() && extraData->effectRefCount > 0) || priv->effectiveVisible) + update(); } /*! @@ -408,7 +417,7 @@ void QQuickAnimatedSprite::pause() m_pauseOffset = m_timestamp.elapsed(); m_paused = true; emit pausedChanged(true); - update(); + maybeUpdate(); } /*! @@ -426,7 +435,7 @@ void QQuickAnimatedSprite::resume() m_pauseOffset = m_pauseOffset - m_timestamp.elapsed(); m_paused = false; emit pausedChanged(false); - update(); + maybeUpdate(); } void QQuickAnimatedSprite::createEngine() @@ -438,7 +447,6 @@ void QQuickAnimatedSprite::createEngine() m_spriteEngine = new QQuickSpriteEngine(QList(spriteList), this); m_spriteEngine->startAssemblingImage(); reset(); - update(); } static QSGGeometry::Attribute AnimatedSprite_Attributes[] = { @@ -476,10 +484,10 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode() return 0; } else if (m_spriteEngine->status() == QQuickPixmap::Null) { m_spriteEngine->startAssemblingImage(); - update();//Schedule another update, where we will check again + maybeUpdate();//Schedule another update, where we will check again return 0; } else if (m_spriteEngine->status() == QQuickPixmap::Loading) { - update();//Schedule another update, where we will check again + maybeUpdate();//Schedule another update, where we will check again return 0; } @@ -541,7 +549,7 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode() void QQuickAnimatedSprite::reset() { m_pleaseReset = true; - update(); + maybeUpdate(); } QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) @@ -562,7 +570,7 @@ QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *oldNode, UpdatePaintNode if (m_running) { if (!m_paused) - update(); + maybeUpdate(); if (node) { node->markDirty(QSGNode::DirtyMaterial); @@ -618,7 +626,7 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGGeometryNode *node) frameAt = 0; m_running = false; emit runningChanged(false); - update(); + maybeUpdate(); } } else { frameAt = m_curFrame; @@ -626,7 +634,7 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGGeometryNode *node) if (m_curFrame != lastFrame) { if (isCurrentFrameChangedConnected()) emit currentFrameChanged(m_curFrame); - update(); + maybeUpdate(); } qreal frameCount = m_spriteEngine->spriteFrames(); diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index 5b181640f9..01c5c2d3bd 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -360,6 +360,7 @@ protected: void componentComplete() Q_DECL_OVERRIDE; QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private: + void maybeUpdate(); bool isCurrentFrameChangedConnected(); void prepareNextFrame(QSGGeometryNode *node); void reloadImage(); -- cgit v1.2.3 From 79121a0827df365468a02db20179d2c2d5ae720d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 25 Sep 2016 22:11:12 +0200 Subject: QSGRenderContext: Add null-checks for strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On some systems, glGetString returns null for some reason, which causes a segfault here. Let's assume it's not one of the broken configurations and hope for the best instead. Task-number: QTCREATORBUG-15992 Task-number: QTBUG-56165 Change-Id: I83867e42f0fd8f576bf51ac0a2213e1348111ffd Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Michael BrĂ¼ning Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/qsgcontext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index be228e87c7..2580809b27 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -625,12 +625,12 @@ void QSGRenderContext::initialize(QOpenGLContext *context) #ifdef Q_OS_LINUX const char *vendor = (const char *) funcs->glGetString(GL_VENDOR); - if (strstr(vendor, "nouveau")) + if (vendor && strstr(vendor, "nouveau")) m_brokenIBOs = true; const char *renderer = (const char *) funcs->glGetString(GL_RENDERER); - if (strstr(renderer, "llvmpipe")) + if (renderer && strstr(renderer, "llvmpipe")) m_serializedRender = true; - if (strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16")) + if (vendor && renderer && strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16")) m_brokenIBOs = true; #endif -- cgit v1.2.3 From ef8c6f6a0bf5e4c9ee41306f2df59048ab96038f Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 8 Sep 2016 16:49:10 +0200 Subject: Flickable: don't activate velocityTimeline if scroll phase available The velocity timeline does not need to drive the movement if we can be sure that there are enough wheel events coming from the OS to move the flickable smoothly. And when the velocityTimeline is not active, the movementEndingTimer will emit the movementEnded signal, as it should. Task-number: QTBUG-55871 Change-Id: I5569be3aa6335d43ba162967ee03d08de3ba8096 Reviewed-by: J-P Nurmi --- src/quick/items/qquickflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 760eeed452..7c45d1c5ad 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1616,7 +1616,7 @@ void QQuickFlickable::viewportMoved(Qt::Orientations orient) void QQuickFlickablePrivate::viewportAxisMoved(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, QQuickTimeLineCallback::Callback fixupCallback) { - if (pressed || calcVelocity) { + if (!scrollingPhase && (pressed || calcVelocity)) { int elapsed = data.velocityTime.restart(); if (elapsed > 0) { qreal velocity = (data.lastPos - data.move.value()) * 1000 / elapsed; -- cgit v1.2.3 From 7b84962c47c9618af49526e3a2ef8c1c969d5aaa Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 8 Sep 2016 17:14:33 +0200 Subject: Flickable: do not emit movementEnded until it really does This was occurring when using a physical mouse wheel: movementEnded was emitted, then contentYChanged would still be emitted a few more times. Task-number: QTBUG-55886 Change-Id: Ib5e833d5d84633bb07b8c240ea3ccc9977e443f8 Reviewed-by: J-P Nurmi --- src/quick/items/qquickflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 7c45d1c5ad..a5b4bb0309 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1563,7 +1563,7 @@ void QQuickFlickable::timerEvent(QTimerEvent *event) d->movementEndingTimer.stop(); d->pressed = false; d->stealMouse = false; - if (!d->velocityTimeline.isActive()) + if (!d->velocityTimeline.isActive() && !d->timeline.isActive()) movementEnding(true, true); } } -- cgit v1.2.3 From 84d3a064d7ab331c42ec1ced6e658a8bcc32f0f7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 29 Sep 2016 13:00:33 +0200 Subject: QQuickText: fix paddings when wrapping or eliding is used Change-Id: I8ec8c8eff41e77225ef42f7bd9e52f4558d00130 Task-number: QTBUG-55779 Reviewed-by: Liang Qi --- src/quick/items/qquicktext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index ea2d2f3133..044e6ce8c1 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -921,7 +921,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) bool wasInLayout = internalWidthUpdate; internalWidthUpdate = true; - q->setImplicitHeight(naturalHeight); + q->setImplicitHeight(naturalHeight + q->topPadding() + q->bottomPadding()); internalWidthUpdate = wasInLayout; multilineElide = elideMode == QQuickText::ElideRight -- cgit v1.2.3 From 79cfc8788d6267eeb263983466ba21758f618dcd Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 12 May 2016 14:56:20 +0200 Subject: Fix incorrectly aligned text whose size depends on its implicit size The if statement in QQuickTextPrivate::setupTextLayout() was missing an OR clause for the case where the line width is neither greater nor less than the old width/natural width, but has actually changed. If that sounds confusing, it's because it is. Basically, the outer layouting loop in that function needs to run twice for this scenario, so that's what this patch makes it do. Change-Id: I13777667eb13506d50f05e9766785a1c2c46125c Task-number: QTBUG-50738 Task-number: QTBUG-50740 Reviewed-by: Liang Qi --- src/quick/items/qquicktext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 044e6ce8c1..ee5965676c 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -882,11 +882,11 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) // If the width of the item has changed and it's possible the result of wrapping, // eliding, scaling has changed, or the text is not left aligned do another layout. - if ((lineWidth < qMin(oldWidth, naturalWidth) || (widthExceeded && lineWidth > oldWidth)) + if ((!qFuzzyCompare(lineWidth, oldWidth) || (widthExceeded && lineWidth > oldWidth)) && (singlelineElide || multilineElide || canWrap || horizontalFit || q->effectiveHAlign() != QQuickText::AlignLeft)) { widthChanged = true; - widthExceeded = false; + widthExceeded = lineWidth >= qMin(oldWidth, naturalWidth); heightExceeded = false; continue; } -- cgit v1.2.3