Hi,

i want to get value from selected table row (getting it's index) and get the record in first column from this record.
In accordance with documentation of QT it should be like this:

Qt Code:
  1. QModelIndexList selectedList = ui->tableView_clients->selectionModel()->selectedRows();
  2.  
  3.  
  4.  
  5. int selected_row;
  6. for( int i=0; i<selectedList.count(); i++)
  7. //QMessageBox::information(this,"", QString::number(selectedList.at(i).row()));
  8. selected_row=selectedList.at(i).row();
  9.  
  10. mod.setQuery("SELECT * FROM clients");
  11. int ClientId = mod.data(mod.index(selected_row, 1)).toInt();
  12.  
  13.  
  14. emit selectedRaw(QString::number(ClientId));
To copy to clipboard, switch view to plain text mode 

It doesn't display error but simply doesn't get the data i need.Instead every time i get 0.