Example of model/view with custom widget
-
Hi to all,
I'm trying to create a imaging-like software but I'm stuck on the model view system. My idea is to create a model which contains on each row a layer with the parameters but I cannot find an example with something like this:
https://s32.postimg.org/nc98he205/Untitled.png
The first is a toggle button to switch visibility, the second is the alpha and the third is the layer name. Each line should be rearrangeable using drag and drop.Any snippet code/tutorial/example?
-
What you're looking for is called "an item delegate". Documentation can be found here: https://doc.qt.io/qt-5/model-view-programming.html#delegate-classes
There are various examples available, most notably this one which shows how to use any custom widget in a view as an item delegate. -
Hi @Joel-Bodenmann , thank you, I got the point about the item delegate but I see two issues:
- implement a drag and drop listview because I ended up with empty lines (on the list view) and fields on the widget mapper:
https://s32.postimg.org/47yyrq7id/Untitled.png - implement a delegate that paint a checkbox with custom pixmap, the input with number and the input with text.
- implement a drag and drop listview because I ended up with empty lines (on the list view) and fields on the widget mapper: