-
Notifications
You must be signed in to change notification settings - Fork 2
/
OptionButton.qml
49 lines (43 loc) · 1.18 KB
/
OptionButton.qml
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
import QtQuick 2.12
import QtQuick.Window 2.2
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.12
Rectangle {
id: button
property string lightIcon: ""
property string darkIcon: ""
color: parent.Material.background
opacity: 0.8
enabled: true
Control {
id: ctr
anchors.fill: parent
padding: parent.height/3.2
contentItem: Image {
id: img
fillMode: Image.PreserveAspectFit
source: application.lightThemeOn ? darkIcon: lightIcon
sourceSize.width: parent.width
sourceSize.height: parent.height/optionBar.totalOptions
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Material.elevation: 10
}
}
MouseArea {
id: mouse
anchors.fill: parent
hoverEnabled: true
onClicked: onButtonClicked()
}
states: State {
name: "hovered"
when: mouse.containsMouse
PropertyChanges {
target: button
color: application.lightThemeOn ? "#bfbfbf" : "#4d4d4d"
opacity: 1
restoreEntryValues: true
}
}
}