diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-09-28 23:23:57 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-10-04 09:19:10 -0700 |
commit | 2a9a3dda20c47e74746fbfa3c6e5fd9ee919b2b3 (patch) | |
tree | 8ffc4ce0300c81d6d435ee98baba15688920faab /qt-models/gpslistmodel.cpp | |
parent | 36d42a6a57e8f79de1c8daf01e77a811ef0392dc (diff) | |
download | subsurface-2a9a3dda20c47e74746fbfa3c6e5fd9ee919b2b3.tar.gz |
Cleanup: turn GpsListModel into standard singleton
GpsListModel was one of those "special" singletons that could
be created explicitly with new. This would make sense if a
parameter were passed to the constructor. We only passed null,
so one might as well turn that into a classical singleton with
default constructor.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/gpslistmodel.cpp')
-rw-r--r-- | qt-models/gpslistmodel.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/qt-models/gpslistmodel.cpp b/qt-models/gpslistmodel.cpp index 8d874d67b..33eb8a5ea 100644 --- a/qt-models/gpslistmodel.cpp +++ b/qt-models/gpslistmodel.cpp @@ -3,11 +3,8 @@ #include "core/qthelper.h" #include <QVector> -GpsListModel *GpsListModel::m_instance = NULL; - -GpsListModel::GpsListModel(QObject *parent) : QAbstractListModel(parent) +GpsListModel::GpsListModel() { - m_instance = this; } void GpsListModel::update() @@ -65,6 +62,7 @@ QHash<int, QByteArray> GpsListModel::roleNames() const GpsListModel *GpsListModel::instance() { - return m_instance; + static GpsListModel self; + return &self; } |