Marble

MapThemeModel.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <[email protected]>
4 //
5 
6 #ifndef MARBLE_DECLARATIVE_STREETMAPTHEMEMODEL_H
7 #define MARBLE_DECLARATIVE_STREETMAPTHEMEMODEL_H
8 
9 #include <QSortFilterProxyModel>
10 
11 namespace Marble { class MapThemeManager; }
12 
13 class MapThemeModel : public QSortFilterProxyModel
14 {
15  Q_OBJECT
16 
17  Q_PROPERTY( int count READ count NOTIFY countChanged )
18 
19 public:
20  enum MapThemeFilter {
21  AnyTheme = 0x0,
22  Terrestrial = 0x1,
23  Extraterrestrial = 0x2,
24  LowZoom = 0x4,
25  HighZoom = 0x8
26  };
27 
28  Q_DECLARE_FLAGS(MapThemeFilters, MapThemeFilter)
29 
30  Q_FLAGS(MapThemeFilter MapThemeFilters)
31 
32  Q_PROPERTY( MapThemeFilters mapThemeFilter READ mapThemeFilter WRITE setMapThemeFilter NOTIFY mapThemeFilterChanged )
33 
34 public:
35  explicit MapThemeModel( QObject* parent = nullptr );
36 
37  /** @todo FIXME https://bugreports.qt-project.org/browse/QTCOMPONENTS-1206 */
38  int count() const;
39 
40  QHash<int, QByteArray> roleNames() const override;
41 
42  Q_INVOKABLE QString name( const QString &id ) const;
43 
44  Q_INVOKABLE int indexOf( const QString &id ) const;
45 
46  Q_INVOKABLE MapThemeFilters mapThemeFilter() const;
47 
48 public Q_SLOTS:
49  void setMapThemeFilter( MapThemeFilters filters );
50 
51 Q_SIGNALS:
52  void countChanged();
53 
54  void mapThemeFilterChanged();
55 
56 protected:
57  bool filterAcceptsRow(int sourceRow,
58  const QModelIndex &sourceParent) const override;
59 
60 private Q_SLOTS:
61  void handleChangedThemes();
62 
63 private:
64  Marble::MapThemeManager* m_themeManager;
65 
66  QList<QString> m_streetMapThemeIds;
67 
68  MapThemeFilters m_mapThemeFilters;
69 
70  QHash<int, QByteArray> m_roleNames;
71 };
72 
73 #endif
Q_OBJECTQ_OBJECT
The class that handles map themes that are locally available .
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
Provides access to all map themes installed locally.
virtual QHash< int, QByteArray > roleNames() const const
Binds a QML item to a specific geodetic location in screen coordinates.
Q_INVOKABLEQ_INVOKABLE
Q_SIGNALSQ_SIGNALS
Q_FLAGS(...)
const char * name(StandardAction id)
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:12:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.