diff options
author | Simon Rettberg | 2019-06-05 16:17:16 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-06-05 16:17:16 +0200 |
commit | 615ca2f927e8a4c4b5b0591495e7c9417231cab3 (patch) | |
tree | 1962e3603a24baa0d4c2cc06c65ab32542243975 /src/sessiontreemodel.cpp | |
parent | Use Qt5 style signal/slot connections (diff) | |
download | vmchooser2-615ca2f927e8a4c4b5b0591495e7c9417231cab3.tar.gz vmchooser2-615ca2f927e8a4c4b5b0591495e7c9417231cab3.tar.xz vmchooser2-615ca2f927e8a4c4b5b0591495e7c9417231cab3.zip |
Don't group by type in "recent" tab
Diffstat (limited to 'src/sessiontreemodel.cpp')
-rw-r--r-- | src/sessiontreemodel.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp index deda9b7..6861158 100644 --- a/src/sessiontreemodel.cpp +++ b/src/sessiontreemodel.cpp @@ -11,8 +11,8 @@ #include "sessionsiconholder.h" #include "globals.h" -SessionTreeModel::SessionTreeModel(QObject *parent) - : QAbstractItemModel(parent) { +SessionTreeModel::SessionTreeModel(QObject *parent, bool ignoreSections) + : QAbstractItemModel(parent), ignoreSections_(ignoreSections) { root_ = new SessionTreeItem(SECTION_nullptr); } @@ -130,11 +130,15 @@ void SessionTreeModel::addItems(const QList<Session*>& sessions) { SessionTreeItem* parentItem = nullptr; SectionType section = s->section(); - for (int i = 0; i < root_->childCount(); ++i) { - SessionTreeItem* item = root_->child(i); - if (item->sectionType() == section) { - parentItem = item; - break; + if (ignoreSections_) { + parentItem = root_; + } else { + for (int i = 0; i < root_->childCount(); ++i) { + SessionTreeItem* item = root_->child(i); + if (item->sectionType() == section) { + parentItem = item; + break; + } } } @@ -142,7 +146,6 @@ void SessionTreeModel::addItems(const QList<Session*>& sessions) { parentItem = new SessionTreeItem(section, root_); root_->appendChild(parentItem); } - parentItem->appendChild(new SessionTreeItem(s, parentItem)); } } |