File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,24 @@ class MultisortTableView : public QTableView
4646 bool isSortingEnabled () const { return m_isSortingEnabled; }
4747 // / Returns the custom proxy model used for sorting and filtering.
4848 MultiColumnProxyModel *proxyModel () const { return m_proxyModel; }
49+ // / Returns the original source model.
50+ QAbstractItemModel *sourceModel () const { return m_proxyModel->sourceModel (); }
51+
52+ virtual QModelIndex mapToSource (const QModelIndex &proxyIndex) const { return m_proxyModel->mapToSource (proxyIndex); }
53+ virtual QModelIndex mapFromSource (const QModelIndex &sourceIndex) const { return m_proxyModel->mapFromSource (sourceIndex); }
54+ virtual QItemSelection mapSelectionToSource (const QItemSelection &proxySelection) const { return m_proxyModel->mapSelectionToSource (proxySelection); }
55+ virtual QItemSelection mapSelectionFromSource (const QItemSelection &sourceSelection) const { return m_proxyModel->mapSelectionFromSource (sourceSelection); }
56+
57+ bool hasSelection () const { return selectionModel ()->hasSelection (); }
58+ QItemSelection selection () const { mapSelectionToSource (selectionModel ()->selection ()); }
59+
60+ QModelIndexList selectedRows (int column = 0 ) const
61+ {
62+ QModelIndexList sel = selectionModel ()->selectedRows (column);
63+ for (QModelIndex &i : sel)
64+ i = mapToSource (i);
65+ return sel;
66+ }
4967
5068 public Q_SLOTS:
5169 // / Set key modifier to handle multicolumn sorting.
You can’t perform that action at this time.
0 commit comments