current index of the sleected item in QTreeWidget
hi friends,
can u please help me how i can get the currentindex value as integer of the selected item in QTreeWidget ...
i manage to get the data but the currentIndex() at present returning QmodelIndex() . not able to convert it to integer ..
can any one please help me ...
Re: current index of the sleected item in QTreeWidget
to what integer? Row or column? E.g.
Code:
currentIndex().row()
1 Attachment(s)
Re: current index of the sleected item in QTreeWidget
thanks for reply ...
i have attached my QTreeWidgets screenshot with this thread ...
here if the user selects CIM_ComputerSystems or first child of CIM_System and clicked some pushButton .. how can i identify it in my pushButton slot xx() the item selected ... by its index number or some other way ...
i tried like this
cout<<_treeView->currentIndex().row()<<endl;
it all showing 0 as constant...
but i am manage to get the string of the QTreeWidget Item..
please help ...
Re: current index of the sleected item in QTreeWidget
It is returning always 0 because it is relative to its parent. If you want unique identification you have to set a uuid to the items yourself using the Qt::UserRole role. (Or create a "integer path" back to the root item)