Quote Originally Posted by xelag View Post
I don't understand your 1st question?
Sorry, should be "what" instead of "why"


2nd question :

I initialise it in the main program :
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. // ...
  4. DSTableView *tableView = new DSTableView(0);
  5. // ...
  6. QItemSelectionModel *selectionModel = new QItemSelectionModel(tableModel);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //Initialisation of the model structure
  2. sortFilterProxy->setSourceModel(tableModel);
  3. tableView->setModel(sortFilterProxy);
  4. //...
  5. tableView->setSelectionModel(selectionModel);
  6. //...
To copy to clipboard, switch view to plain text mode 
How about:
Qt Code:
  1. QTableView *view = new QTableView(...);
  2. tableView->setModel(sortFilterProxy);
  3. QItemSelectionModel = tableView->selectionModel(); // <-- use this one
To copy to clipboard, switch view to plain text mode 

You don't need to create your own selection model, the view already has one. The selection model will tell you about selections of the model which is set in the view - in your case the proxy model, so you need to map indexes to the source model using QAbstractProxyModel::mapToSource() if you want to operate on the model directly. But it is possible that you can do most operations by operating on the proxy instead - then you don't need to map indexes.