wowlet/src/vr/qml/common/MyNumPad.qml

138 lines
2.8 KiB
QML
Raw Normal View History

2021-04-05 11:37:41 +00:00
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import "."
ColumnLayout {
id: root
enabled: true
2021-04-09 16:00:12 +00:00
spacing: 16
2021-04-05 11:37:41 +00:00
property double disabledOpacity: 0.4
2021-04-09 16:00:12 +00:00
property bool compact: false
2021-04-05 11:37:41 +00:00
signal resolvePressed();
2021-04-09 16:00:12 +00:00
signal buttonPress(string val);
signal clearPress();
2021-04-05 11:37:41 +00:00
RowLayout {
2021-04-09 16:00:12 +00:00
spacing: 18
2021-04-05 11:37:41 +00:00
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "1"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("1");
2021-04-05 11:37:41 +00:00
}
}
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "2"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("2");
2021-04-05 11:37:41 +00:00
}
}
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "3"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("3");
2021-04-05 11:37:41 +00:00
}
}
}
RowLayout {
2021-04-09 16:00:12 +00:00
spacing: 18
2021-04-05 11:37:41 +00:00
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "4"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("4");
2021-04-05 11:37:41 +00:00
}
}
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "5"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("5");
2021-04-05 11:37:41 +00:00
}
}
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "6"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("6");
2021-04-05 11:37:41 +00:00
}
}
}
RowLayout {
2021-04-09 16:00:12 +00:00
spacing: 18
2021-04-05 11:37:41 +00:00
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "7"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("7");
2021-04-05 11:37:41 +00:00
}
}
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "8"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("8");
2021-04-05 11:37:41 +00:00
}
}
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "9"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("9");
2021-04-05 11:37:41 +00:00
}
}
}
RowLayout {
2021-04-09 16:00:12 +00:00
spacing: 18
2021-04-05 11:37:41 +00:00
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
text: "0"
onClicked: {
2021-04-09 16:00:12 +00:00
buttonPress("0");
}
}
MyNumPadButton {
visible: root.compact
opacity: root.enabled ? 1 : disabledOpacity
text: "."
onClicked: {
buttonPress(".");
2021-04-05 11:37:41 +00:00
}
}
MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity
2021-04-09 16:00:12 +00:00
Layout.preferredWidth: root.compact ? 106 : 230
fontSize: 36
2021-04-09 16:00:12 +00:00
text: root.compact ? "C" : "Clear"
2021-04-05 11:37:41 +00:00
onClicked: {
2021-04-09 16:00:12 +00:00
clearPress();
2021-04-05 11:37:41 +00:00
}
}
}
2021-04-09 16:00:12 +00:00
function reset() {
}
2021-04-05 11:37:41 +00:00
}