Here is the order in which things are happening (simplified somewhat for clarity):
MainWindow
::MainWindow(QWidget *parent
){
ui->setupUi(this);
this->_initializeTables();
}
MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);
this->_initializeTables();
}
To copy to clipboard, switch view to plain text mode
setupUi() is doing the following:
tableViewTrigger->setSelectionMode(QAbstractItemView::SingleSelection);
tableViewTrigger->setSelectionBehavior(QAbstractItemView::SelectRows);
To copy to clipboard, switch view to plain text mode
and my initialization routine for my tables does this:
void MainWindow::_initializeTables()
{
}
void MainWindow::_initializeTables()
{
QItemSelectionModel *sm = ui->tableViewTrigger->selectionModel();
connect(sm, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
this, SLOT(on_tableViewTriggerSelectionModel_currentRowChanged(QModelIndex,QModelIndex)));
}
To copy to clipboard, switch view to plain text mode
I was under the impression that setting the SelectionMode and SelectionBehavior would be something that manipulated a default sort of SelectionModel...
Apparently these two things are not the same and that a SelectionModel must be created by the programmer to do this? In a way, I find that kind of surprising since selecting items from a view of any sort is a common task.
Bookmarks