Update UI

This commit is contained in:
kateleet 2021-12-16 23:26:56 +08:00
parent 7551ff92b9
commit 2dc6ba4612
2 changed files with 37 additions and 18 deletions

View file

@ -32,9 +32,19 @@ Item {
signal itemClicked(string path) signal itemClicked(string path)
signal editorAccepted(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 { ListView {
id: _pathView id: _pathView
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 2
anchors.bottomMargin: 2
model: _pathBarModel model: _pathBarModel
orientation: Qt.Horizontal orientation: Qt.Horizontal
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
@ -49,14 +59,6 @@ Item {
_pathView.positionViewAtEnd() _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 { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
@ -64,10 +66,19 @@ Item {
z: -1 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 { delegate: MouseArea {
id: _item id: _item
height: ListView.view.height height: ListView.view.height - ListView.view.topMargin - ListView.view.bottomMargin
width: _name.width + FishUI.Units.largeSpacing width: _name.width + FishUI.Units.largeSpacing
hoverEnabled: true
z: -1 z: -1
property bool selected: index === _pathView.count - 1 property bool selected: index === _pathView.count - 1
@ -76,17 +87,22 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 2 radius: FishUI.Theme.mediumRadius
anchors.bottomMargin: 2 color: _item.pressed ? Qt.rgba(FishUI.Theme.textColor.r,
color: FishUI.Theme.highlightColor FishUI.Theme.textColor.g,
radius: FishUI.Theme.smallRadius FishUI.Theme.textColor.b, FishUI.Theme.darkMode ? 0.05 : 0.1) :
visible: selected _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 { Label {
id: _name id: _name
text: model.name text: model.name
color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor color: FishUI.Theme.textColor
anchors.centerIn: parent anchors.centerIn: parent
} }
} }

View file

@ -58,7 +58,10 @@ ListView {
highlight: Rectangle { highlight: Rectangle {
radius: FishUI.Theme.mediumRadius 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" section.property: "category"
@ -182,7 +185,7 @@ ListView {
width: height width: height
sourceSize: Qt.size(22, 22) sourceSize: Qt.size(22, 22)
// source: "image://icontheme/" + model.iconName // 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 Layout.alignment: Qt.AlignVCenter
smooth: false smooth: false
antialiasing: true antialiasing: true
@ -191,7 +194,7 @@ ListView {
Label { Label {
id: _label id: _label
text: model.name text: model.name
color: checked ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor color: FishUI.Theme.textColor
elide: Text.ElideRight elide: Text.ElideRight
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter