Debian Codegraph @

tests/manual/scenegraph_lancelot/data/text/text_advance_multiline.qml

raw
1 import QtQuick 2.10
2
3 Item {
4 width: 320
5 height: 480
6
7 property string firstWord: "One,\nTwo, "
8 property string secondWord: "Three"
9
10 Text {
11 id: referenceText
12 text: firstWord + secondWord
13 anchors.centerIn: parent
14 font.italic: true
15 font.pixelSize: 30
16 }
17
18 Text {
19 id: firstWordItem
20 anchors.left: referenceText.left
21 anchors.top: referenceText.bottom
22 text: firstWord
23 font: referenceText.font
24 }
25
26 Text {
27 id: secondWordItem
28 anchors.left: firstWordItem.left
29 anchors.leftMargin: firstWordItem.advance.width
30 anchors.baseline: firstWordItem.baseline
31 anchors.baselineOffset: firstWordItem.advance.height
32 text: secondWord
33 font: referenceText.font
34 }
35
36 Text {
37 id: firstWordItemRichText
38 anchors.left: referenceText.left
39 anchors.top: secondWordItem.bottom
40 text: firstWord
41 font: referenceText.font
42 textFormat: Text.RichText
43 }
44
45 Text {
46 id: secondWordItemRichText
47 anchors.left: firstWordItemRichText.left
48 anchors.leftMargin: firstWordItemRichText.advance.width
49 anchors.baseline: firstWordItemRichText.baseline
50 anchors.baselineOffset: firstWordItemRichText.advance.height
51 text: secondWord
52 font: referenceText.font
53 textFormat: Text.RichText
54 }
55 }