diff options
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveSite.cpp | 5 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveSite.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveSite.cpp b/desktop-widgets/tab-widgets/TabDiveSite.cpp index 81736bc77..5e2831c93 100644 --- a/desktop-widgets/tab-widgets/TabDiveSite.cpp +++ b/desktop-widgets/tab-widgets/TabDiveSite.cpp @@ -8,7 +8,10 @@ TabDiveSite::TabDiveSite(QWidget *parent) : TabBase(parent) { ui.setupUi(this); ui.diveSites->setTitle(tr("Dive sites")); - ui.diveSites->setModel(LocationInformationModel::instance()); + ui.diveSites->setModel(&model); + // Default: sort by name + ui.diveSites->view()->sortByColumn(LocationInformationModel::NAME, Qt::AscendingOrder); + ui.diveSites->view()->setSortingEnabled(true); // Show only the first few columns for (int i = LocationInformationModel::COORDS; i < LocationInformationModel::COLUMNS; ++i) diff --git a/desktop-widgets/tab-widgets/TabDiveSite.h b/desktop-widgets/tab-widgets/TabDiveSite.h index 60b3abd76..f0bf2d5d5 100644 --- a/desktop-widgets/tab-widgets/TabDiveSite.h +++ b/desktop-widgets/tab-widgets/TabDiveSite.h @@ -4,6 +4,7 @@ #include "TabBase.h" #include "ui_TabDiveSite.h" +#include "qt-models/divelocationmodel.h" class TabDiveSite : public TabBase { Q_OBJECT @@ -13,6 +14,7 @@ public: void clear() override; private: Ui::TabDiveSite ui; + DiveSiteSortedModel model; }; #endif |