I have a QTableView with an overloaded QSortFilterProxyModel (filterAcceptsRows is the only overloaded method)
I am trying to update this code not design it so I am coming into it and trying to figure out what is going on.
The issue I am having is I am trying to output the selection from the table as a Comma Separated Value table for use in Excel and in the same order as it is visible. This is what I tried in pseudocode:
QTableView* view
= getTheTableView
();
// psuedocode that gets member in this case QModelIndexList indexes = view->selectionModel()->selectedIndexes();
//Iterate through the indexes and output them to the csv file
QTableView* view = getTheTableView(); // psuedocode that gets member in this case
QModelIndexList indexes = view->selectionModel()->selectedIndexes();
//Iterate through the indexes and output them to the csv file
To copy to clipboard, switch view to plain text mode
Is that the call I want?
I have also tried:
QTableView* view
= getTheTableView
();
// psuedocode that gets member in this case QModelIndexList indexes = view->selectionModel()->selectedIndexes();
QItemSelection* itemSelection
= model
->mapSelectionFromSource
(indexes
);
//Tried TO and FROM source here QModelIndexList* mappedIndexes = itemSelection->indexes;
//try output on mappedIndexes
QSortFilterProxyModel* model = getTheModel(); //Psuedocode that gets member in this case
QTableView* view = getTheTableView(); // psuedocode that gets member in this case
QModelIndexList indexes = view->selectionModel()->selectedIndexes();
QItemSelection* itemSelection = model->mapSelectionFromSource(indexes); //Tried TO and FROM source here
QModelIndexList* mappedIndexes = itemSelection->indexes;
//try output on mappedIndexes
To copy to clipboard, switch view to plain text mode
In all of these cases the QModelIndexList seems to stay in the same order.
I am just trying to get the items as they are listed in the view.
Bookmarks