Bug 467390

Summary: Use of checkboxes for mutually exclusive menu items is very misleading
Product: [Frameworks and Libraries] frameworks-qqc2-desktop-style Reporter: Emir SARI <emir_sari>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, kde, nate, noahadvs, notmart
Priority: NOR Keywords: usability
Version: 5.104.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.105
Sentry Crash Report:

Description Emir SARI 2023-03-15 10:55:58 UTC
The check boxes in sort drop-down menus give the idea that there could be multiple sort algorithms. However this is not the case. The menus should use radio button shaped entries to indicate that there is only one search criteria.
Comment 1 Nate Graham 2023-03-15 18:33:12 UTC
Yes, this is not ideal and currently it's a limitation of the QQC2 menu. It shows checkboxes rather than radio buttons for technically-checkable-but-also-mutually exclusive list items.
Comment 2 Arjen Hiemstra 2023-03-15 23:18:14 UTC
Note that this is fixable by creating an ActionGroup outside the menu and using the `ActionGroup.group` attached property to put actions into that group. See https://invent.kde.org/plasma/plasma-systemmonitor/-/blob/master/src/faces/processtable/contents/ui/FullRepresentation.qml#L130 for an example.
Comment 3 ratijas 2023-03-31 22:58:07 UTC
Git commit 9dadd05de66a135ea0c3c66c6bb554ab22ec6a67 by ivan tkachenko.
Committed on 31/03/2023 at 22:56.
Pushed by ratijas into branch 'master'.

CheckIndicator: Allow exclusive buttons to be detected via their ButtonGroup

This is a bit wasteful, as it creates a ButtonGroup attached object for
every menu item that does not have it. But it works. Unfortunately,
there is no better approach, as if ButtonGroup is bound to an item
later than this binding is established, we won't know about it.

All components using CheckIndicator, except MenuItem, were modified to
override this new more advanced heuristic with a fixed elementType, so
they don't waste memory on attached objects, and always have
predictable appearance.

See also: https://invent.kde.org/frameworks/kirigami/-/merge_requests/1014

M  +1    -0    org.kde.desktop/CheckBox.qml
M  +1    -0    org.kde.desktop/CheckDelegate.qml
M  +6    -1    org.kde.desktop/CheckIndicator.qml
M  +1    -0    org.kde.desktop/RadioButton.qml
M  +1    -0    org.kde.desktop/RadioDelegate.qml
A  +135  -0    tests/exclusive-menuitem.qml     [License: GPL(v2.0+) LGPL(v3.0)]

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/9dadd05de66a135ea0c3c66c6bb554ab22ec6a67
Comment 4 ratijas 2023-03-31 23:00:29 UTC
Git commit 7bff5123264ab1f3122294c95bd1fab40fb0a6d3 by ivan tkachenko.
Committed on 31/03/2023 at 22:59.
Pushed by ratijas into branch 'kf5'.

CheckIndicator: Allow exclusive buttons to be detected via their ButtonGroup

This is a bit wasteful, as it creates a ButtonGroup attached object for
every menu item that does not have it. But it works. Unfortunately,
there is no better approach, as if ButtonGroup is bound to an item
later than this binding is established, we won't know about it.

All components using CheckIndicator, except MenuItem, were modified to
override this new more advanced heuristic with a fixed elementType, so
they don't waste memory on attached objects, and always have
predictable appearance.

See also: https://invent.kde.org/frameworks/kirigami/-/merge_requests/1014

M  +1    -0    org.kde.desktop/CheckBox.qml
M  +1    -0    org.kde.desktop/CheckDelegate.qml
M  +6    -1    org.kde.desktop/CheckIndicator.qml
M  +1    -0    org.kde.desktop/RadioButton.qml
M  +1    -0    org.kde.desktop/RadioDelegate.qml
A  +135  -0    tests/exclusive-menuitem.qml     [License: GPL(v2.0+) LGPL(v3.0)]

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/7bff5123264ab1f3122294c95bd1fab40fb0a6d3