aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-07 23:44:44 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-08 14:47:37 +0200
commit40993321cd67c1fe722977ed94c91cedff4bb1f8 (patch)
tree8d1965deec9cca257489a581fbcc56a0cee3c75e /src
parent93455f77c2cef4e7cbcb4ca96c82076e552cae1a (diff)
QQuickTextEdit: ensure we update document width when padding has changed
We use an if-test to check if the document width has changed before we set the new value. The problem is that the value we test against is different than the value we set. The result is that we can sometimes skip setting a new width on the document, even if padding has changed. This patch ensures that we use the same width for both testing and setting. Pick-to: 5.15 Change-Id: Ia8391999e8cc2b5be72fe525d396bf8c17ba0fa2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicktextedit.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index aa07758a5d..566c9c3f6f 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -2530,8 +2530,9 @@ void QQuickTextEdit::updateSize()
if (d->inLayout) // probably the result of a binding loop, but by letting it
return; // get this far we'll get a warning to that effect.
}
- if (d->document->textWidth() != width()) {
- d->document->setTextWidth(width() - leftPadding() - rightPadding());
+ const qreal newTextWidth = width() - leftPadding() - rightPadding();
+ if (d->document->textWidth() != newTextWidth) {
+ d->document->setTextWidth(newTextWidth);
newWidth = d->document->idealWidth();
}
//### need to confirm cost of always setting these