diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-02-17 12:26:21 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-23 04:06:04 +0100 |
commit | 924a9620d528da85dc19df7573d33ba4132e5a3a (patch) | |
tree | ff4ff9efceaf95df8ed0f4fec3b16c3379defa84 /src | |
parent | c5f65d859720c9345f995136301f6809bbb82867 (diff) |
Fix Text eliding with implicit height and maximumLineCount.
Ignore the height of the text if the element height is invalid.
Task-number: QTBUG-24293
Change-Id: I1646c3f64583da40e6166aeea24c2c4af42cb279
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktext.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 44735c1895..28491d8f75 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -666,6 +666,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) } const int lineWidth = q->widthValid() ? q->width() : INT_MAX; + const qreal maxHeight = q->heightValid() ? q->height() : FLT_MAX; const bool customLayout = isLineLaidOutConnected(); const bool wasTruncated = truncated; @@ -715,6 +716,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) } layout.beginLayout(); + bool wrapped = false; bool truncateHeight = false; truncated = false; @@ -735,7 +737,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) // Elide the previous line if the accumulated height of the text exceeds the height // of the element. - if (multilineElide && height > q->height() && visibleCount > 1) { + if (multilineElide && height > maxHeight && visibleCount > 1) { elide = true; if (eos != -1) // There's an abbreviated string available, skip the rest as it's break; // all going to be discarded. @@ -873,7 +875,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) } if (verticalFit) { - if (truncateHeight || (q->heightValid() && unelidedRect.height() > q->height())) { + if (truncateHeight || unelidedRect.height() > maxHeight) { largeFont = scaledFontSize - 1; scaledFontSize = (smallFont + largeFont + 1) / 2; if (smallFont > largeFont) |