MapLibre Native for Qt
Loading...
Searching...
No Matches
Style Class Reference

A QML helper item to be attached to a MapView using MapLibre.style property. More...

Inheritance diagram for Style:

Public Member Functions

void addParameter (StyleParameter parameter)
 Add a parameter programatically.
 
void removeParameter (StyleParameter parameter)
 Remove a parameter programatically.
 
void clearParameters ()
 Clear all parameters programatically.
 

Detailed Description

A QML helper item to be attached to a MapView using MapLibre.style property.

This item does not have any properties and expect to have StyleParameter implementations as children. See also SourceParameter and LayerParameter.

MapLibre.style: Style {
id: style
id: radarSourceParam
styleId: "radar"
type: "image"
property string url: "https://maplibre.org/maplibre-gl-js/docs/assets/radar1.gif"
property var coordinates: [
[-80.425, 46.437],
[-71.516, 46.437],
[-71.516, 37.936],
[-80.425, 37.936]
]
}
id: radarLayerParam
styleId: "radar-layer"
type: "raster"
property string source: "radar"
paint: {
"raster-opacity": 0.9
}
}
}

Parameters can also be manipulated programatically using addParameter, removeParameter and clearParameters functions.

let layerParam = Qt.createQmlObject(`
import MapLibre 3.0
styleId: "tileLayer"
type: "raster"
property string source: "tileSource"
}
`,
style,
"layerParamSnippet")
style.addParameter(layerParam)
Examples
example_Style.qml.

Member Function Documentation

◆ addParameter()

void Style::addParameter ( StyleParameter parameter)

Add a parameter programatically.

Parameters
parameterThe parameter to be added

◆ removeParameter()

void Style::removeParameter ( StyleParameter parameter)

Remove a parameter programatically.

Parameters
parameterThe parameter to be removed