How Do I set widgets in listView ?
-
I want to add widgets like pushbuttons in listview items. How to?
-
Hi
Best way is via a delegate.
http://doc.qt.io/qt-5/model-view-programming.html
It will then just draw the look of a button but
when in Edit mode it will be real button.
The easy way is
http://doc.qt.io/qt-5/qabstractitemview.html#setIndexWidget
but performance will suck at some point. ( many rows)
so also depends on your requirements. -
Is there any small example for this?
-
@mit_cruze
Hi
http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
You would draw a button instead of start but concept is the same.The setIndexWidget should is one liner and docs should be fine?
http://stackoverflow.com/questions/5184956/using-a-qwidget-in-a-qt-view