Marble

Bookmarks.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_DECLARATIVE_BOOKMARKS_H
7#define MARBLE_DECLARATIVE_BOOKMARKS_H
8
9#include "Placemark.h"
10#include <GeoDataTreeModel.h>
11#include <QObject>
12#include <QSortFilterProxyModel>
13#include <qqmlintegration.h>
14
15namespace Marble
16{
17
18class MarbleQuickItem;
19
20class BookmarksModel : public QSortFilterProxyModel
21{
23 Q_PROPERTY(int count READ count NOTIFY countChanged)
24
25public:
26 explicit BookmarksModel(QObject *parent = nullptr);
27
28 int count() const;
29
30public Q_SLOTS:
31 qreal longitude(int index) const;
32
33 qreal latitude(int index) const;
34
35 QString name(int index) const;
36
38 void countChanged();
39};
40
41class Bookmarks : public QObject
42{
44 QML_ELEMENT
45
46 Q_PROPERTY(Marble::MarbleQuickItem *map READ map WRITE setMap NOTIFY mapChanged)
47 Q_PROPERTY(BookmarksModel *model READ model NOTIFY modelChanged)
48
49public:
50 explicit Bookmarks(QObject *parent = nullptr);
51
52 MarbleQuickItem *map();
53
54 void setMap(MarbleQuickItem *widget);
55
56 BookmarksModel *model();
57
58 Q_INVOKABLE bool isBookmark(qreal longitude, qreal latitude) const;
59
60 Q_INVOKABLE Placemark *placemark(int index);
61
62public Q_SLOTS:
63 void addBookmark(Placemark *placemark, const QString &folder);
64 void removeBookmark(qreal longitude, qreal latitude);
65 void updateBookmarkDocument();
66
68 void mapChanged();
69
70 void modelChanged();
71
72private:
73 MarbleQuickItem *m_marbleQuickItem = nullptr;
74 BookmarksModel *m_proxyModel = nullptr;
75 GeoDataTreeModel m_treeModel;
76};
77
78}
79
80#endif
Binds a QML item to a specific geodetic location in screen coordinates.
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.