diff --git a/images/dark/backspace.svg b/images/dark/backspace.svg new file mode 100644 index 0000000..4a77327 --- /dev/null +++ b/images/dark/backspace.svg @@ -0,0 +1,64 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/images/light/backspace.svg b/images/light/backspace.svg new file mode 100644 index 0000000..5ff8825 --- /dev/null +++ b/images/light/backspace.svg @@ -0,0 +1,62 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/qml.qrc b/qml.qrc index 2eb68fa..3501cdd 100644 --- a/qml.qrc +++ b/qml.qrc @@ -4,5 +4,7 @@ qml/Zone.qml qml/StandardButton.qml qml/StandardPad.qml + images/light/backspace.svg + images/dark/backspace.svg diff --git a/qml/StandardButton.qml b/qml/StandardButton.qml index c383a5f..b0dea99 100644 --- a/qml/StandardButton.qml +++ b/qml/StandardButton.qml @@ -9,13 +9,14 @@ Item { signal clicked(string text) property string text + property var icon property alias textColor: _label.color property bool flat: false Layout.fillWidth: true Layout.fillHeight: true - property color backgroundColor: Meui.Theme.secondBackgroundColor + property color backgroundColor: Meui.Theme.backgroundColor property color hoveredColor: Meui.Theme.darkMode ? Qt.lighter(Meui.Theme.backgroundColor, 1.1) : Qt.darker(Meui.Theme.backgroundColor, 1.1) property color pressedColor: Meui.Theme.darkMode ? Qt.darker(Meui.Theme.backgroundColor, 1.05) @@ -44,6 +45,17 @@ Item { onClicked: control.clicked(control.text) } + Image { + id: _icon + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + width: control.height * 0.4 + height: width + sourceSize: Qt.size(width, height) + source: control.icon ? control.icon : "" + visible: _icon.status === Image.Ready + } + Label { id: _label anchors.horizontalCenter: parent.horizontalCenter @@ -52,6 +64,7 @@ Item { horizontalAlignment: Text.AlignHCenter color: !flat ? Meui.Theme.textColor : Meui.Theme.highlightedTextColor text: control.text + visible: !_icon.visible minimumPointSize: Math.round(control.height / 5) font.pointSize: Math.round(control.height / 5) } diff --git a/qml/StandardPad.qml b/qml/StandardPad.qml index 889300e..f63d3c8 100644 --- a/qml/StandardPad.qml +++ b/qml/StandardPad.qml @@ -11,13 +11,16 @@ Item { GridLayout { id: _mainLayout anchors.fill: parent - columnSpacing: 1 - rowSpacing: 1 + columnSpacing: 2 + rowSpacing: 2 columns: 4 StandardButton { text: "C"; onClicked: control.pressed(text) } + StandardButton { + icon: Meui.Theme.darkMode ? "qrc:/images/dark/backspace.svg" : "qrc:/images/light/backspace.svg" + onClicked: control.pressed("BACKSPACE") + } StandardButton { text: "%"; onClicked: control.pressed(text) } - StandardButton { text: "←"; onClicked: control.pressed(text) } StandardButton { text: "÷"; textColor: Meui.Theme.highlightColor; onClicked: control.pressed(text) } StandardButton { text: "7"; onClicked: control.pressed(text) } StandardButton { text: "8"; onClicked: control.pressed(text) } diff --git a/qml/Zone.qml b/qml/Zone.qml index f96ec38..85d98b5 100644 --- a/qml/Zone.qml +++ b/qml/Zone.qml @@ -92,7 +92,7 @@ Item { textField.clear() else historyModel.clear() - } else if (text === 'BACK') { + } else if (text === 'BACKSPACE') { // backspace textField.remove(textField.cursorPosition, textField.cursorPosition - 1) } else { diff --git a/qml/main.qml b/qml/main.qml index 44c8b3d..b512a56 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -13,15 +13,8 @@ Meui.Window { title: qsTr("Calculator") id: rootWindow - backgroundColor: Meui.Theme.secondBackgroundColor - backgroundOpacity: Meui.Theme.darkMode ? 0.9 : 0.7 - - Meui.WindowBlur { - view: rootWindow - enabled: true - geometry: Qt.rect(rootWindow.x, rootWindow.y, rootWindow.width, rootWindow.height) - windowRadius: rootWindow.windowRadius - } + backgroundColor: Meui.Theme.darkMode ? Qt.rgba(46 / 255, 46 / 255, 46 / 255, 1.0) + : Qt.rgba(240 / 255, 238 / 255, 241 / 255, 1.0) CalcEngine { id: calcEngine