maplocationmodel: implement the clear() and add() methods

- add() will be used to add a MapLocation to the model with
beginInsertRows()...endInsertRows()
- clear() will be used to clear the model with beginRemoveRows()...
endRemoveRows()

NOTE: emiting dataChanged() does not seem to update the QML view for
this model so calling being<..>Rows() seems to be the "correct Qt
approach" to do this.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2017-07-17 22:12:04 +03:00 committed by Dirk Hohndel
parent 52316229cd
commit f4e6df475e
2 changed files with 20 additions and 1 deletions

View file

@ -44,6 +44,8 @@ public:
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent) const override;
int count();
void add(MapLocation *);
void clear();
protected:
QHash<int, QByteArray> roleNames() const;