fixed keeping sort order in any case in network friend list

This commit is contained in:
csoler 2020-11-12 23:44:12 +01:00
parent f8721ad60f
commit 24735c2235
2 changed files with 9 additions and 0 deletions

View File

@ -292,6 +292,9 @@ void NewFriendList::sortColumn(int col,Qt::SortOrder so)
mProxyModel->sort(col,so);
mProxyModel->setSortingEnabled(false);
restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes);
mLastSortColumn = col;
mLastSortOrder = so;
}
void NewFriendList::headerContextMenuRequested(QPoint /*p*/)
@ -1133,6 +1136,9 @@ void NewFriendList::applyWhileKeepingTree(std::function<void()> predicate)
ui->peerTreeWidget->setColumnHidden(i,!col_visible[i]);
ui->peerTreeWidget->setColumnWidth(i,col_sizes[i]);
}
// restore sorting
sortColumn(mLastSortColumn,mLastSortOrder);
}
void NewFriendList::checkInternalData(bool force)

View File

@ -126,6 +126,9 @@ private:
std::set<RsNodeGroupId> openGroups;
std::set<RsPgpId> openPeers;
int mLastSortColumn;
Qt::SortOrder mLastSortOrder;
bool getOrCreateGroup(const std::string& name, uint flag, RsNodeGroupId& id);
bool getGroupIdByName(const std::string& name, RsNodeGroupId& id);