diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-03-22 14:30:15 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-03-26 12:50:04 +0000 |
commit | 82247946b2733bcd5bb3740a31c7d38fb90f6ddd (patch) | |
tree | f60b25d72923c96ff313b19b04fd9127c7ff18c2 /tests/manual/scenegraph_lancelot/data | |
parent | 0dab320fb42ba2ac855baf05972c3420c11d002e (diff) |
Fix text wrap: do not break on last line if right elide is enabled
For multiline texts with word wrapping, it is not so meaningful to add
breaks in the last line if it is anyway going to be elided. Fix by
using the WrapAnywhere strategy for the last line for such situations.
Fixes: QTBUG-72736
Change-Id: I1263c81277b6ca89ba461529fced1094263c026f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/manual/scenegraph_lancelot/data')
-rw-r--r-- | tests/manual/scenegraph_lancelot/data/text/text_wrap_elide_maxlines.qml | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_wrap_elide_maxlines.qml b/tests/manual/scenegraph_lancelot/data/text/text_wrap_elide_maxlines.qml new file mode 100644 index 0000000000..927f2b3148 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/text_wrap_elide_maxlines.qml @@ -0,0 +1,133 @@ +import QtQuick 2.0 + +//test wrapping and elision when maximumLineCount is set + +Item { + width: 320 + height: 480 + Rectangle { + id: text_area + color: "light yellow" + x: 50 + y: 0 + height: parent.height + width: 150 + } + Text { + id: text_0000 + wrapMode: Text.WrapAnywhere + text: "The quick brown fox jumps over the lazy dog." + x: text_area.x + y: text_area.y + width: text_area.width + maximumLineCount: 2 + elide: Text.ElideRight + color: "red" + font.family: "Arial" + font.pixelSize: 22 + } + Text { + id: text_0001 + wrapMode: Text.Wrap + text: text_0000.text + anchors.top: text_0000.bottom + anchors.left: text_0000.left + width: text_0000.width + maximumLineCount: text_0000.maximumLineCount + elide: Text.ElideRight + color: "blue" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } + Text { + id: text_0002 + wrapMode: Text.WordWrap + text: text_0000.text + anchors.top: text_0001.bottom + anchors.left: text_0000.left + width: text_0000.width + maximumLineCount: text_0000.maximumLineCount + elide: Text.ElideRight + color: "green" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } + Text { + id: text_0003 + wrapMode: Text.WrapAnywhere + text: "ABCDEFGHIJKL 1234567890123" + anchors.top: text_0002.bottom + anchors.left: text_0000.left + width: 150 + maximumLineCount: 2 + elide: Text.ElideRight + color: "red" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } + Text { + id: text_0004 + wrapMode: Text.Wrap + text: text_0003.text + anchors.top: text_0003.bottom + anchors.left: text_0000.left + width: text_0000.width + maximumLineCount: text_0000.maximumLineCount + elide: Text.ElideRight + color: "blue" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } + Text { + id: text_0005 + wrapMode: Text.WordWrap + text: text_0003.text + anchors.top: text_0004.bottom + anchors.left: text_0000.left + width: text_0000.width + maximumLineCount: text_0000.maximumLineCount + elide: Text.ElideRight + color: "green" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } + Text { + id: text_0006 + wrapMode: Text.WrapAnywhere + text: "The quick brown 1234567890123" + anchors.top: text_0005.bottom + anchors.left: text_0000.left + width: 150 + maximumLineCount: 2 + elide: Text.ElideRight + color: "red" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } + Text { + id: text_0007 + wrapMode: Text.Wrap + text: text_0006.text + anchors.top: text_0006.bottom + anchors.left: text_0000.left + width: text_0000.width + maximumLineCount: text_0000.maximumLineCount + elide: Text.ElideRight + color: "blue" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } + Text { + id: text_0008 + wrapMode: Text.WordWrap + text: text_0006.text + anchors.top: text_0007.bottom + anchors.left: text_0000.left + width: text_0000.width + maximumLineCount: text_0000.maximumLineCount + elide: Text.ElideRight + color: "green" + font.family: text_0000.font.family + font.pixelSize: text_0000.font.pixelSize + } +} |