What is the proper method for changing the currently selected item in a QTreeList?
I've specified...
setSelectionMode(QAbstractItemView::SingleSelectio n);
setSelectionBehavior(QAbstractItemView::SelectRows );
I have a function called as shown below:
connect(m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(changePage(QTreeWidgetItem *, QTreeWidgetItem *)));
In some cases I want to ignore the treeclick and Not have the treelist selection change.
void MainWindow::changePage(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
....
// Ignore click in tree and keep the selection on the currently selected item...
current->setSelected(false);
m_treeWidget->setCurrentItem(previous);
update();
}
This now selects everything between current and previous.
As I have called:
setSelectionMode(QAbstractItemView::SingleSelectio n);
setSelectionBehavior(QAbstractItemView::SelectRows );
I don't see how this should even be possible. I can't make multiple selections
or a range of selections manually from the tree...
Bookmarks