Bug 426001 - Give BasicListItem the ability to display a checkbox
Summary: Give BasicListItem the ability to display a checkbox
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kirigami
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.70.0
Platform: Other Linux
: NOR normal
Target Milestone: Not decided
Assignee: Nate Graham
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-30 18:17 UTC by Nate Graham
Modified: 2021-03-12 23:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2020-08-30 18:17:44 UTC
The parent item (AbstractListItem) can already be checkable. It would be nice if the list item itself would display a checkbox for this case.

Something like this I guess:


diff --git src/controls/BasicListItem.qml src/controls/BasicListItem.qml
index 2591a5c..968413d 100644
--- src/controls/BasicListItem.qml
+++ src/controls/BasicListItem.qml
@@ -87,6 +87,13 @@ AbstractListItem {
     contentItem: RowLayout {
         id: layout
         spacing: LayoutMirroring.enabled ? listItem.rightPadding : listItem.leftPadding
+        QQC2.CheckBox {
+            visible: listItem.checkable
+            checked: visible ? listItem.checked : undefined
+            onToggled: {
+                listItem.action.checked = true;
+            }
+        }
         Icon {
             id: iconItem
             source: {
Comment 1 Bug Janitor Service 2020-08-30 18:50:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/89
Comment 2 Nate Graham 2021-03-12 23:45:14 UTC
We now have a subclass called CheckableListitem which provides this.