Skip to content

Commit 2b26132

Browse files
committed
fix: fix the issue where multiple applications remain selected after long-pressing the launcher
1. Add interactionPressed and interactionHovered properties to ItemBackground 2. Use HoverHandler for explicit mouse hover detection in list views 3. Replace direct ColorSelector state check with controlled interaction properties 4. Apply consistent interaction state binding in AppListView and FreeSortListView Log: Fix multiple apps incorrectly staying in selected state after consecutive long presses fix: 修复启动器长按多个应用后多个应用保持选中状态 1. 为 ItemBackground 添加 interactionPressed 和 interactionHovered 属性 2. 使用 HoverHandler 显式检测鼠标悬停状态 3. 用可控的交互属性替代直接检查 ColorSelector 状态 4. 在 AppListView 和 FreeSortListView 中统一绑定交互状态 Log: 修复启动器长按多个应用后多个应用错误保持选中状态的问题 PMS: BUG-364529
1 parent 7db028f commit 2b26132

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

qml/windowed/AppListView.qml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ FocusScope {
206206
ColorSelector.pressed: false
207207
property Palette textColor: DStyle.Style.button.text
208208
palette.windowText: ColorSelector.textColor
209+
ColorSelector.hovered: itemHoverHandler.hovered
210+
211+
HoverHandler {
212+
id: itemHoverHandler
213+
}
214+
209215
ToolTip.text: text
210216
ToolTip.delay: 500
211217
ToolTip.visible: hovered && contentItem.implicitWidth > contentItem.width
@@ -261,6 +267,8 @@ FocusScope {
261267
implicitWidth: DStyle.Style.itemDelegate.width
262268
implicitHeight: Helper.windowed.listItemHeight
263269
button: itemDelegate
270+
interactionPressed: mouseArea.pressed
271+
interactionHovered: itemHoverHandler.hovered
264272
}
265273
}
266274
Keys.onReturnPressed: {

qml/windowed/FreeSortListView.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ Item {
302302
property Palette textColor: DStyle.Style.button.text
303303
palette.windowText: ColorSelector.textColor
304304
opacity: !Drag.active && (typeof dndItem === "undefined" || dndItem.currentlyDraggedId !== model.desktopId) ? 1 : 0
305+
ColorSelector.hovered: itemHoverHandler.hovered
306+
307+
HoverHandler {
308+
id: itemHoverHandler
309+
}
305310

306311
ToolTip.text: text
307312
ToolTip.delay: 500
@@ -323,6 +328,8 @@ Item {
323328
implicitWidth: DStyle.Style.itemDelegate.width
324329
implicitHeight: Helper.windowed.listItemHeight
325330
button: itemDelegate
331+
interactionPressed: mouseArea.pressed
332+
interactionHovered: itemHoverHandler.hovered
326333
}
327334

328335
MouseArea {

qml/windowed/ItemBackground.qml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -12,6 +12,8 @@ D.BoxPanel {
1212
id: control
1313
property Item button
1414
property D.Palette background: Helper.itemBackground
15+
property bool interactionPressed: control.D.ColorSelector.controlState === D.DTK.PressedState
16+
property bool interactionHovered: control.D.ColorSelector.controlState === D.DTK.HoveredState
1517

1618
implicitWidth: DS.Style.toolButton.width
1719
implicitHeight: DS.Style.toolButton.height
@@ -24,7 +26,7 @@ D.BoxPanel {
2426
if (typeof dndItem !== "undefined" && dndItem.currentlyDraggedId !== "") {
2527
return false
2628
}
27-
return button.checked || button.highlighted || button.visualFocus || control.D.ColorSelector.controlState === D.DTK.PressedState || control.D.ColorSelector.controlState === D.DTK.HoveredState
29+
return button.checked || button.highlighted || button.visualFocus || interactionPressed || interactionHovered
2830
}
2931

3032
function selectValue(normal, checked, highlighted) {

0 commit comments

Comments
 (0)