22using namespace Qt::StringLiterals;
26QString QgsApplyLayerStyleAlgorithm::name()
const
28 return u
"setlayerstyle"_s;
31QString QgsApplyLayerStyleAlgorithm::displayName()
const
33 return QObject::tr(
"Set layer style" );
36QStringList QgsApplyLayerStyleAlgorithm::tags()
const
38 return QObject::tr(
"change,layer,style,qml" ).split(
',' );
41QString QgsApplyLayerStyleAlgorithm::group()
const
43 return QObject::tr(
"Cartography" );
46QString QgsApplyLayerStyleAlgorithm::groupId()
const
48 return u
"cartography"_s;
51QString QgsApplyLayerStyleAlgorithm::shortHelpString()
const
53 return QObject::tr(
"This algorithm applies the style to a layer. The style must be defined as QML file." );
56QString QgsApplyLayerStyleAlgorithm::shortDescription()
const
58 return QObject::tr(
"Applies the style from a QML file to a layer." );
61QgsApplyLayerStyleAlgorithm *QgsApplyLayerStyleAlgorithm::createInstance()
const
63 return new QgsApplyLayerStyleAlgorithm();
66void QgsApplyLayerStyleAlgorithm::initAlgorithm(
const QVariantMap & )
75 QgsMapLayer *layer = parameterAsLayer( parameters, u
"INPUT"_s, context );
76 const QString style = parameterAsFile( parameters, u
"STYLE"_s, context );
81 mLayerId = layer->
id();
96 Q_UNUSED( parameters );
100 results.insert( u
"OUTPUT"_s, mLayerId );
@ File
Parameter is a single file.
Base class for all map layer types.
virtual QString loadNamedStyle(const QString &theURI, bool &resultFlag, bool loadFromLocalDb, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories, Qgis::LoadStyleFlags flags=Qgis::LoadStyleFlags())
Loads a named style from file/local db/datasource db.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A map layer output for processing algorithms, where layers may be either vector or raster.
An input file or folder parameter for processing algorithms.
A map layer parameter for processing algorithms.