MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / sort

Method sort

src/plugins/core/session/sessionmodel.cpp:80–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void SessionModel::sort(int column, Qt::SortOrder order)
81{
82 beginResetModel();
83 qSort(sessionList.begin(), sessionList.end(),
84 [column, order](const QString &s1, const QString &s2) {
85 bool ret = false;
86 if (column == 0) {
87 ret = s1.toLower() < s2.toLower();
88 } else {
89 const auto &time1 = SessionManager::instance()->sessionDateTime(s1);
90 const auto &time2 = SessionManager::instance()->sessionDateTime(s2);
91 ret = time1 < time2;
92 }
93 return order == Qt::AscendingOrder ? ret : !ret;
94 });
95
96 sortColumn = column;
97 sortOrder = order;
98 endResetModel();
99}
100
101void SessionModel::reset()
102{

Callers 5

runMethod · 0.45
startAutoCompletionMethod · 0.45
initUIMethod · 0.45
initUIMethod · 0.45
initUIMethod · 0.45

Calls 3

sessionDateTimeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected