aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-07-26 09:14:44 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-07-26 13:21:16 +0200
commit75d8ebb3e6925f500ddeefe2ab491be2ae83264c (patch)
tree6874c91386434f4a1934a9555a3f1d5daf69434c /src/quick
parentfcb40ff6d71f4561401e6b2bd4d7fc706fff8eee (diff)
parentba8416b80f42c81387170620472194e7a76429b8 (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4engine.cpp Change-Id: Ie3ef6202b6a3a8521971e1be10c40c6a2db6989c
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickflickable.cpp6
-rw-r--r--src/quick/items/qquickgridview.cpp2
-rw-r--r--src/quick/items/qquickitemview.cpp14
-rw-r--r--src/quick/items/qquickitemview_p_p.h2
-rw-r--r--src/quick/items/qquicklistview.cpp2
-rw-r--r--src/quick/items/qquickpathview.cpp10
-rw-r--r--src/quick/items/qquickpathview_p_p.h1
-rw-r--r--src/quick/items/qquicktext.cpp8
-rw-r--r--src/quick/items/qquicktextedit.cpp6
-rw-r--r--src/quick/items/qquicktextedit_p_p.h5
-rw-r--r--src/quick/items/qquicktextnode.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp2
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp3
13 files changed, 48 insertions, 15 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 45566f2e89..ee71ea8a76 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -327,7 +327,7 @@ bool QQuickFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExt
maxDistance = qAbs(maxExtent - data.move.value());
data.flickTarget = maxExtent;
}
- if (maxDistance > 0) {
+ if (maxDistance > 0 || boundsBehavior == QQuickFlickable::DragAndOvershootBounds) {
qreal v = velocity;
if (maxVelocity != -1 && maxVelocity < qAbs(v)) {
if (v < 0)
@@ -1541,6 +1541,10 @@ void QQuickFlickable::geometryChanged(const QRectF &newGeometry,
void QQuickFlickable::flick(qreal xVelocity, qreal yVelocity)
{
Q_D(QQuickFlickable);
+ d->hData.reset();
+ d->vData.reset();
+ d->hData.velocity = xVelocity;
+ d->vData.velocity = yVelocity;
bool flickedX = d->flickX(xVelocity);
bool flickedY = d->flickY(yVelocity);
d->flickingStarted(flickedX, flickedY);
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 77ff275619..5b928310cd 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -1616,7 +1616,7 @@ void QQuickGridView::setFlow(Flow flow)
}
setContentX(0);
setContentY(0);
- d->regenerate();
+ d->regenerate(true);
emit flowChanged();
}
}
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index ef696dae96..2a686b4342 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1783,18 +1783,20 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to)
emit q->countChanged();
}
-void QQuickItemViewPrivate::regenerate()
+void QQuickItemViewPrivate::regenerate(bool orientationChanged)
{
Q_Q(QQuickItemView);
if (q->isComponentComplete()) {
currentChanges.reset();
- delete header;
- header = 0;
- delete footer;
- footer = 0;
+ if (orientationChanged) {
+ delete header;
+ header = 0;
+ delete footer;
+ footer = 0;
+ }
+ clear();
updateHeader();
updateFooter();
- clear();
updateViewport();
setPosition(contentStartOffset());
refill();
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index 3f0f3b3646..7c8656cced 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -184,7 +184,7 @@ public:
virtual void clear();
virtual void updateViewport();
- void regenerate();
+ void regenerate(bool orientationChanged=false);
void layout();
virtual void animationFinished(QAbstractAnimationJob *);
void refill();
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index a1388e3512..e8043804fb 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -2072,7 +2072,7 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
setFlickableDirection(HorizontalFlick);
setContentY(0);
}
- d->regenerate();
+ d->regenerate(true);
emit orientationChanged();
}
}
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index de5ed99640..efce244f7d 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -104,6 +104,7 @@ QQuickPathViewPrivate::QQuickPathViewPrivate()
, stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true)
, autoHighlight(true), highlightUp(false), layoutScheduled(false)
, moving(false), flicking(false), dragging(false), inRequest(false), delegateValidated(false)
+ , inRefill(false)
, dragMargin(0), deceleration(100), maximumFlickVelocity(QML_FLICK_DEFAULTMAXVELOCITY)
, moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0)
, firstIndex(-1), pathItems(-1), requestedIndex(-1), cacheSize(0), requestedZ(0)
@@ -1873,11 +1874,18 @@ void QQuickPathView::refill()
{
Q_D(QQuickPathView);
+ if (d->inRefill) {
+ d->scheduleLayout();
+ return;
+ }
+
d->layoutScheduled = false;
if (!d->isValid() || !isComponentComplete())
return;
+ d->inRefill = true;
+
bool currentVisible = false;
int count = d->pathItems == -1 ? d->modelCount : qMin(d->pathItems, d->modelCount);
@@ -2010,6 +2018,8 @@ void QQuickPathView::refill()
}
while (d->itemCache.count())
d->releaseItem(d->itemCache.takeLast());
+
+ d->inRefill = false;
}
void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h
index 813f472072..e21f3757e6 100644
--- a/src/quick/items/qquickpathview_p_p.h
+++ b/src/quick/items/qquickpathview_p_p.h
@@ -152,6 +152,7 @@ public:
bool requestedOnPath : 1;
bool inRequest : 1;
bool delegateValidated : 1;
+ bool inRefill : 1;
QElapsedTimer timer;
qint64 lastPosTime;
QPointF lastPos;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 7a4027890c..71265689e9 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -711,7 +711,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
}
bool shouldUseDesignMetrics = renderType != QQuickText::NativeRendering;
-
+ if (!visibleImgTags.isEmpty())
+ visibleImgTags.clear();
layout.setCacheEnabled(true);
QTextOption textOption = layout.textOption();
if (textOption.alignment() != q->effectiveHAlign()
@@ -940,9 +941,10 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
maxHeight = q->heightValid() ? q->height() : FLT_MAX;
// If the width of the item has changed and it's possible the result of wrapping,
- // eliding, or scaling has changed do another layout.
+ // eliding, scaling has changed, or the text is not left aligned do another layout.
if ((lineWidth < qMin(oldWidth, naturalWidth) || (widthExceeded && lineWidth > oldWidth))
- && (singlelineElide || multilineElide || canWrap || horizontalFit)) {
+ && (singlelineElide || multilineElide || canWrap || horizontalFit
+ || q->effectiveHAlign() != QQuickText::AlignLeft)) {
widthExceeded = false;
heightExceeded = false;
continue;
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index b042e30483..fdaef6df8e 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1777,8 +1777,12 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
d->updateType = QQuickTextEditPrivate::UpdateNone;
- if (!oldNode) // If we had any text node references, they were deleted along with the root node
+ if (!oldNode) {
+ // If we had any QQuickTextNode node references, they were deleted along with the root node
+ // But here we must delete the Node structures in textNodeMap
+ qDeleteAll(d->textNodeMap);
d->textNodeMap.clear();
+ }
RootNode *rootNode = static_cast<RootNode *>(oldNode);
TextNodeIterator nodeIterator = d->textNodeMap.begin();
diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h
index 25681c89f6..0cf7ee2850 100644
--- a/src/quick/items/qquicktextedit_p_p.h
+++ b/src/quick/items/qquicktextedit_p_p.h
@@ -111,6 +111,11 @@ public:
{
}
+ ~QQuickTextEditPrivate()
+ {
+ qDeleteAll(textNodeMap);
+ }
+
static QQuickTextEditPrivate *get(QQuickTextEdit *item) {
return static_cast<QQuickTextEditPrivate *>(QObjectPrivate::get(item)); }
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index da0d9cd714..02e321dfba 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -303,6 +303,8 @@ void QQuickTextNode::deleteContent()
while (firstChild() != 0)
delete firstChild();
m_cursorNode = 0;
+ qDeleteAll(m_textures);
+ m_textures.clear();
}
#if 0
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index a7659e4871..37525e6151 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3335,7 +3335,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const
\warning The returned texture is not memory managed by the scene graph and
must be explicitly deleted by the caller on the rendering thread.
- This is acheived by deleting the texture from a QSGNode destructor
+ This is achieved by deleting the texture from a QSGNode destructor
or by using deleteLater() in the case where the texture already has affinity
to the rendering thread.
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index ceeaa977d7..c92d79dc2a 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -270,6 +270,9 @@ void Atlas::uploadBgra(Texture *texture)
const QRect &r = texture->atlasSubRect();
QImage image = texture->image();
+ if (image.isNull())
+ return;
+
if (image.format() != QImage::Format_ARGB32_Premultiplied
&& image.format() != QImage::Format_RGB32) {
image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);