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 <QObject>
10#include <QSortFilterProxyModel>
11#include <GeoDataTreeModel.h>
12#include "Placemark.h"
13
14namespace Marble {
15
16class MarbleQuickItem;
17
18class BookmarksModel: public QSortFilterProxyModel
19{
21 Q_PROPERTY( int count READ count NOTIFY countChanged )
22
23public:
24 explicit BookmarksModel( QObject *parent = nullptr );
25
26 int count() const;
27
28public Q_SLOTS:
29 qreal longitude( int index ) const;
30
31 qreal latitude( int index ) const;
32
33 QString name( int index ) const;
34
36 void countChanged();
37};
38
39class Bookmarks : public QObject
40{
42
43 Q_PROPERTY( Marble::MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged)
44 Q_PROPERTY( BookmarksModel* model READ model NOTIFY modelChanged )
45
46public:
47 explicit Bookmarks( QObject* parent = nullptr );
48
49 MarbleQuickItem* map();
50
51 void setMap(MarbleQuickItem *widget );
52
53 BookmarksModel* model();
54
55 Q_INVOKABLE bool isBookmark( qreal longitude, qreal latitude ) const;
56
57 Q_INVOKABLE Placemark* placemark(int index);
58
59public Q_SLOTS:
60 void addBookmark(Placemark *placemark, const QString &folder );
61 void removeBookmark( qreal longitude, qreal latitude );
62 void updateBookmarkDocument();
63
65 void mapChanged();
66
67 void modelChanged();
68
69private:
70 MarbleQuickItem* m_marbleQuickItem;
71 BookmarksModel* m_proxyModel;
72 GeoDataTreeModel m_treeModel;
73};
74
75}
76
77#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
T qobject_cast(QObject *object)
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 Fri Jun 21 2024 12:00:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.