summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-06-24 11:14:09 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-29 17:14:37 +0000
commit87d4cb06b1ef80d933ceaca9664d0f6ae4b61420 (patch)
treef228d09bd84f258756cc7c78008c15c7f353fb64
parent28deee22489db15ce5529b571eb2691891803b15 (diff)
Don't trigger qBound assert in QExpandingLineEdit
Ignore the original width if it's larger than maximum. Fixes: QTBUG-104383 Fixes: QTBUG-104565 Change-Id: Id86d4f5bd1d50304d95c4711f1989f4dae416b69 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 9fcd5f0790fd01307cfece96d82df21c787fa5b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index a3ec5691a3..609df364cf 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -555,7 +555,7 @@ void QExpandingLineEdit::resizeToContents()
int hintWidth = minimumWidth() + fontMetrics().horizontalAdvance(displayText());
int parentWidth = parent->width();
int maxWidth = isRightToLeft() ? position.x() + oldWidth : parentWidth - position.x();
- int newWidth = qBound(originalWidth, hintWidth, maxWidth);
+ int newWidth = qBound(qMin(originalWidth, maxWidth), hintWidth, maxWidth);
if (widgetOwnsGeometry)
setMaximumWidth(newWidth);
if (isRightToLeft())