mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed sorting lost issue in Network
This commit is contained in:
parent
30e59133cb
commit
a5afc2226c
@ -105,6 +105,13 @@
|
||||
|
||||
Q_DECLARE_METATYPE(ElidedLabel*)
|
||||
|
||||
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||
static std::ostream& operator<<(std::ostream& o,const QModelIndex& i)
|
||||
{
|
||||
return o << "(" << i.row() << "," << i.column() << ")";
|
||||
}
|
||||
#endif
|
||||
|
||||
class FriendListSortFilterProxyModel: public QSortFilterProxyModel
|
||||
{
|
||||
public:
|
||||
@ -131,6 +138,9 @@ public:
|
||||
if((online1 != online2) && m_sortByState)
|
||||
return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?online1:online2 ; // always put online nodes first
|
||||
|
||||
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||
std::cerr << "Comparing index " << left << " with index " << right << std::endl;
|
||||
#endif
|
||||
return QSortFilterProxyModel::lessThan(left,right);
|
||||
}
|
||||
|
||||
@ -1174,7 +1184,9 @@ void NewFriendList::applyWhileKeepingTree(std::function<void()> predicate)
|
||||
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||
std::cerr << "Sorting again with sort column: " << mLastSortColumn << " and order " << mLastSortOrder << std::endl;
|
||||
#endif
|
||||
mProxyModel->setSortingEnabled(true);
|
||||
mProxyModel->sort(mLastSortColumn,mLastSortOrder);
|
||||
mProxyModel->setSortingEnabled(false);
|
||||
|
||||
if(selected_index.isValid())
|
||||
ui->peerTreeWidget->scrollTo(selected_index);
|
||||
|
Loading…
Reference in New Issue
Block a user