Marble

AbstractDataPluginItem.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
4//
5
6#ifndef MARBLE_ABSTRACTDATAPLUGINITEM_H
7#define MARBLE_ABSTRACTDATAPLUGINITEM_H
8
9#include <QObject>
10#include <QString>
11#include <QHash>
12
13#include "BillboardGraphicsItem.h"
14#include "marble_export.h"
15
16class QAction;
17
18namespace Marble
19{
20
21class AbstractDataPluginItemPrivate;
22
23class MARBLE_EXPORT AbstractDataPluginItem : public QObject, public BillboardGraphicsItem
24{
25 Q_OBJECT
26
27 Q_PROPERTY( QString identifier READ id WRITE setId NOTIFY idChanged )
28 Q_PROPERTY( bool favorite READ isFavorite WRITE setFavorite NOTIFY favoriteChanged )
29 Q_PROPERTY( bool sticky READ isSticky WRITE setSticky NOTIFY stickyChanged )
30
31 public:
32 explicit AbstractDataPluginItem( QObject *parent = nullptr );
33 ~AbstractDataPluginItem() override;
34
35 /**
36 * Returns the item's tool tip.
37 */
38 QString toolTip() const;
39
40 /**
41 * Set the tool tip for the item.
42 */
43 void setToolTip( const QString& toolTip );
44
45 QString id() const;
46 void setId( const QString& id );
47
48 bool isFavorite() const;
49 virtual void setFavorite( bool favorite );
50
51 bool isSticky() const;
52 void setSticky( bool sticky );
53
54 /**
55 * @brief Set the settings of the item.
56 * This is usually called automatically before painting. If you reimplement this it would be
57 * useful to check for changes before copying.
58 */
59 virtual void setSettings( const QHash<QString, QVariant>& settings );
60
61 /**
62 * Returns the action of this specific item.
63 */
64 virtual QAction *action();
65
66 virtual bool initialized() const = 0;
67
68 virtual void addDownloadedFile( const QString& url, const QString& type );
69
70 virtual bool operator<( const AbstractDataPluginItem *other ) const = 0;
71
72 virtual QList<QAction*> actions();
73
74 Q_SIGNALS:
75 void updated();
76 void idChanged();
77 void favoriteChanged( const QString& id, bool favorite );
78 void stickyChanged();
79
80 public Q_SLOTS:
81 void toggleFavorite();
82
83 private:
84 friend class AbstractDataPluginModel;
85
86 /**
87 * Returning the angular resolution of the viewport when the item was added to it the last
88 * time.
89 */
90 qreal addedAngularResolution() const;
91 void setAddedAngularResolution( qreal resolution );
92
93 AbstractDataPluginItemPrivate * const d;
94};
95
96} // Marble namespace
97
98#endif
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.