Skip to content

Commit

Permalink
fix: [UI] adjust combobox UI pop style
Browse files Browse the repository at this point in the history
  [UI] adjust combobox UI pop style

Log: [UI] adjust combobox UI popstyle
Bug: https://pms.uniontech.com/bug-view-168279.html
  • Loading branch information
starhcq committed Jul 24, 2024
1 parent a1d4f87 commit fa23f3b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
35 changes: 34 additions & 1 deletion src/qml/Control/FilterComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import QtQml 2.11
import org.deepin.dtk 1.0

import org.deepin.dtk.style 1.0 as DS

ComboBox {
id: comboBox
textRole: "text"
iconNameRole: "icon"
flat: true
Expand All @@ -20,5 +21,37 @@ ComboBox {
ListElement { text: qsTr("Photos"); icon: "images" }
ListElement { text: qsTr("Videos"); icon: "videos" }
}

delegate: MenuItem {
useIndicatorPadding: true
width: parent.width
text: comboBox.textRole ? (Array.isArray(comboBox.model) ? modelData[comboBox.textRole] : model[comboBox.textRole]) : modelData
icon.name: (comboBox.iconNameRole && model[comboBox.iconNameRole] !== undefined) ? model[comboBox.iconNameRole] : null
highlighted: comboBox.highlightedIndex === index
hoverEnabled: comboBox.hoverEnabled
autoExclusive: true
checked: comboBox.currentIndex === index
}

// 为符合UI效果,弹框宽度比下拉框宽度略大
popup: Popup {
clip: true
x: -15
implicitWidth: comboBox.width + 15
contentItem: ArrowListView {
maxVisibleItems: comboBox.maxVisibleItems
view.model: comboBox.delegateModel
view.currentIndex: comboBox.highlightedIndex
view.highlightRangeMode: ListView.ApplyRange
view.highlightMoveDuration: 0
}

background: FloatingPanel {
implicitWidth: DS.Style.menu.item.width
implicitHeight: DS.Style.menu.item.height
radius: DS.Style.menu.radius
backgroundColor: DS.Style.menu.background
}
}
}

3 changes: 1 addition & 2 deletions src/qml/ThumbnailImageView/CollecttionView/AllCollection.qml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ Item {
topMargin: 4
right: parent.right
}
width: 130
width: 115
height: 30
visible: parent.visible && albumControl.getAllCount() !== 0
//visible: !(numLabelText === "" && filterType === 0)
}

MouseArea {
Expand Down
2 changes: 1 addition & 1 deletion src/qml/ThumbnailImageView/CustomAlbum/CustomAlbum.qml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ BaseView {
topMargin: 4
right: parent.right
}
width: 130
width: 115
height: 30
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ BaseView {
topMargin: 4
right: parent.right
}
width: 130
width: 115
height: 30
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ BaseView {
topMargin: 4
right: parent.right
}
width: 130
width: 115
height: 30
visible: (!theView.haveSelect && totalCount > 0) || totalCount === 0
}
Expand Down

0 comments on commit fa23f3b

Please sign in to comment.