Is there a way (or a trick) to make a given column (0 in my case) of a given item visible, a scrollToColumn() kind of thing?
You can use QTreeView::scrollTo(const QModelIndex & index, ScrollHint hint = EnsureVisible);
Example:
// Get the index of the item (ITEM-A) on 10th row 1st column
QModelIndex index
= mTreeWidget
->model
()->index
(9,
0);
// Row 10, Column 1
// Get the index of the child of ITEM-A on Row 1, and 10th column.
index = index.child(0, 9); // Row 1, Column 10
// Scroll to item
mTreeWidget->scrollTo(index);
// Get the index of the item (ITEM-A) on 10th row 1st column
QModelIndex index = mTreeWidget->model()->index(9, 0); // Row 10, Column 1
// Get the index of the child of ITEM-A on Row 1, and 10th column.
index = index.child(0, 9); // Row 1, Column 10
// Scroll to item
mTreeWidget->scrollTo(index);
To copy to clipboard, switch view to plain text mode
Bookmarks