-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextDisplay.qml
More file actions
98 lines (89 loc) · 2.89 KB
/
TextDisplay.qml
File metadata and controls
98 lines (89 loc) · 2.89 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import QtQuick
import Qt5Compat.GraphicalEffects
import QtQuick3D
Item {
property alias frameColor : frameOverlay.color
property alias text: text.text
property alias textColor: text.color
property alias backgroundColor : background.color
Rectangle{
id: background
anchors.fill:parent
anchors.leftMargin: parent.width * 7/100
anchors.rightMargin: parent.width * 7/100
anchors.topMargin: parent.height * 4/100
anchors.bottomMargin: parent.height * 4/100
}
Image{
id: frame
source:"qrc:/assets/frame.png"
anchors.fill: parent
smooth: false
antialiasing: true
mipmap: true
}
ColorOverlay{
id: frameOverlay
anchors.fill: frame
source: frame
antialiasing: true
smooth: false
}
Text{
id: text
textFormat: Text.PlainText
readonly property real horzizontalMargin: parent.width * 11/100
readonly property real verticalMargin: parent.height * 7/100
anchors.fill: parent
anchors.leftMargin: horzizontalMargin
anchors.rightMargin: horzizontalMargin
anchors.topMargin: verticalMargin
anchors.bottomMargin: verticalMargin
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
fontSizeMode: Text.Fit
minimumPointSize : 10
font.pointSize: 172
wrapMode: Text.WordWrap
// onContentHeightChanged: {
// console.log("\ncontentHeight:",contentHeight
// ,"\nheight:",height
// ,"implicitHeight:",implicitHeight)
// }
}
LinearGradient{
id: mask
anchors.fill: frameOverlay
start:Qt.point(0,0)
end:Qt.point(width*2,height)
gradient: Gradient {
id: maskGradient
property real position : 0.4
GradientStop { position: 0.0; color: "transparent"}
GradientStop { position: maskGradient.position - 0.01 - 0.001; color: "transparent"}
GradientStop { position: maskGradient.position - 0.01; color: "white"}
GradientStop { position: maskGradient.position + 0.01; color: "white"}
GradientStop { position: maskGradient.position + 0.01 + 0.001; color: "transparent"}
GradientStop { position: 1.0; color: "transparent"}
SequentialAnimation on position{
loops:Animation.Infinite
NumberAnimation{
from: 0.0
to:1.0
duration:2500
}
PauseAnimation {
duration: 2000
}
}
}
visible: false
}
Blend {
source: frameOverlay
foregroundSource: mask
mode: "lighten"
anchors.fill: frameOverlay
opacity:0.7
}
}