From 44a8797cf400c8b4cc98af92a54a85df9ed2b88a Mon Sep 17 00:00:00 2001 From: reionwong Date: Wed, 23 Jun 2021 13:03:58 +0800 Subject: [PATCH] Use the new FishUI API --- qml/StandardPad.qml | 4 ++-- qml/Zone.qml | 2 +- qml/main.qml | 23 +++++++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/qml/StandardPad.qml b/qml/StandardPad.qml index 954f5ab..3f22d22 100644 --- a/qml/StandardPad.qml +++ b/qml/StandardPad.qml @@ -11,8 +11,8 @@ Item { GridLayout { id: _mainLayout anchors.fill: parent - columnSpacing: 2 - rowSpacing: 2 + columnSpacing: 1 + rowSpacing: 1 columns: 4 StandardButton { text: "C"; onClicked: control.pressed(text) } diff --git a/qml/Zone.qml b/qml/Zone.qml index c478933..05e4b86 100644 --- a/qml/Zone.qml +++ b/qml/Zone.qml @@ -53,7 +53,7 @@ Item { TextField { id: textField - height: 50 + Layout.preferredHeight: 50 Layout.fillWidth: true Keys.onReturnPressed: appendToTextField('=') Keys.onEnterPressed: appendToTextField('=') diff --git a/qml/main.qml b/qml/main.qml index e508c88..31f10b7 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -5,16 +5,23 @@ import Cutefish.Calculator 1.0 import FishUI 1.0 as FishUI FishUI.Window { - visible: true + id: rootWindow width: 350 height: 550 minimumWidth: 350 minimumHeight: 550 title: qsTr("Calculator") - id: rootWindow - backgroundColor: FishUI.Theme.darkMode ? Qt.rgba(46 / 255, 46 / 255, 46 / 255, 1.0) - : Qt.rgba(240 / 255, 238 / 255, 241 / 255, 1.0) + background.color: FishUI.Theme.darkMode ? Qt.rgba(46 / 255, 46 / 255, 46 / 255, 1.0) + : Qt.rgba(240 / 255, 238 / 255, 241 / 255, 1.0) + background.opacity: rootWindow.compositing ? 0.9 : 1.0 + + FishUI.WindowBlur { + view: rootWindow + geometry: Qt.rect(rootWindow.x, rootWindow.y, rootWindow.width, rootWindow.height) + windowRadius: rootWindow.background.radius + enabled: true + } CalcEngine { id: calcEngine @@ -37,6 +44,14 @@ FishUI.Window { StandardPad { Layout.fillWidth: true Layout.fillHeight: true + + Rectangle { + z: -1 + anchors.fill: parent + color: rootWindow.background.color + opacity: 0.4 + } + onPressed: zone.appendToTextField(text) } }