Sorry, should be "what" instead of "why"
How about:2nd question :
I initialise it in the main program :
Qt Code:
int main(int argc, char *argv[]) { // ... DSTableView *tableView = new DSTableView(0); // ...To copy to clipboard, switch view to plain text mode
Qt Code:
//Initialisation of the model structure sortFilterProxy->setSourceModel(tableModel); tableView->setModel(sortFilterProxy); //... tableView->setSelectionModel(selectionModel); //...To copy to clipboard, switch view to plain text mode
Qt Code:
tableView->setModel(sortFilterProxy);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.
Bookmarks