diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-15 01:00:05 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-15 01:00:06 +0200 |
commit | b08809b521591bd17955846fbeee651200983f3b (patch) | |
tree | 9cb30ead810e433b35e4a831325ba8f6e709bce3 | |
parent | 8d560d1bf0a747bf62f73fad6b6774095442d9d2 (diff) | |
parent | 6e03533f9432eb1695e3c3bbe65667974b5415b4 (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: I7759f6b60f8fda6525b239c7ee2e034194d4ab85
-rw-r--r-- | examples/quick/views/doc/src/views.qdoc | 16 | ||||
-rw-r--r-- | src/imports/testlib/TestCase.qml | 2 | ||||
-rw-r--r-- | src/particles/qquickimageparticle.cpp | 18 | ||||
-rw-r--r-- | src/particles/qquickimageparticle_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 9 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 4 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/data/qtbug77841.qml | 22 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 13 |
8 files changed, 67 insertions, 18 deletions
diff --git a/examples/quick/views/doc/src/views.qdoc b/examples/quick/views/doc/src/views.qdoc index 16237a68e0..3e23f7657a 100644 --- a/examples/quick/views/doc/src/views.qdoc +++ b/examples/quick/views/doc/src/views.qdoc @@ -39,13 +39,13 @@ \include examples-run.qdocinc - \section1 GridView and PathView + \section1 Using GridView and PathView \e GridView and \e PathView demonstrate usage of these types to display views. \snippet views/gridview/gridview-example.qml 0 - \section1 Dynamic List + \section1 Using Dynamic List \e{Dynamic List} demonstrates animation of runtime additions and removals to a \l ListView. @@ -66,12 +66,12 @@ \snippet views/listview/expandingdelegates.qml 2 \snippet views/listview/expandingdelegates.qml 3 - \section1 Highlight + \section1 Using Highlight \e Highlight demonstrates adding a custom highlight to a ListView. \snippet views/listview/highlight.qml 0 - \section1 Highlight Ranges + \section1 Using Highlight Ranges \e{Highlight Ranges} shows the three different highlight range modes of ListView. @@ -79,13 +79,13 @@ \snippet views/listview/highlightranges.qml 1 \snippet views/listview/highlightranges.qml 2 - \section1 Sections + \section1 Using Sections \e Sections demonstrates the various section headers and footers available to \l ListView. \snippet views/listview/sections.qml 0 - \section1 Packages + \section1 Using Packages \e Packages use the \l [QML]{Package} type to transition delegates between two views. @@ -100,13 +100,13 @@ \snippet views/package/view.qml 0 - \section1 ObjectModel + \section1 Using ObjectModel \e ObjectModel uses an ObjectModel for the model instead of a \l ListModel. \snippet views/objectmodel/objectmodel.qml 0 - \section1 Display Margins + \section1 Using Display Margins \e{Display Margins} uses delegates to display items and implements a simple header and footer components. diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index e7669fd03d..6e075d8792 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -1631,7 +1631,7 @@ Item { TestCase { name: "ItemTests" - when: area.pressed + when: windowShown id: test1 function test_touch() { diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index bd3865f42f..4ce8186c7c 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -1104,6 +1104,7 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) QQuickImageParticle::QQuickImageParticle(QQuickItem* parent) : QQuickParticlePainter(parent) , m_color_variation(0.0) + , m_outgoingNode(nullptr) , m_material(nullptr) , m_alphaVariation(0.0) , m_alpha(1.0) @@ -1149,6 +1150,8 @@ void QQuickImageParticle::sceneGraphInvalidated() { m_nodes.clear(); m_material = nullptr; + delete m_outgoingNode; + m_outgoingNode = nullptr; } void QQuickImageParticle::setImage(const QUrl &image) @@ -1931,8 +1934,11 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData } if (m_pleaseReset){ - if (node) - delete node; + // Cannot just destroy the node and then return null (in case image + // loading is still in progress). Rather, keep track of the old node + // until we have a new one. + delete m_outgoingNode; + m_outgoingNode = node; node = nullptr; m_lastLevel = perfLevel; @@ -1946,6 +1952,9 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData m_pleaseReset = false; m_startedImageLoading = 0;//Cancel a part-way build (may still have a pending load) + } else if (!m_material) { + delete node; + node = nullptr; } if (m_system && m_system->isRunning() && !m_system->isPaused()){ @@ -1959,6 +1968,11 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData } } + if (!node) { + node = m_outgoingNode; + m_outgoingNode = nullptr; + } + return node; } diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h index 059cf67019..45eb73b86c 100644 --- a/src/particles/qquickimageparticle_p.h +++ b/src/particles/qquickimageparticle_p.h @@ -389,6 +389,7 @@ private: QColor m_color; qreal m_color_variation; + QSGNode *m_outgoingNode; QHash<int, QSGGeometryNode *> m_nodes; QHash<int, int> m_idxStarts;//TODO: Proper resizing will lead to needing a spriteEngine per particle - do this after sprite engine gains transparent sharing? QList<QPair<int, int> > m_startsIdx;//Same data, optimized for alternate retrieval diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index c4e9c0d316..7d34cc3f56 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -2060,20 +2060,19 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * firstDirtyPos = nodeIterator->startPos(); // ### this could be optimized if the first and last dirty nodes are not connected // as the intermediate text nodes would usually only need to be transformed differently. - int lastDirtyPos = firstDirtyPos; + QQuickTextNode *firstCleanNode = nullptr; auto it = d->textNodeMap.constEnd(); while (it != nodeIterator) { --it; - if (it->dirty()) { - lastDirtyPos = it->startPos(); + if (it->dirty()) break; - } + firstCleanNode = it->textNode(); } do { rootNode->removeChildNode(nodeIterator->textNode()); delete nodeIterator->textNode(); nodeIterator = d->textNodeMap.erase(nodeIterator); - } while (nodeIterator != d->textNodeMap.constEnd() && nodeIterator->startPos() <= lastDirtyPos); + } while (nodeIterator != d->textNodeMap.constEnd() && nodeIterator->textNode() != firstCleanNode); } // FIXME: the text decorations could probably be handled separately (only updated for affected textFrames) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 34105d8c81..a83b9beaa5 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2259,8 +2259,8 @@ void QQuickTextInput::remove(int start, int end) d->m_cursor -= qMin(d->m_cursor, end) - start; if (d->m_selstart > start) d->m_selstart -= qMin(d->m_selstart, end) - start; - if (d->m_selend > end) - d->m_selend -= qMin(d->m_selend, end) - start; + if (d->m_selend >= end) + d->m_selend -= end - start; } d->addCommand(QQuickTextInputPrivate::Command( QQuickTextInputPrivate::SetSelection, d->m_cursor, 0, d->m_selstart, d->m_selend)); diff --git a/tests/auto/quick/qquicktextinput/data/qtbug77841.qml b/tests/auto/quick/qquicktextinput/data/qtbug77841.qml new file mode 100644 index 0000000000..ebb43a8f82 --- /dev/null +++ b/tests/auto/quick/qquicktextinput/data/qtbug77841.qml @@ -0,0 +1,22 @@ +import QtQuick 2.12 + +Item { + id: root + width: 600 + height: 300 + + TextInput { + id: qwe + objectName: "qwe" + width: 500 + height: 100 + font.pixelSize: 50 + text: "123456" + focus: true + } + + Component.onCompleted: { + qwe.insert(0, "***") + qwe.remove(0, 3) + } +} diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index ed2d535fda..cab4e1145f 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -230,6 +230,7 @@ private slots: void padding(); void QTBUG_51115_readOnlyResetsSelection(); + void QTBUG_77814_InsertRemoveNoSelection(); private: void simulateKey(QWindow *, int key); @@ -7003,6 +7004,18 @@ void tst_qquicktextinput::QTBUG_51115_readOnlyResetsSelection() QCOMPARE(obj->selectedText(), QString()); } +void tst_qquicktextinput::QTBUG_77814_InsertRemoveNoSelection() +{ + QQuickView view; + view.setSource(testFileUrl("qtbug77841.qml")); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QQuickTextInput *textInput = view.rootObject()->findChild<QQuickTextInput*>("qwe"); + QVERIFY(textInput); + + QCOMPARE(textInput->selectedText(), QString()); +} + QTEST_MAIN(tst_qquicktextinput) #include "tst_qquicktextinput.moc" |