I am using QStandardItemModel inside QTtableview. Is it possible to add checkbox
in on column cell & combobox
in another column cell.
So that i can select predefined option from the combo box.
Please suggest how to achieve this.
I am using QStandardItemModel inside QTtableview. Is it possible to add checkbox
in on column cell & combobox
in another column cell.
So that i can select predefined option from the combo box.
Please suggest how to achieve this.
For the first:
You can setFlags() on an QStandardItem to make it checkable:
Qt::ItemFlags QStandardItem::flags() const
void QStandardItem::setFlags ( Qt::ItemFlags flags )
Qt::ItemIsUserCheckable
For the second:
You should create your own Custom Delegate class inheriting QStyledItemDelegate and reimplement the createEditor, setEditorData and setModelData methods. Check this link and, for a more complete example, the SpinBox Delegate example
Edit: Once you got your custom delegate class, you have to tell your view to use it in a given column with QAbstractItemView::setItemDelegateForColumn