From 5f879bab40b210b9bb41b5b8ec40a03486ff0192 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Wed, 29 Nov 2023 15:50:17 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E4=BD=BF=E7=94=A8UkuiItems.Button?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/AppUI/Sidebar.qml | 56 ++++++++++--------------------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/qml/AppUI/Sidebar.qml b/qml/AppUI/Sidebar.qml index 6447fff..fea7504 100644 --- a/qml/AppUI/Sidebar.qml +++ b/qml/AppUI/Sidebar.qml @@ -35,8 +35,9 @@ Item { anchors.bottomMargin: 12 spacing: 0 - MouseArea { + UkuiItems.Button { id: fullScreenbutton + visible: !isLiteMode Layout.preferredWidth: 36 Layout.preferredHeight: 36 @@ -46,10 +47,6 @@ Item { ToolTip.text: qsTr("Expand") ToolTip.visible: containsMouse - visible: !isLiteMode - hoverEnabled: true - activeFocusOnTab: true - onClicked: mainWindow.isFullScreen = true Keys.onPressed: { if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { @@ -57,24 +54,12 @@ Item { } } - UkuiItems.StyleBackground { - anchors.fill: parent - radius: 4 - useStyleTransparency: false - paletteRole: UkuiItems.Theme.Button - alpha: parent.containsPress ? 1 : parent.containsMouse ? 0.7 : 0 - borderColor: UkuiItems.Theme.Highlight - border.width: parent.activeFocus ? 2 : 0 - - ThemeIcon { - anchors.centerIn: parent - width: 16; height: 16 - source: "view-fullscreen-symbolic" - } - } + background.radius: 4 + icon.mode: UkuiItems.Icon.AutoHighlight + icon.source: "view-fullscreen-symbolic" } - MouseArea { + UkuiItems.Button { id: powerButton Layout.preferredWidth: 36 Layout.preferredHeight: 36 @@ -84,8 +69,10 @@ Item { ToolTip.visible: containsMouse ToolTip.text: powerButtonBase.toolTip - hoverEnabled: true - activeFocusOnTab: true + PowerButton { + id: powerButtonBase + } + acceptedButtons: Qt.LeftButton | Qt.RightButton property int spacingFromMenu: 16 @@ -100,26 +87,9 @@ Item { powerButtonBase.clicked(mouse.button === Qt.LeftButton, buttonPosition.x + spacingFromMenu, buttonPosition.y + spacingFromMenu, mainWindow.isFullScreen); } - UkuiItems.StyleBackground { - anchors.fill: parent - paletteRole: UkuiItems.Theme.Button - useStyleTransparency: false - alpha: parent.containsPress ? 1 : parent.containsMouse ? 0.7 : 0 - radius: 4 - borderColor: UkuiItems.Theme.Highlight - border.width: parent.activeFocus ? 2 : 0 - - PowerButton { - id: powerButtonBase - } - - ThemeIcon { - anchors.centerIn: parent - width: 16 - height: 16 - source: powerButtonBase.icon - } - } + background.radius: 4 + icon.mode: UkuiItems.Icon.AutoHighlight + icon.source: powerButtonBase.icon } } }