aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2022-06-13 14:27:28 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-19 00:54:20 +0000
commitb0b63b2d9efea014595858662cc30147161ee99e (patch)
tree7a359655a8d166d9a835cef656c3001affe00362
parent45ba50f7bd33eaca23927cd720c7b89eeb006675 (diff)
Don't trigger update when text edit is hidden
At the same time clean up the logic around update/polish/ componentComplete. A polish() does trigger an update, so it should not happen before componentCompleted. Adding a polish call in componentCompleted makes sure we avoid the threading issues from QTBUG-38800 Fixes: QTBUG-99947 Change-Id: I818168a90c1b05b7f77fa12de3dc5be3d89f133d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 4197f3d9e60144737a4e4145cd221e47c2920ef9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/items/qquicktextedit.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index fa4fb71be1..ce3b4cbd89 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1510,6 +1510,7 @@ void QQuickTextEdit::componentComplete()
}
if (d->cursorComponent && isCursorVisible())
QQuickTextUtil::createCursor(d);
+ polish();
}
/*!
@@ -2466,8 +2467,8 @@ void QQuickTextEdit::q_textChanged()
updateSize();
markDirtyNodesForRange(0, d->document->characterCount(), 0);
- polish();
if (isComponentComplete()) {
+ polish();
d->updateType = QQuickTextEditPrivate::UpdatePaintNode;
update();
}
@@ -2516,8 +2517,8 @@ void QQuickTextEdit::q_contentsChange(int pos, int charsRemoved, int charsAdded)
markDirtyNodesForRange(pos, editRange, delta);
- polish();
if (isComponentComplete()) {
+ polish();
d->updateType = QQuickTextEditPrivate::UpdatePaintNode;
update();
}
@@ -2545,8 +2546,8 @@ void QQuickTextEdit::updateSelection()
// No need for node updates when we go from an empty selection to another empty selection
if (d->control->textCursor().hasSelection() || d->hadSelection) {
markDirtyNodesForRange(qMin(d->lastSelectionStart, d->control->textCursor().selectionStart()), qMax(d->control->textCursor().selectionEnd(), d->lastSelectionEnd), 0);
- polish();
if (isComponentComplete()) {
+ polish();
d->updateType = QQuickTextEditPrivate::UpdatePaintNode;
update();
}
@@ -2690,8 +2691,8 @@ void QQuickTextEdit::updateWholeDocument()
node.setDirty();
}
- polish();
if (isComponentComplete()) {
+ polish();
d->updateType = QQuickTextEditPrivate::UpdatePaintNode;
update();
}
@@ -2702,8 +2703,8 @@ void QQuickTextEdit::invalidateBlock(const QTextBlock &block)
Q_D(QQuickTextEdit);
markDirtyNodesForRange(block.position(), block.position() + block.length(), 0);
- polish();
if (isComponentComplete()) {
+ polish();
d->updateType = QQuickTextEditPrivate::UpdatePaintNode;
update();
}
@@ -2712,8 +2713,8 @@ void QQuickTextEdit::invalidateBlock(const QTextBlock &block)
void QQuickTextEdit::updateCursor()
{
Q_D(QQuickTextEdit);
- polish();
- if (isComponentComplete()) {
+ if (isComponentComplete() && isVisible()) {
+ polish();
d->updateType = QQuickTextEditPrivate::UpdatePaintNode;
update();
}