Qt 6.11 is out! See what's new in the release
blog
How can I get a parent from child in treeView?
-
I wrote:
const QModelIndex index1 = ui->treeView_7->selectionModel()->currentIndex();
int w= index1.row()+1;but If I select a child I want to get the parent of selected child
-
It might blow your mind:
QModelIndex index1 = ui->treeView_7->selectionModel()->currentIndex(); QModelIndex index2 = index1.parent(); -
It might blow your mind:
QModelIndex index1 = ui->treeView_7->selectionModel()->currentIndex(); QModelIndex index2 = index1.parent();@VRonin thanks..it works