incapacitant
2nd March 2006, 12:39
hi,:o
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&) ) );
When the slot is activated, I would like to retrieve the selected data from the model like :
void MainWindow::selection(const QModelIndex& idx)
{
QString col0 = model->data(QModelIndex(idx)).toString();
}
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 ?
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&) ) );
When the slot is activated, I would like to retrieve the selected data from the model like :
void MainWindow::selection(const QModelIndex& idx)
{
QString col0 = model->data(QModelIndex(idx)).toString();
}
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 ?