How to disable items selected in Qtreeview
-
wrote on 18 Sept 2018, 13:22 last edited by
I am adding a row in Qtreeview and I have to disable pop up menu on that row in Qtreeview . Can some one guide me on that
-
wrote on 18 Sept 2018, 13:51 last edited by TobbY
Hi,
You can do it simply add condition on
OnDoubleClick
TreeViewPage::OnDoubleClick(const QModelIndex& i_indexMode) { if (i_indexMode.row() == disabled_row_num) return; QDialog* dlg= new QDialog(this); dlg->exec(); delete dlg; }
-
wrote on 18 Sept 2018, 14:12 last edited by
@TobbY said in How to disable items selected in Qtreeview:
OnDoubleClick
I am asking for conditions which flags to set to disable a QTreeview item
-
@TobbY said in How to disable items selected in Qtreeview:
OnDoubleClick
I am asking for conditions which flags to set to disable a QTreeview item
wrote on 18 Sept 2018, 14:21 last edited by@Qt-Enthusiast
What "pop up menu on that row"? Do you have a custom right-click menu? -
wrote on 18 Sept 2018, 15:04 last edited by
I want one row on QTreeView to be which cannot be selected and Right click on it
-
I want one row on QTreeView to be which cannot be selected and Right click on it
Hi
Pr item , you can disable
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
If using a model, you can control from its Flags function
http://doc.qt.io//qt-5/qstandarditemmodel.html#flags
1/6