Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion qt6/src/qml/ComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ T.ComboBox {
property int maxVisibleItems : DS.Style.comboBox.maxVisibleItems
property D.Palette separatorColor: DS.Style.comboBox.edit.separator
property var horizontalAlignment: control.flat ? Text.AlignRight : Text.AlignLeft
property bool mouseInPopupContent: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qwidget的combobox没有这种样式,鼠标一周后,高亮消失的,等之后确认了再看,
另外这个应该不需要对外暴露吧,那属性加上"__"这种表示私有属性,另外这个名字要不要换一个,它的含义是popup有没有hovered吧,

opacity: enabled ? 1.0 : 0.4

implicitWidth: DS.Style.control.implicitWidth(control)
Expand All @@ -34,12 +35,16 @@ T.ComboBox {
useIndicatorPadding: true
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : (model[control.textRole] === undefined ? modelData[control.textRole] : model[control.textRole])) : modelData
icon.name: (control.iconNameRole && model[control.iconNameRole] !== undefined) ? model[control.iconNameRole] : null
highlighted: control.highlightedIndex === index
highlighted: control.mouseInPopupContent && control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
autoExclusive: true
checked: control.currentIndex === index
}

onHighlightedIndexChanged: {
mouseInPopupContent = true
}

indicator: Loader {
sourceComponent: control.editable ? editableIndicator : normalIndicator
x: control.mirrored ? control.padding : control.width - width - control.padding
Expand Down Expand Up @@ -172,6 +177,12 @@ T.ComboBox {
view.currentIndex: control.highlightedIndex
view.highlightRangeMode: ListView.ApplyRange
view.highlightMoveDuration: 0

HoverHandler {
onHoveredChanged: {
control.mouseInPopupContent = hovered
}
}
}

background: FloatingPanel {
Expand Down