blob: 2ae891053faa037ba925d1f432ebda519bba15bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//![0]
import QtQuick
Item {
id: root
width: 480
height: 320
Rectangle {
color: "#272822"
width: 480
height: 320
}
Column {
spacing: 20
Text {
text: 'I am the very model of a modern major general!'
// color can be set on the entire element with this property
color: "yellow"
}
Text {
// For text to wrap, a width has to be explicitly provided
width: root.width
// This setting makes the text wrap at word boundaries when it goes
// past the width of the Text object
wrapMode: Text.WordWrap
// You can use \ to escape quotation marks, or to add new lines (\n).
// Use \\ to get a \ in the string
text: 'I am the very model of a modern major general. I\'ve information \
vegetable, animal and mineral. I know the kings of england and I \
quote the fights historical; from Marathon to Waterloo in order categorical.'
// color can be set on the entire element with this property
color: "white"
}
Text {
text: 'I am the very model of a modern major general!'
// color can be set on the entire element with this property
color: "yellow"
// font properties can be set effciently on the whole string at once
font { family: 'Courier'; pixelSize: 20; italic: true; capitalization: Font.SmallCaps }
}
Text {
// HTML like markup can also be used
text: '<font color="white">I am the <b>very</b> model of a modern <i>major general</i>!</font>'
// This could also be written font { pointSize: 14 }. Both syntaxes are valid.
font.pointSize: 14
// StyledText format supports fewer tags, but is more efficient than RichText
textFormat: Text.StyledText
}
}
}
//![0]
|