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
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...
QString ipnum = ui->treeView->model()->index(ui->treeView->currentIndex().row(),2).data().toString();
int rowNum = ui->treeView->selectionModel()->currentIndex().row();
........................................
QSettings writedata("Encom", "Tron");
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...
To copy to clipboard, switch view to plain text mode
QModelIndex index = (0,0,QModelIndex());
ui->treeView->selectionModel()->setCurrentIndex(index,QItemSelectionModel::Select);
To copy to clipboard, switch view to plain text mode
its not working too.. i cant understand it...
Bookmarks