QGIS API Documentation
3.10.0-A Coruña (6c816b4204)
|
Container class that allows storage of map themes consisting of visible map layers and layer styles. More...
#include <qgsmapthemecollection.h>
Classes | |
class | MapThemeLayerRecord |
Individual record of a visible layer in a map theme record. More... | |
class | MapThemeRecord |
Individual map theme record of visible layers and styles. More... | |
Signals | |
void | mapThemeChanged (const QString &theme) |
Emitted when a map theme changes definition. More... | |
void | mapThemesChanged () |
Emitted when map themes within the collection are changed. More... | |
void | projectChanged () |
Emitted when the project changes. More... | |
Public Member Functions | |
QgsMapThemeCollection (QgsProject *project=nullptr) | |
Create map theme collection that handles themes of the given project. More... | |
void | applyTheme (const QString &name, QgsLayerTreeGroup *root, QgsLayerTreeModel *model) |
Apply theme given by its name and modify layer tree, current style of layers and checked legend items of passed layer tree model. More... | |
void | clear () |
Remove all map themes from the collection. More... | |
bool | hasMapTheme (const QString &name) const |
Returns whether a map theme with a matching name exists. More... | |
void | insert (const QString &name, const QgsMapThemeCollection::MapThemeRecord &state) |
Inserts a new map theme to the collection. More... | |
QStringList | mapThemes () const |
Returns a list of existing map theme names. More... | |
QgsMapThemeCollection::MapThemeRecord | mapThemeState (const QString &name) const |
Returns the recorded state of a map theme. More... | |
QMap< QString, QString > | mapThemeStyleOverrides (const QString &name) |
Gets layer style overrides (for QgsMapSettings) of the visible layers for given map theme. More... | |
QStringList | mapThemeVisibleLayerIds (const QString &name) const |
Returns the list of layer IDs that are visible for the specified map theme. More... | |
QList< QgsMapLayer * > | mapThemeVisibleLayers (const QString &name) const |
Returns the list of layers that are visible for the specified map theme. More... | |
QList< QgsMapLayer *> | masterLayerOrder () const |
Returns the master layer order (this will always match the project's QgsProject::layerOrder() ). More... | |
QList< QgsMapLayer *> | masterVisibleLayers () const |
Returns the master list of visible layers. More... | |
QgsProject * | project () |
The QgsProject on which this map theme collection works. More... | |
void | readXml (const QDomDocument &doc) |
Reads the map theme collection state from XML. More... | |
void | removeMapTheme (const QString &name) |
Remove an existing map theme from collection. More... | |
void | setProject (QgsProject *project) |
The QgsProject on which this map theme collection works. More... | |
void | update (const QString &name, const QgsMapThemeCollection::MapThemeRecord &state) |
Updates a map theme within the collection. More... | |
void | writeXml (QDomDocument &doc) |
Writes the map theme collection state to XML. More... | |
Static Public Member Functions | |
static QgsMapThemeCollection::MapThemeRecord | createThemeFromCurrentState (QgsLayerTreeGroup *root, QgsLayerTreeModel *model) |
Static method to create theme from the current state of layer visibilities in layer tree, current style of layers and check state of legend items (from a layer tree model). More... | |
Properties | |
QStringList | mapThemes |
QgsProject | project |
Container class that allows storage of map themes consisting of visible map layers and layer styles.
Definition at line 44 of file qgsmapthemecollection.h.
QgsMapThemeCollection::QgsMapThemeCollection | ( | QgsProject * | project = nullptr | ) |
Create map theme collection that handles themes of the given project.
Definition at line 29 of file qgsmapthemecollection.cpp.
void QgsMapThemeCollection::applyTheme | ( | const QString & | name, |
QgsLayerTreeGroup * | root, | ||
QgsLayerTreeModel * | model | ||
) |
Apply theme given by its name and modify layer tree, current style of layers and checked legend items of passed layer tree model.
Definition at line 192 of file qgsmapthemecollection.cpp.
void QgsMapThemeCollection::clear | ( | ) |
Remove all map themes from the collection.
Definition at line 285 of file qgsmapthemecollection.cpp.
|
static |
Static method to create theme from the current state of layer visibilities in layer tree, current style of layers and check state of legend items (from a layer tree model).
Definition at line 100 of file qgsmapthemecollection.cpp.
bool QgsMapThemeCollection::hasMapTheme | ( | const QString & | name | ) | const |
Returns whether a map theme with a matching name exists.
Definition at line 248 of file qgsmapthemecollection.cpp.
void QgsMapThemeCollection::insert | ( | const QString & | name, |
const QgsMapThemeCollection::MapThemeRecord & | state | ||
) |
Inserts a new map theme to the collection.
Definition at line 253 of file qgsmapthemecollection.cpp.
|
signal |
Emitted when a map theme changes definition.
QStringList QgsMapThemeCollection::mapThemes | ( | ) | const |
Returns a list of existing map theme names.
|
signal |
Emitted when map themes within the collection are changed.
|
inline |
Returns the recorded state of a map theme.
Definition at line 234 of file qgsmapthemecollection.h.
QMap< QString, QString > QgsMapThemeCollection::mapThemeStyleOverrides | ( | const QString & | name | ) |
Gets layer style overrides (for QgsMapSettings) of the visible layers for given map theme.
Definition at line 365 of file qgsmapthemecollection.cpp.
QStringList QgsMapThemeCollection::mapThemeVisibleLayerIds | ( | const QString & | name | ) | const |
Returns the list of layer IDs that are visible for the specified map theme.
Definition at line 298 of file qgsmapthemecollection.cpp.
QList< QgsMapLayer * > QgsMapThemeCollection::mapThemeVisibleLayers | ( | const QString & | name | ) | const |
Returns the list of layers that are visible for the specified map theme.
Definition at line 309 of file qgsmapthemecollection.cpp.
QList< QgsMapLayer * > QgsMapThemeCollection::masterLayerOrder | ( | ) | const |
Returns the master layer order (this will always match the project's QgsProject::layerOrder() ).
All map themes will maintain the same layer order as the master layer order.
Definition at line 216 of file qgsmapthemecollection.cpp.
QList< QgsMapLayer * > QgsMapThemeCollection::masterVisibleLayers | ( | ) | const |
Returns the master list of visible layers.
The order of returned layers will always match those of masterLayerOrder(), but the returned layers are filtered to only include those visible in the project's layer tree.
Definition at line 224 of file qgsmapthemecollection.cpp.
QgsProject* QgsMapThemeCollection::project | ( | ) |
The QgsProject on which this map theme collection works.
|
signal |
Emitted when the project changes.
The QgsProject on which this map theme collection works.
void QgsMapThemeCollection::readXml | ( | const QDomDocument & | doc | ) |
Reads the map theme collection state from XML.
doc | DOM document |
Definition at line 417 of file qgsmapthemecollection.cpp.
void QgsMapThemeCollection::removeMapTheme | ( | const QString & | name | ) |
Remove an existing map theme from collection.
Definition at line 274 of file qgsmapthemecollection.cpp.
void QgsMapThemeCollection::setProject | ( | QgsProject * | project | ) |
The QgsProject on which this map theme collection works.
Definition at line 205 of file qgsmapthemecollection.cpp.
void QgsMapThemeCollection::update | ( | const QString & | name, |
const QgsMapThemeCollection::MapThemeRecord & | state | ||
) |
Updates a map theme within the collection.
name | name of map theme to update |
state | map theme record to replace existing map theme |
Definition at line 262 of file qgsmapthemecollection.cpp.
void QgsMapThemeCollection::writeXml | ( | QDomDocument & | doc | ) |
Writes the map theme collection state to XML.
doc | DOM document |
Definition at line 527 of file qgsmapthemecollection.cpp.
|
read |
Definition at line 48 of file qgsmapthemecollection.h.
|
readwrite |
Definition at line 49 of file qgsmapthemecollection.h.