mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-29 17:28:41 -04:00
fixed sorting lost issue in Network
This commit is contained in:
parent
30e59133cb
commit
a5afc2226c
1 changed files with 12 additions and 0 deletions
|
@ -105,6 +105,13 @@
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(ElidedLabel*)
|
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
|
class FriendListSortFilterProxyModel: public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -131,6 +138,9 @@ public:
|
||||||
if((online1 != online2) && m_sortByState)
|
if((online1 != online2) && m_sortByState)
|
||||||
return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?online1:online2 ; // always put online nodes first
|
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);
|
return QSortFilterProxyModel::lessThan(left,right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,7 +1184,9 @@ void NewFriendList::applyWhileKeepingTree(std::function<void()> predicate)
|
||||||
#ifdef DEBUG_NEW_FRIEND_LIST
|
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||||
std::cerr << "Sorting again with sort column: " << mLastSortColumn << " and order " << mLastSortOrder << std::endl;
|
std::cerr << "Sorting again with sort column: " << mLastSortColumn << " and order " << mLastSortOrder << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
mProxyModel->setSortingEnabled(true);
|
||||||
mProxyModel->sort(mLastSortColumn,mLastSortOrder);
|
mProxyModel->sort(mLastSortColumn,mLastSortOrder);
|
||||||
|
mProxyModel->setSortingEnabled(false);
|
||||||
|
|
||||||
if(selected_index.isValid())
|
if(selected_index.isValid())
|
||||||
ui->peerTreeWidget->scrollTo(selected_index);
|
ui->peerTreeWidget->scrollTo(selected_index);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue