Hello.

I'm currently working on a Qt Project with QTableViews and QAbstractTableModel subclasses.

There are 2 synchronized tables (same number of row, synchronized scrollbar, etc.) and we are working on adding sorting on tables.

I use a customer QSortFilterProxyModel implementation to filter rows and sort model elements.

Here is an example/demo:
Sort.jpg

I wish to automatically arrange rows position in the right table when the left table is sorted by column (and vice-versa).

Is there any signal/slot mechanism to modify mapping tables of QSortFilterModel?

We try to implement something like :
Qt Code:
  1. bool SortFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
  2. {
  3. if(m_b_isSortedFromOtherModel)
  4. {
  5. return otherInstance->lessThanFromOther(left, right);
  6. }
  7. else
  8. {
  9. return QSortFilterProxyModel::lessThan(left, right);
  10. }
  11. }
To copy to clipboard, switch view to plain text mode 
But the result is not really conclusive, I think we could find something more simple...


Thanks for the help.
Bye.