All you have to do is to connect a few signals to enable the behaviour you want:
// make table follow tree clicks
QObject::connect(ui.
treeView,
SIGNAL(clicked
(const QModelIndex
&)),
ui.tableView, SLOT(setRootIndex(const QModelIndex&)));
// table navigation by double clicks
QObject::connect(ui.
tableView,
SIGNAL(doubleClicked
(const QModelIndex
&)),
ui.tableView, SLOT(setRootIndex(const QModelIndex&)));
// make tree update upon table navigation
QObject::connect(ui.
tableView,
SIGNAL(doubleClicked
(const QModelIndex
&)),
ui.treeView, SLOT(setCurrentIndex(const QModelIndex&)));
// make table follow tree clicks
QObject::connect(ui.treeView, SIGNAL(clicked(const QModelIndex&)),
ui.tableView, SLOT(setRootIndex(const QModelIndex&)));
// table navigation by double clicks
QObject::connect(ui.tableView, SIGNAL(doubleClicked(const QModelIndex&)),
ui.tableView, SLOT(setRootIndex(const QModelIndex&)));
// make tree update upon table navigation
QObject::connect(ui.tableView, SIGNAL(doubleClicked(const QModelIndex&)),
ui.treeView, SLOT(setCurrentIndex(const QModelIndex&)));
To copy to clipboard, switch view to plain text mode
Bookmarks