MapLibre Native for Qt
Loading...
Searching...
No Matches
style_parameter.hpp
1// Copyright (C) 2023 MapLibre contributors
2
3// SPDX-License-Identifier: BSD-2-Clause
4
5#ifndef QMAPLIBRE_STYLE_PARAMETER_H
6#define QMAPLIBRE_STYLE_PARAMETER_H
7
8#include <QMapLibre/Export>
9
10#include <QtCore/QObject>
11#include <QtCore/QString>
12#include <QtCore/QVariantMap>
13
14namespace QMapLibre {
15
16class Q_MAPLIBRE_CORE_EXPORT StyleParameter : public QObject {
17 Q_OBJECT
18public:
19 explicit StyleParameter(QObject *parent = nullptr);
20 ~StyleParameter() override;
21
22 bool operator==(const StyleParameter &other) const;
23
24 [[nodiscard]] inline bool isReady() const { return m_ready; };
25
26 [[nodiscard]] virtual QVariant parsedProperty(const char *propertyName) const;
27 bool hasProperty(const char *propertyName) const;
28 void updateProperty(const char *propertyName, const QVariant &value);
29
30 [[nodiscard]] QVariantMap toVariantMap() const;
31
32 [[nodiscard]] QString styleId() const;
33 void setStyleId(const QString &id);
34
35public Q_SLOTS:
36 void updateNotify();
37
38Q_SIGNALS:
39 void ready(StyleParameter *parameter);
40 void updated(StyleParameter *parameter);
41
42protected:
43 const int m_initialPropertyCount = staticMetaObject.propertyCount();
44 bool m_ready{};
45
46 QString m_styleId;
47
48 Q_DISABLE_COPY(StyleParameter)
49};
50
51} // namespace QMapLibre
52
53#endif // QMAPLIBRE_STYLE_PARAMETER_H
A base class to pass style parameters to Map.
Definition style_parameter.hpp:16
bool isReady() const
Check if the style parameter is ready.
Definition style_parameter.hpp:24
void ready(StyleParameter *parameter)
Signal emitted when the style parameter is ready.
QString m_styleId
Style identifier of the parameter.
Definition style_parameter.hpp:46
void updated(StyleParameter *parameter)
Signal emitted when the style parameter is updated.
Definition geojson.cpp:10