Verified Commit f0309344 authored by Marc Deop i Argemí's avatar Marc Deop i Argemí
Browse files

feat: sort Monitors tab

 Use QSortFilterProxyModel to sort entries in the Monitors tab.
parent 00be2f80
Pipeline #21149 passed with stage
in 8 minutes and 32 seconds
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <qheaderview.h> #include <qheaderview.h>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <AkonadiCore/NotificationSubscriber> #include <AkonadiCore/NotificationSubscriber>
#include <AkonadiWidgets/controlgui.h> #include <AkonadiWidgets/controlgui.h>
...@@ -44,7 +45,12 @@ MonitorsWidget::MonitorsWidget(QWidget *parent): ...@@ -44,7 +45,12 @@ MonitorsWidget::MonitorsWidget(QWidget *parent):
QHBoxLayout *layout = new QHBoxLayout(this); QHBoxLayout *layout = new QHBoxLayout(this);
mTreeView = new QTreeView(this); mTreeView = new QTreeView(this);
mTreeView->setModel(mModel); QSortFilterProxyModel *mProxyModel = new QSortFilterProxyModel(this);
mProxyModel->setDynamicSortFilter(true);
mProxyModel->sort(0);
mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
mProxyModel->setSourceModel(mModel);
mTreeView->setModel(mProxyModel);
mTreeView->setAlternatingRowColors(true); mTreeView->setAlternatingRowColors(true);
mTreeView->setRootIsDecorated(true); mTreeView->setRootIsDecorated(true);
connect(mTreeView->selectionModel(), &QItemSelectionModel::currentChanged, connect(mTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment