I want to make a new model containing only the selected rows of this table.
Appending the selected rows to the empty model named "selected_rows_model" (QSqlTableModel).
Qt Code:
  1. QItemSelectionModel *selectionModel = ui.devices_finder_tbl->selectionModel();
  2. if(selectionModel->hasSelection() ){
  3. //QModelIndexList list = selectionModel->selectedRows();
  4. QModelIndexList list = ui.devices_finder_tbl->selectedIndexes();
  5. for(int i = 0; i < list.size(); i++)
  6. {
  7. QModelIndex index = list.at(i);
  8. selected_rows_model->insertRow(selected_rows_model->rowCount(), index);
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 
But it's not working, this row:
Qt Code:
  1. selected_rows_model->insertRow(selected_rows_model->rowCount(), index);
To copy to clipboard, switch view to plain text mode 
is wrong.
Ho can I fix it?