Kouillo
10th September 2012, 17:58
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:
8211
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 :
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);
}
}
But the result is not really conclusive, I think we could find something more simple...
Thanks for the help.
Bye.
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:
8211
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 :
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);
}
}
But the result is not really conclusive, I think we could find something more simple...
Thanks for the help.
Bye.