QTreeView with multiple Widgets in columns?
-
You can not do it. setIndexWidget will only allow setting a single item in a cell, not multiple. However, you can of course make your own compound widget that consists of a checkbox, a button and a combobox in a layout, and set an instance of that widget in a tree view.
Note however, that using setIndexWidget is not very performant for large models.
-
Hi Andre.
bq. make your own compound widget that consists of a checkbox, a button and a combobox in a layout, and set an instance of that widget in a tree view
I can do that but , how to show different widget in different columns? like
QTreeView will have ,
col-1 | col2 | col3 ----
QLineEdit QCheckBox QComboBox -----
is it possible to achieve this using QStyledItemDelegate? or any other way?
please put me in right direction with some sample code.thanks in advance.
-
I thought you wanted to put multiple widgets in a single cell. If you just want one item per cell, just put your widgets in your cells directly as directed earlier by peppe, and take note of his suggestion that you don't need to use a QCheckBox widget because that can be rendered by the item view (ok, the default delegate, but that is besides the point) directly.
-
-
You can find good examples "in the docs":http://doc.qt.nokia.com/4.7/model-view-programming.html#delegate-classes