Solved how to make treewidgets items with checkboxes
-
how to make a tree widget or treeview with checkboxes like this
-
@davidlabib
Hi
You can flag each items as check ableQTreeWidgetItem* item = new QTreeWidgetItem(); item->setFlags(item->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable); item->setCheckState(Qt::Checked);// check it
-
For QTreeWidget see QTreeWidgetItem::flags()
For QTreeView see the QAbstractItemModel::flags() and QAbstractItemModel::data() with Qt::CheckStateRole