@@ -6,18 +6,40 @@ Rectangle {
6
6
property string back_color: " #223"
7
7
property string font_color: " #fff"
8
8
property alias text: label .text
9
- property bool active: pressed || mouseArea .containsMouse
10
9
property bool pressed: false
11
10
// Pressing the right mouse button "locks" the button in enabled state
12
11
property bool fixed: false
13
12
property int keymap_id: 1
14
13
15
14
signal clicked ()
16
15
17
- border .width : active ? 2 : 1
18
- border .color : " #888"
19
16
radius: 4
20
- color: active ? active_color : back_color
17
+ color: " #888"
18
+
19
+ Rectangle {
20
+ width: parent .width
21
+ height: parent .height
22
+ x: pressed ? - 0 : - 1
23
+ y: pressed ? - 0 : - 1
24
+ radius: parent .radius
25
+ border .width : 1
26
+ border .color : parent .color
27
+ color: mouseArea .containsMouse ? active_color : back_color
28
+
29
+ Text {
30
+ id: label
31
+ text: " Foo"
32
+ anchors .fill : parent
33
+ anchors .centerIn : parent
34
+ font .pixelSize : height* 0.55
35
+ color: font_color
36
+ font .bold : true
37
+ // Workaround: Text.AutoText doesn't seem to work for properties (?)
38
+ textFormat: text .indexOf (" >" ) == - 1 ? Text .PlainText : Text .RichText
39
+ verticalAlignment: Text .AlignVCenter
40
+ horizontalAlignment: Text .AlignHCenter
41
+ }
42
+ }
21
43
22
44
onPressedChanged: {
23
45
if (pressed)
@@ -37,20 +59,6 @@ Rectangle {
37
59
}
38
60
}
39
61
40
- Text {
41
- id: label
42
- text: " Foo"
43
- anchors .fill : parent
44
- anchors .centerIn : parent
45
- font .pixelSize : height* 0.55
46
- color: font_color
47
- font .bold : true
48
- // Workaround: Text.AutoText doesn't seem to work for properties (?)
49
- textFormat: text .indexOf (" >" ) == - 1 ? Text .PlainText : Text .RichText
50
- verticalAlignment: Text .AlignVCenter
51
- horizontalAlignment: Text .AlignHCenter
52
- }
53
-
54
62
// This is needed to support pressing multiple buttons at once on multitouch
55
63
MultiPointTouchArea {
56
64
id: multiMouseArea
0 commit comments