hi,
in the following code table is a QTreeView based on a QStandardItemModel with 2 columns:
connect( table, SIGNAL( doubleClicked(const QModelIndex&) ),
this, SLOT( selection(const QModelIndex&) ) );
connect( table, SIGNAL( doubleClicked(const QModelIndex&) ),
this, SLOT( selection(const QModelIndex&) ) );
To copy to clipboard, switch view to plain text mode
When the slot is activated, I would like to retrieve the selected data from the model like :
void MainWindow::selection(const QModelIndex& idx)
{
}
void MainWindow::selection(const QModelIndex& idx)
{
QString col0 = model->data(QModelIndex(idx)).toString();
}
To copy to clipboard, switch view to plain text mode
This returns the selected item allright (col0 or col1 depending on the user's selection).
But I need to retrieve data for both columns.
How is that achieved ?
Bookmarks