get all row data from a selected row
I want to list tables in a database and i have the following columns.
id | table_name | date_created | table_size
I want to highlight the entire row and not a single cell.How can i get the all the data of a selected row,i.e the currently selected id,table_name,date_created,table_size.
Re: Get a specific column name from a selected row,click anywhere on the selected row
Try this:
Code:
int row = TreeView->currentIndex().row();
for (int i = 0; i < TreeView->model()->columnCount(); ++i)
QString fileName
= TreeView
->model
()->data
( TreeView
->model
()->index
(row, i
) ).
toString();
Re: Get a specific column name from a selected row,click anywhere on the selected row
First,select set selection behaviour of your view to QAbstractItemView::SelectRows
Second,the best way to obtain a whole row from QSqlTableModel it the record function;