forked from qt-creator/qt-creator
ProjectExplorer: Ensure that the session model stays sorted
Fixes: QTCREATORBUG-23996 Change-Id: I96c8c1b780f5b56cb064146de3de6a4c90f9147a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -192,6 +192,8 @@ void SessionModel::sort(int column, Qt::SortOrder order)
|
||||
return isLess;
|
||||
};
|
||||
Utils::sort(m_sortedSessions, cmp);
|
||||
m_currentSortColumn = column;
|
||||
m_currentSortOrder = order;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -237,6 +239,7 @@ void SessionModel::deleteSessions(const QStringList &sessions)
|
||||
beginResetModel();
|
||||
SessionManager::deleteSessions(sessions);
|
||||
m_sortedSessions = SessionManager::sessions();
|
||||
sort(m_currentSortColumn, m_currentSortOrder);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -268,6 +271,7 @@ void SessionModel::runSessionNameInputDialog(SessionNameInputDialog *sessionInpu
|
||||
createSession(newSession);
|
||||
m_sortedSessions = SessionManager::sessions();
|
||||
endResetModel();
|
||||
sort(m_currentSortColumn, m_currentSortOrder);
|
||||
|
||||
if (sessionInputDialog->isSwitchToRequested())
|
||||
switchToSession(newSession);
|
||||
|
@@ -81,6 +81,8 @@ private:
|
||||
void runSessionNameInputDialog(ProjectExplorer::Internal::SessionNameInputDialog *sessionInputDialog, std::function<void(const QString &)> createSession);
|
||||
|
||||
QStringList m_sortedSessions;
|
||||
int m_currentSortColumn = 0;
|
||||
Qt::SortOrder m_currentSortOrder = Qt::AscendingOrder;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user