1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmapthemecollection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsMapThemeCollection : QObject
{
%Docstring(signature="appended")
Container class that allows storage of map themes consisting of visible
map layers and layer styles.
%End
%TypeHeaderCode
#include "qgsmapthemecollection.h"
%End
public:
class MapThemeLayerRecord
{
%Docstring(signature="appended")
Individual record of a visible layer in a map theme record.
%End
%TypeHeaderCode
#include "qgsmapthemecollection.h"
%End
public:
MapThemeLayerRecord( QgsMapLayer *l = 0 );
%Docstring
Initialize layer record with a map layer - it will be stored as a weak
pointer
%End
bool operator==( const QgsMapThemeCollection::MapThemeLayerRecord &other ) const;
bool operator!=( const QgsMapThemeCollection::MapThemeLayerRecord &other ) const;
QgsMapLayer *layer() const;
%Docstring
Returns map layer or ``None`` if the layer does not exist anymore
%End
void setLayer( QgsMapLayer *layer );
%Docstring
Sets the map layer for this record
%End
bool isVisible;
bool usingCurrentStyle;
QString currentStyle;
bool usingLegendItems;
QSet<QString> checkedLegendItems;
QSet<QString> expandedLegendItems;
bool expandedLayerNode;
};
class MapThemeRecord
{
%Docstring(signature="appended")
Individual map theme record of visible layers and styles.
%End
%TypeHeaderCode
#include "qgsmapthemecollection.h"
%End
public:
bool operator==( const QgsMapThemeCollection::MapThemeRecord &other ) const;
bool operator!=( const QgsMapThemeCollection::MapThemeRecord &other ) const;
QList<QgsMapThemeCollection::MapThemeLayerRecord> layerRecords() const;
%Docstring
Returns a list of records for all visible layer belonging to the theme.
%End
void setLayerRecords( const QList<QgsMapThemeCollection::MapThemeLayerRecord> &records );
%Docstring
Sets layer records for the theme.
%End
void removeLayerRecord( QgsMapLayer *layer );
%Docstring
Removes a record for ``layer`` if present.
%End
void addLayerRecord( const QgsMapThemeCollection::MapThemeLayerRecord &record );
%Docstring
Add a new record for a layer.
%End
bool hasExpandedStateInfo() const;
%Docstring
Returns whether information about expanded/collapsed state of nodes has
been recorded and thus whether
:py:func:`~MapThemeRecord.expandedGroupNodes` and expandedLegendItems +
expandedLayerNode from layer records are valid.
.. versionadded:: 3.2
%End
bool hasCheckedStateInfo() const;
%Docstring
Returns whether information about checked/unchecked state of groups has
been recorded and thus whether
:py:func:`~MapThemeRecord.checkedGroupNodes` is valid.
.. versionadded:: 3.10.1
%End
void setHasExpandedStateInfo( bool hasInfo );
%Docstring
Sets whether the map theme contains valid expanded/collapsed state of
nodes
.. versionadded:: 3.2
%End
void setHasCheckedStateInfo( bool hasInfo );
%Docstring
Sets whether the map theme contains valid checked/unchecked state of
group nodes
.. versionadded:: 3.10.1
%End
QSet<QString> expandedGroupNodes() const;
%Docstring
Returns a set of group identifiers for group nodes that should have
expanded state (other group nodes should be collapsed). The returned
value is valid only when :py:func:`~MapThemeRecord.hasExpandedStateInfo`
returns ``True``. Group identifiers are built using group names, a
sub-group name is prepended by parent group's identifier and a forward
slash, e.g. "level1/level2"
.. versionadded:: 3.2
%End
QSet<QString> checkedGroupNodes() const;
%Docstring
Returns a set of group identifiers for group nodes that should have
checked state (other group nodes should be unchecked). The returned
value is valid only when :py:func:`~MapThemeRecord.hasCheckedStateInfo`
returns ``True``. Group identifiers are built using group names, a
sub-group name is prepended by parent group's identifier and a forward
slash, e.g. "level1/level2"
.. versionadded:: 3.10.1
%End
void setExpandedGroupNodes( const QSet<QString> &expandedGroupNodes );
%Docstring
Sets a set of group identifiers for group nodes that should have
expanded state. See :py:func:`~MapThemeRecord.expandedGroupNodes`.
.. versionadded:: 3.2
%End
void setCheckedGroupNodes( const QSet<QString> &checkedGroupNodes );
%Docstring
Sets a set of group identifiers for group nodes that should have checked
state. See :py:func:`~MapThemeRecord.checkedGroupNodes`.
.. versionadded:: 3.10.1
%End
};
QgsMapThemeCollection( QgsProject *project = 0 );
%Docstring
Create map theme collection that handles themes of the given project.
%End
bool hasMapTheme( const QString &name ) const;
%Docstring
Returns whether a map theme with a matching name exists.
%End
void insert( const QString &name, const QgsMapThemeCollection::MapThemeRecord &state );
%Docstring
Inserts a new map theme to the collection.
.. seealso:: :py:func:`update`
%End
void update( const QString &name, const QgsMapThemeCollection::MapThemeRecord &state );
%Docstring
Updates a map theme within the collection.
:param name: name of map theme to update
:param state: map theme record to replace existing map theme
.. seealso:: :py:func:`insert`
%End
void removeMapTheme( const QString &name );
%Docstring
Removes an existing map theme from collection.
%End
bool renameMapTheme( const QString &name, const QString &newName );
%Docstring
Renames the existing map theme called ``name`` to ``newName``. Returns
``True`` if the rename was successful, or ``False`` if it failed (e.g.
due to a duplicate name for ``newName``).
.. versionadded:: 3.14
%End
void clear();
%Docstring
Removes all map themes from the collection.
%End
QStringList mapThemes() const;
%Docstring
Returns a list of existing map theme names.
%End
QgsMapThemeCollection::MapThemeRecord mapThemeState( const QString &name ) const;
%Docstring
Returns the recorded state of a map theme.
%End
QStringList mapThemeVisibleLayerIds( const QString &name ) const;
%Docstring
Returns the list of layer IDs that are visible for the specified map
theme.
.. note::
The order of the returned list is not guaranteed to reflect the order of layers
in the canvas.
%End
QList<QgsMapLayer *> mapThemeVisibleLayers( const QString &name ) const;
%Docstring
Returns the list of layers that are visible for the specified map theme.
.. note::
The order of the returned list is not guaranteed to reflect the order of layers
in the canvas.
%End
QMap<QString, QString> mapThemeStyleOverrides( const QString &name );
%Docstring
Gets layer style overrides (for :py:class:`QgsMapSettings`) of the
visible layers for given map theme.
%End
void readXml( const QDomDocument &doc );
%Docstring
Reads the map theme collection state from XML
:param doc: DOM document
.. seealso:: :py:func:`writeXml`
%End
void writeXml( QDomDocument &doc );
%Docstring
Writes the map theme collection state to XML.
:param doc: DOM document
.. seealso:: :py:func:`readXml`
%End
static QgsMapThemeCollection::MapThemeRecord createThemeFromCurrentState( QgsLayerTreeGroup *root, QgsLayerTreeModel *model );
%Docstring
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).
%End
void applyTheme( const QString &name, QgsLayerTreeGroup *root, QgsLayerTreeModel *model );
%Docstring
Apply theme given by its name and modify layer tree, current style of
layers and checked legend items of passed layer tree model.
%End
QgsProject *project();
%Docstring
Returns the :py:class:`QgsProject` on which this map theme collection
works.
.. seealso:: :py:func:`setProject`
.. seealso:: :py:func:`projectChanged`
%End
void setProject( QgsProject *project );
%Docstring
Sets the ``project`` on which this map theme collection works.
.. seealso:: :py:func:`project`
.. seealso:: :py:func:`projectChanged`
%End
QList< QgsMapLayer * > masterLayerOrder() const;
%Docstring
Returns the master layer order (this will always match the project's
:py:func:`QgsProject.layerOrder()` ). All map themes will maintain the
same layer order as the master layer order.
.. seealso:: :py:func:`masterVisibleLayers`
%End
QList< QgsMapLayer * > masterVisibleLayers() const;
%Docstring
Returns the master list of visible layers. The order of returned layers
will always match those of
:py:func:`~QgsMapThemeCollection.masterLayerOrder`, but the returned
layers are filtered to only include those visible in the project's layer
tree.
.. seealso:: :py:func:`masterLayerOrder`
%End
signals:
void mapThemesChanged();
%Docstring
Emitted when map themes within the collection are changed.
%End
void mapThemeChanged( const QString &theme );
%Docstring
Emitted when a map theme changes definition.
%End
void mapThemeRenamed( const QString &name, const QString &newName );
%Docstring
Emitted when a map theme within the collection is renamed.
.. versionadded:: 3.14
%End
void projectChanged();
%Docstring
Emitted when the project changes
.. seealso:: :py:func:`project`
.. seealso:: :py:func:`setProject`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmapthemecollection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|