Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.12.8
-
None
Description
I have created one ListModel containing name, checkableData and checkedData as roles. When setting the model to the ListView containing CheckBox as delegate with checkable as false, the checkable property doesn't work and allow me to check/uncheck the CheckBox. This happens only when using the model and when the checked state is set to true. Here is the example code for reference:
import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") ListModel { id: fruitModel ListElement { name: "Apple" checkedData: true checkableData: false } ListElement { name: "Orange" checkedData: false checkableData: false } ListElement { name: "Banana" checkedData: true checkableData: false } } ListView { anchors.fill: parent model: fruitModel snapMode: ListView.NoSnap boundsBehavior: ListView.StopAtBounds headerPositioning: ListView.OverlayHeader ScrollBar.vertical: ScrollBar { id: scrollBar policy: ScrollBar.AsNeeded } delegate: CheckBox { checkable: checkableData text: name checked: checkedData } spacing: 5 orientation: ListView.Vertical interactive: false } }
Attachments
Issue Links
- duplicates
-
QTBUG-93807 Forced 'checkable' property of ItemDelegate interferes with editable models
- Closed