mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Cleanup: Pass gpsTrackers directly to GpsListModel::update()
Instead of using the GpsLocation singleton in GpsListModel::update() to extract the gpsTrackers, pass the gpsTrackers as function argument. The caller has direct access to the GpsLocation object anyway and this make things less entangled. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
eae9a99615
commit
8576edd8d6
3 changed files with 3 additions and 4 deletions
|
@ -1556,7 +1556,7 @@ void QMLManager::applyGpsData()
|
||||||
void QMLManager::populateGpsData()
|
void QMLManager::populateGpsData()
|
||||||
{
|
{
|
||||||
if (GpsListModel::instance())
|
if (GpsListModel::instance())
|
||||||
GpsListModel::instance()->update();
|
GpsListModel::instance()->update(QVector<gpsTracker>::fromList(locationProvider->currentGPSInfo().values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::clearGpsData()
|
void QMLManager::clearGpsData()
|
||||||
|
|
|
@ -7,9 +7,8 @@ GpsListModel::GpsListModel(QObject *parent) : QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpsListModel::update()
|
void GpsListModel::update(QVector<gpsTracker> trackers)
|
||||||
{
|
{
|
||||||
QVector<gpsTracker> trackers = QVector<gpsTracker>::fromList(GpsLocation::instance()->currentGPSInfo().values());
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_gpsFixes = trackers;
|
m_gpsFixes = trackers;
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
QHash<int, QByteArray> roleNames() const;
|
QHash<int, QByteArray> roleNames() const;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
void update();
|
void update(QVector<gpsTracker> trackers);
|
||||||
private:
|
private:
|
||||||
QVector<gpsTracker> m_gpsFixes;
|
QVector<gpsTracker> m_gpsFixes;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue