From b1db3b839ebe45c7ce0d6e66d149839c7e064ded Mon Sep 17 00:00:00 2001 From: xiepengfei Date: Fri, 6 Feb 2026 17:06:54 +0800 Subject: [PATCH] fix: Fix the issue where the dropdown remains highlighted after being moved out Fix the issue where the dropdown remains highlighted after being moved out Log: Fix the issue where the dropdown remains highlighted after being moved out pms: BUG-304991 --- qt6/src/qml/ComboBox.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qt6/src/qml/ComboBox.qml b/qt6/src/qml/ComboBox.qml index f8f46483..181bc396 100644 --- a/qt6/src/qml/ComboBox.qml +++ b/qt6/src/qml/ComboBox.qml @@ -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 opacity: enabled ? 1.0 : 0.4 implicitWidth: DS.Style.control.implicitWidth(control) @@ -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 @@ -172,6 +177,12 @@ T.ComboBox { view.currentIndex: control.highlightedIndex view.highlightRangeMode: ListView.ApplyRange view.highlightMoveDuration: 0 + + HoverHandler { + onHoveredChanged: { + control.mouseInPopupContent = hovered + } + } } background: FloatingPanel {