16#ifndef QGSMAPTHEMECOLLECTION_H
17#define QGSMAPTHEMECOLLECTION_H
48 Q_PROPERTY( QStringList mapThemes READ mapThemes NOTIFY mapThemesChanged )
49 Q_PROPERTY(
QgsProject *project READ project WRITE setProject NOTIFY projectChanged )
67 return mLayer == other.mLayer && isVisible == other.
isVisible &&
74 return !( *
this == other );
87 bool isVisible =
true;
90 bool usingCurrentStyle =
false;
94 bool usingLegendItems =
false;
109 bool expandedLayerNode =
false;
128 mHasExpandedStateInfo == other.mHasExpandedStateInfo &&
129 mExpandedGroupNodes == other.mExpandedGroupNodes && mCheckedGroupNodes == other.mCheckedGroupNodes;
133 return !( *
this == other );
137 QList<QgsMapThemeCollection::MapThemeLayerRecord>
layerRecords()
const {
return mLayerRecords; }
140 void setLayerRecords(
const QList<QgsMapThemeCollection::MapThemeLayerRecord> &records ) { mLayerRecords = records; }
151 QHash<QgsMapLayer *, QgsMapThemeCollection::MapThemeLayerRecord> validLayerRecords() const
SIP_SKIP;
158 bool hasExpandedStateInfo()
const {
return mHasExpandedStateInfo; }
207 void setCheckedGroupNodes(
const QSet<QString> &checkedGroupNodes ) { mCheckedGroupNodes = checkedGroupNodes; }
211 QList<MapThemeLayerRecord> mLayerRecords;
214 bool mHasExpandedStateInfo =
false;
216 bool mHasCheckedStateInfo =
false;
222 QSet<QString> mExpandedGroupNodes;
228 QSet<QString> mCheckedGroupNodes;
242 bool hasMapTheme(
const QString &name )
const;
262 void removeMapTheme(
const QString &name );
269 bool renameMapTheme(
const QString &name,
const QString &newName );
278 QStringList mapThemes()
const;
293 QStringList mapThemeVisibleLayerIds(
const QString &name )
const;
302 QList<QgsMapLayer *> mapThemeVisibleLayers(
const QString &name )
const;
308 QMap<QString, QString> mapThemeStyleOverrides(
const QString &name );
315 void readXml(
const QDomDocument &doc );
322 void writeXml( QDomDocument &doc );
357 QList< QgsMapLayer * > masterLayerOrder()
const;
366 QList< QgsMapLayer * > masterVisibleLayers()
const;
401 void registryLayersRemoved(
const QStringList &layerIDs );
404 void layerStyleRenamed(
const QString &oldName,
const QString &newName );
416 void reconnectToLayersStyleManager();
424 typedef QMap<QString, MapThemeRecord> MapThemeRecordMap;
425 MapThemeRecordMap mMapThemes;
Layer tree group node serves as a container for layers and further groups.
Layer tree node points to a map layer.
The QgsLayerTreeModel class is model implementation for Qt item views framework.
This class is a base class for nodes in a layer tree.
Base class for all map layer types.
Individual record of a visible layer in a map theme record.
QString currentStyle
Name of the current style of the layer.
QSet< QString > expandedLegendItems
Rule keys of expanded legend items in layer tree view.
QSet< QString > checkedLegendItems
Rule keys of check legend items in layer tree model.
bool operator!=(const QgsMapThemeCollection::MapThemeLayerRecord &other) const
bool expandedLayerNode
Whether the layer's tree node is expanded (only to be applied if the parent MapThemeRecord has the in...
MapThemeLayerRecord(QgsMapLayer *l=nullptr)
Initialize layer record with a map layer - it will be stored as a weak pointer.
bool isVisible
true if the layer is visible in the associated theme.
bool usingLegendItems
Whether checkedLegendItems should be applied.
bool usingCurrentStyle
Whether current style is valid and should be applied.
QgsMapLayer * layer() const
Returns map layer or nullptr if the layer does not exist anymore.
bool operator==(const QgsMapThemeCollection::MapThemeLayerRecord &other) const
Individual map theme record of visible layers and styles.
bool operator!=(const QgsMapThemeCollection::MapThemeRecord &other) const
void setExpandedGroupNodes(const QSet< QString > &expandedGroupNodes)
Sets a set of group identifiers for group nodes that should have expanded state.
QSet< QString > expandedGroupNodes() const
Returns a set of group identifiers for group nodes that should have expanded state (other group nodes...
void setCheckedGroupNodes(const QSet< QString > &checkedGroupNodes)
Sets a set of group identifiers for group nodes that should have checked state.
void setHasExpandedStateInfo(bool hasInfo)
Sets whether the map theme contains valid expanded/collapsed state of nodes.
QList< QgsMapThemeCollection::MapThemeLayerRecord > layerRecords() const
Returns a list of records for all visible layer belonging to the theme.
bool operator==(const QgsMapThemeCollection::MapThemeRecord &other) const
QSet< QString > checkedGroupNodes() const
Returns a set of group identifiers for group nodes that should have checked state (other group nodes ...
void setLayerRecords(const QList< QgsMapThemeCollection::MapThemeLayerRecord > &records)
Sets layer records for the theme.
void setHasCheckedStateInfo(bool hasInfo)
Sets whether the map theme contains valid checked/unchecked state of group nodes.
QHash< QgsMapLayer *, QgsMapThemeCollection::MapThemeLayerRecord > validLayerRecords() const
Returns set with only records for valid layers.
bool hasCheckedStateInfo() const
Returns whether information about checked/unchecked state of groups has been recorded and thus whethe...
Container class that allows storage of map themes consisting of visible map layers and layer styles.
void mapThemesChanged()
Emitted when map themes within the collection are changed.
void mapThemeRenamed(const QString &name, const QString &newName)
Emitted when a map theme within the collection is renamed.
QgsMapThemeCollection::MapThemeRecord mapThemeState(const QString &name) const
Returns the recorded state of a map theme.
void mapThemeChanged(const QString &theme)
Emitted when a map theme changes definition.
QgsProject * project()
The QgsProject on which this map theme collection works.
void projectChanged()
Emitted when the project changes.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.