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 :
{
if(m_b_isSortedFromOtherModel)
{
return otherInstance->lessThanFromOther(left, right);
}
else
{
}
}
bool SortFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
if(m_b_isSortedFromOtherModel)
{
return otherInstance->lessThanFromOther(left, right);
}
else
{
return QSortFilterProxyModel::lessThan(left, right);
}
}
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.
Bookmarks