diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2022-09-16 09:28:39 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2022-09-23 15:58:54 +0200 |
commit | 344ddb2f89d90751212dc4f91694b8149e1121ac (patch) | |
tree | ceff80094b084955cd5b137a9d816fa008544d17 /src/quick | |
parent | 2ac2a5b892c3bb6965a262c9a7c198754f8063e6 (diff) |
Adjust baselineOffset correctly when fontSizeMode == HorizontalFit
This caught my attention while reviewing a related fix
(4933bd6351feec988746af647c391c46483f049a)
Task-number: QTBUG-106594
Change-Id: Ie8c7fb2d9e504b14a924eca72a87295d8764cf39
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
(cherry picked from commit a7c8bd27e390db9d0d401f9008ceb4130da53d6f)
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktext.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 01f196a127..d777715d46 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -2419,21 +2419,23 @@ void QQuickText::geometryChange(const QRectF &newGeometry, const QRectF &oldGeom goto geomChangeDone; if (!(widthChanged || widthMaximum) && !d->isLineLaidOutConnected()) { // only height has changed - if (!verticalPositionChanged && newGeometry.height() > oldGeometry.height()) { - if (!d->heightExceeded && !qFuzzyIsNull(oldGeometry.height())) { - // Height is adequate and growing, and it wasn't 0 previously. - goto geomChangeDone; - } - if (d->lineCount == d->maximumLineCount()) // Reached maximum line and height is growing. - goto geomChangeDone; - } else if (newGeometry.height() < oldGeometry.height()) { - if (d->lineCount < 2 && !verticalScale && newGeometry.height() > 0) // A single line won't be truncated until the text is 0 height. - goto geomChangeDone; - - if (!verticalScale // no scaling, no eliding, and either unwrapped, or no maximum line count. - && d->elideMode != QQuickText::ElideRight - && !(d->maximumLineCountValid && d->widthExceeded)) { - goto geomChangeDone; + if (!verticalPositionChanged) { + if (newGeometry.height() > oldGeometry.height()) { + if (!d->heightExceeded && !qFuzzyIsNull(oldGeometry.height())) { + // Height is adequate and growing, and it wasn't 0 previously. + goto geomChangeDone; + } + if (d->lineCount == d->maximumLineCount()) // Reached maximum line and height is growing. + goto geomChangeDone; + } else if (newGeometry.height() < oldGeometry.height()) { + if (d->lineCount < 2 && !verticalScale && newGeometry.height() > 0) // A single line won't be truncated until the text is 0 height. + goto geomChangeDone; + + if (!verticalScale // no scaling, no eliding, and either unwrapped, or no maximum line count. + && d->elideMode != QQuickText::ElideRight + && !(d->maximumLineCountValid && d->widthExceeded)) { + goto geomChangeDone; + } } } } else if (!heightChanged && widthMaximum) { |