From 2dc6ba4612107b16c4a0ba39f8e3768df3ec567f Mon Sep 17 00:00:00 2001 From: kateleet Date: Thu, 16 Dec 2021 23:26:56 +0800 Subject: [PATCH] Update UI --- qml/PathBar.qml | 46 +++++++++++++++++++++++++++++++--------------- qml/SideBar.qml | 9 ++++++--- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/qml/PathBar.qml b/qml/PathBar.qml index 0be3bed..cddc02e 100644 --- a/qml/PathBar.qml +++ b/qml/PathBar.qml @@ -32,9 +32,19 @@ Item { signal itemClicked(string path) signal editorAccepted(string path) + Rectangle { + anchors.fill: parent + color: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.secondBackgroundColor, 1.3) + : FishUI.Theme.secondBackgroundColor + radius: FishUI.Theme.smallRadius + z: -1 + } + ListView { id: _pathView anchors.fill: parent + anchors.topMargin: 2 + anchors.bottomMargin: 2 model: _pathBarModel orientation: Qt.Horizontal layoutDirection: Qt.LeftToRight @@ -49,14 +59,6 @@ Item { _pathView.positionViewAtEnd() } - Rectangle { - anchors.fill: parent - color: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.secondBackgroundColor, 1.3) - : FishUI.Theme.secondBackgroundColor - radius: FishUI.Theme.smallRadius - z: -1 - } - MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton @@ -64,10 +66,19 @@ Item { z: -1 } + highlight: Rectangle { + radius: FishUI.Theme.mediumRadius + color: Qt.rgba(FishUI.Theme.textColor.r, + FishUI.Theme.textColor.g, + FishUI.Theme.textColor.b, 0.1) + smooth: true + } + delegate: MouseArea { id: _item - height: ListView.view.height + height: ListView.view.height - ListView.view.topMargin - ListView.view.bottomMargin width: _name.width + FishUI.Units.largeSpacing + hoverEnabled: true z: -1 property bool selected: index === _pathView.count - 1 @@ -76,17 +87,22 @@ Item { Rectangle { anchors.fill: parent - anchors.topMargin: 2 - anchors.bottomMargin: 2 - color: FishUI.Theme.highlightColor - radius: FishUI.Theme.smallRadius - visible: selected + radius: FishUI.Theme.mediumRadius + color: _item.pressed ? Qt.rgba(FishUI.Theme.textColor.r, + FishUI.Theme.textColor.g, + FishUI.Theme.textColor.b, FishUI.Theme.darkMode ? 0.05 : 0.1) : + _item.containsMouse ? Qt.rgba(FishUI.Theme.textColor.r, + FishUI.Theme.textColor.g, + FishUI.Theme.textColor.b, FishUI.Theme.darkMode ? 0.1 : 0.05) : + "transparent" + + smooth: true } Label { id: _name text: model.name - color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor + color: FishUI.Theme.textColor anchors.centerIn: parent } } diff --git a/qml/SideBar.qml b/qml/SideBar.qml index 02dbaa6..8d8b879 100644 --- a/qml/SideBar.qml +++ b/qml/SideBar.qml @@ -58,7 +58,10 @@ ListView { highlight: Rectangle { radius: FishUI.Theme.mediumRadius - color: FishUI.Theme.highlightColor + color: Qt.rgba(FishUI.Theme.textColor.r, + FishUI.Theme.textColor.g, + FishUI.Theme.textColor.b, 0.1) + smooth: true } section.property: "category" @@ -182,7 +185,7 @@ ListView { width: height sourceSize: Qt.size(22, 22) // source: "image://icontheme/" + model.iconName - source: "qrc:/images/" + (FishUI.Theme.darkMode || _item.checked ? "dark/" : "light/") + model.iconPath + source: "qrc:/images/" + (FishUI.Theme.darkMode ? "dark/" : "light/") + model.iconPath Layout.alignment: Qt.AlignVCenter smooth: false antialiasing: true @@ -191,7 +194,7 @@ ListView { Label { id: _label text: model.name - color: checked ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor + color: FishUI.Theme.textColor elide: Text.ElideRight Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter