diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-12-19 09:51:16 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-20 05:40:38 +0100 |
commit | fcf1490c34f2fa31ca9a49192774b16fe125a6fb (patch) | |
tree | 84db2305f36def64569d062275d27c61da068519 /src | |
parent | 901bdf833cff3db5ef152c3539096b4a7f1de95b (diff) |
Don't enable multiline eliding unless wrap is enabled.
Setting the height of the Text element to less than the height
of the font caused the multiline eliding to activated. Also
ensure multiline eliding only elides a truncated first line if
it does not fit in the width allowed.
Change-Id: If7e88d6ad82cb12cdb53d92616e62c3895611115
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktext.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 07de537a98..e73fa9f492 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -561,7 +561,7 @@ QRect QQuickTextPrivate::setupTextLayout() bool truncate = layoutTextElided; bool customLayout = isLineLaidOutConnected(); - bool elideEnabled = elideMode == QQuickText::ElideRight && q->widthValid(); + bool multilineElideEnabled = elideMode == QQuickText::ElideRight && q->widthValid() && wrapMode != QQuickText::NoWrap; layout.beginLayout(); if (!lineWidth) @@ -585,7 +585,7 @@ QRect QQuickTextPrivate::setupTextLayout() } bool elide = false; - if (elideEnabled && q->heightValid() && height > q->height()) { + if (multilineElideEnabled && q->heightValid() && height > q->height()) { // This line does not fit in the remaining area. elide = true; if (visibleCount > 1) { @@ -602,7 +602,7 @@ QRect QQuickTextPrivate::setupTextLayout() if (elide || (maximumLineCountValid && --linesLeft == 0)) { if (visibleTextLength < text.length()) { truncate = true; - if (elideEnabled) { + if (multilineElideEnabled) { qreal elideWidth = fm.width(elideChar); // Need to correct for alignment if (customLayout) @@ -1594,7 +1594,7 @@ void QQuickText::setTextFormat(TextFormat format) \o Text.ElideRight \endlist - If this property is set to Text.ElideRight, it can be used with multiline + If this property is set to Text.ElideRight, it can be used with \l {wrapMode}{wrapped} text. The text will only elide if \c maximumLineCount, or \c height has been set. If both \c maximumLineCount and \c height are set, \c maximumLineCount will apply unless the lines do not fit in the height allowed. |