Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
ListView with Checkbox and FolderListModel
QuantumCD last edited by
I've been working on a ListView in QML which is the central part of my application. I'm looking to add a checkbox to the delegates. I got the checkboxes set up with a state and transition, as well as images, and everything is positioned correctly. The part I'm stumped on is adding a variable such as isChecked so that I can pull the value from the model and apply it to the delegate. Also, I'll need to use this value later to remove the files from the ListView and underlying directory based on the boolean.
I know I could probably do this with a custom C++ type somehow, but I don't know how exactly to go about subclassing FolderListModel specifically. The functionality wouldn't be too complex--just a boolean member with a property or something I would guess. Before I go to the trouble, would there be an easier way? I have a hunch that there is someway to add a value to the model after-the-fact; then I could read it from the same model in the delegate (I believe). However, I wouldn't know exactly how to go about that either, unfortunately. I'm relatively new to QML, so forgive me in advance if there are some very basic things I have yet to figure out/learn while trying out relatively complex features of the language.