MapLibre Native for Qt
Loading...
Searching...
No Matches
QMapLibre::StyleParameter Class Reference

A base class to pass style parameters to Map. More...

Inheritance diagram for QMapLibre::StyleParameter:
QMapLibre::FilterParameter QMapLibre::ImageParameter QMapLibre::LayerParameter QMapLibre::SourceParameter

Public Slots

void updateNotify ()
 Notify that the style parameter has been updated.
 

Signals

void ready (StyleParameter *parameter)
 Signal emitted when the style parameter is ready.
 
void updated (StyleParameter *parameter)
 Signal emitted when the style parameter is updated.
 

Public Member Functions

 StyleParameter (QObject *parent=nullptr)
 Default constructor.
 
bool operator== (const StyleParameter &other) const
 Comparison operator.
 
bool isReady () const
 Check if the style parameter is ready.
 
virtual QVariant parsedProperty (const char *propertyName) const
 Get the property value.
 
bool hasProperty (const char *propertyName) const
 Check for property existence.
 
void updateProperty (const char *propertyName, const QVariant &value)
 Update property value.
 
QVariantMap toVariantMap () const
 Return a map of all properties.
 
QString styleId () const
 Return style identifier.
 
void setStyleId (const QString &id)
 Set style identifier.
 

Protected Attributes

const int m_initialPropertyCount = staticMetaObject.propertyCount()
 Number of properties in the base class.
 
bool m_ready {}
 Ready status of the style parameter.
 
QString m_styleId
 Style identifier of the parameter.
 

Detailed Description

A base class to pass style parameters to Map.

Should usually not be used directly, but rather through one of its subclasses such as SourceParameter, LayerParameter, ImageParameter or FilterParameter.

Member Function Documentation

◆ hasProperty()

bool QMapLibre::StyleParameter::hasProperty ( const char * propertyName) const

Check for property existence.

Parameters
propertyNameName of the property to check.
Returns
true if the property exists, false otherwise.

◆ isReady()

bool QMapLibre::StyleParameter::isReady ( ) const
inlinenodiscard

Check if the style parameter is ready.

Returns
true if the style parameter is ready, false otherwise.

◆ parsedProperty()

QVariant QMapLibre::StyleParameter::parsedProperty ( const char * propertyName) const
nodiscardvirtual

Get the property value.

Parameters
propertyNameName of the property to get.
Returns
Property value as QVariant or invalid QVariant if the property does not exist.

By default this directly reads the property value from the object. It can be reimplemented from subclasses to provide custom parsing.

◆ ready

void QMapLibre::StyleParameter::ready ( StyleParameter * parameter)
signal

Signal emitted when the style parameter is ready.

Parameters
parameterThe style parameter that is ready.

◆ setStyleId()

void QMapLibre::StyleParameter::setStyleId ( const QString & id)

Set style identifier.

Parameters
idThe style identifier to set.

◆ styleId()

QString QMapLibre::StyleParameter::styleId ( ) const
nodiscard

Return style identifier.

Returns
A style identifier as QString.

◆ toVariantMap()

QVariantMap QMapLibre::StyleParameter::toVariantMap ( ) const
nodiscard

Return a map of all properties.

Returns
A map of all properties as QVariantMap.

◆ updated

void QMapLibre::StyleParameter::updated ( StyleParameter * parameter)
signal

Signal emitted when the style parameter is updated.

Parameters
parameterThe style parameter that is updated.

◆ updateProperty()

void QMapLibre::StyleParameter::updateProperty ( const char * propertyName,
const QVariant & value )

Update property value.

Parameters
propertyNameName of the property to update.
valueThe new value of the property.