blob: 953424a497c83895d095652aa14969edeee6c453 (
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
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//Import the declarative plugins
import QtQuick
//Implementation of the Button control.
Item {
id: button
width: 30
height: 100
property alias text: innerText.text
signal clicked
Image {
id: backgroundImage
anchors.fill: parent
source: (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png")
}
Text {
id: innerText
anchors.centerIn: parent
color: "white"
font.bold: true
}
//Mouse area to react on click events
MouseArea {
anchors.fill: button
onClicked: { button.clicked();}
onPressed: {
backgroundImage.source = "images/button_background_pressed.png" }
onReleased: {
backgroundImage.source = (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png")
}
}
}
|