aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-30 00:16:40 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-30 00:16:40 +0200
commit0bf14044178d7aa212ac7e28530f9077790a3df4 (patch)
tree4c403571abbc5e18c6962ba67d9cb584d8e121c4 /src/quick
parent0aea009425242417bffdb171c8eca02ff52f4a7b (diff)
parent79cfc8788d6267eeb263983466ba21758f618dcd (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I241cd418bb7e7b95e0a0a2ee4c465d48be2a5582
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp32
-rw-r--r--src/quick/items/qquickanimatedsprite_p.h1
-rw-r--r--src/quick/items/qquickflickable.cpp4
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquicktext.cpp6
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp6
6 files changed, 31 insertions, 20 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index 77c7ae106b..6207a86877 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -41,6 +41,7 @@
#include "qquicksprite_p.h"
#include "qquickspriteengine_p.h"
#include <QtQuick/private/qsgcontext_p.h>
+#include <QtQuick/private/qquickitem_p.h>
#include <private/qsgadaptationlayer_p.h>
#include <private/qqmlglobal_p.h>
#include <QtQuick/qsgnode.h>
@@ -368,7 +369,7 @@ void QQuickAnimatedSprite::start()
}
emit currentFrameChanged(0);
emit runningChanged(true);
- update();
+ maybeUpdate();
}
void QQuickAnimatedSprite::stop()
@@ -378,7 +379,7 @@ void QQuickAnimatedSprite::stop()
return;
m_pauseOffset = 0;
emit runningChanged(false);
- update();
+ maybeUpdate();
}
/*!
@@ -396,7 +397,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<QQuickItemPrivate::ExtraData> &extraData = priv->extra;
+ if ((extraData.isAllocated() && extraData->effectRefCount > 0) || priv->effectiveVisible)
+ update();
}
/*!
@@ -414,7 +423,7 @@ void QQuickAnimatedSprite::pause()
m_pauseOffset = m_timestamp.elapsed();
m_paused = true;
emit pausedChanged(true);
- update();
+ maybeUpdate();
}
/*!
@@ -432,7 +441,7 @@ void QQuickAnimatedSprite::resume()
m_pauseOffset = m_pauseOffset - m_timestamp.elapsed();
m_paused = false;
emit pausedChanged(false);
- update();
+ maybeUpdate();
}
void QQuickAnimatedSprite::createEngine()
@@ -444,7 +453,6 @@ void QQuickAnimatedSprite::createEngine()
m_spriteEngine = new QQuickSpriteEngine(QList<QQuickSprite*>(spriteList), this);
m_spriteEngine->startAssemblingImage();
reset();
- update();
}
static QSGGeometry::Attribute AnimatedSprite_Attributes[] = {
@@ -482,10 +490,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;
}
@@ -547,7 +555,7 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode()
void QQuickAnimatedSprite::reset()
{
m_pleaseReset = true;
- update();
+ maybeUpdate();
}
QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
@@ -568,7 +576,7 @@ QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *oldNode, UpdatePaintNode
if (m_running) {
if (!m_paused)
- update();
+ maybeUpdate();
if (node) {
node->markDirty(QSGNode::DirtyMaterial);
@@ -624,7 +632,7 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGGeometryNode *node)
frameAt = 0;
m_running = false;
emit runningChanged(false);
- update();
+ maybeUpdate();
}
} else {
frameAt = m_curFrame;
@@ -632,7 +640,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 1e5981c1a4..9d8b4dad40 100644
--- a/src/quick/items/qquickanimatedsprite_p.h
+++ b/src/quick/items/qquickanimatedsprite_p.h
@@ -366,6 +366,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();
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index c838eae3c7..49117d27d1 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1573,7 +1573,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);
}
}
@@ -1626,7 +1626,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;
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 234105986a..609666d32b 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -672,6 +672,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 {
@@ -952,6 +953,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();
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 8288554028..80321cf5d1 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -897,11 +897,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;
}
@@ -936,7 +936,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
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 25945ad78a..395353f30d 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -631,12 +631,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