Re: Disable QTreeView item
Hi,
use signal QTreeView::currentChanged and set current index as new QTreeView::setRootIndex of your second tree view. This shows you only the child's of your select item, or use QTreeView::setRootIndex(your_current_index.parent( )) for showing also the selected item.
Making the items in your second view un-selectable, you must change Qt::ItemFlags of your item .... make a ProxyModel for your treemodel, return all flags only Qt::ItemIsEnabled, map your index from first treeview with mapFromSource() as new rootItem for your second view with the proxy.
Re: Disable QTreeView item
Hi... I need a solution about this...
I'm making an app with Qt SDK 2010.05... I have a treeview widget. I just want to get current item index of selected item and save it to the registry.
After that i want to read current index from registry and select item as default
Code:
QString ipnum
= ui
->treeView
->model
()->index
(ui
->treeView
->currentIndex
().
row(),
2).
data().
toString();
int rowNum = ui->treeView->selectionModel()->currentIndex().row();
........................................
writedata.beginGroup("CLU");
writedata.setValue("interface_currentIndex",rowNum);
writedata.setValue("interface_ipnum",ipnum);
writedata.endGroup();
........................................
//I cant find that how can i set the saved row number, as default row after...
//im try to use the qmodelindex but i cant do it...
its not working too.. i cant understand it...