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 bool hasProperty(const char *propertyName) const;
27 void updateProperty(const char *propertyName, const QVariant &value);
28
29 [[nodiscard]] QVariantMap toVariantMap() const;
30
31 [[nodiscard]] QString styleId() const;
32 void setStyleId(const QString &id);
33
34public Q_SLOTS:
35 void updateNotify();
36
37Q_SIGNALS:
38 void ready(StyleParameter *parameter);
39 void updated(StyleParameter *parameter);
40
41protected:
42 const int m_initialPropertyCount = staticMetaObject.propertyCount();
43 bool m_ready{};
44
45 QString m_styleId;
46
47 Q_DISABLE_COPY(StyleParameter)
48};
49
50} // namespace QMapLibre
51
52#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:45
void updated(StyleParameter *parameter)
Signal emitted when the style parameter is updated.
Definition geojson.cpp:10