QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Classes | Signals | Public Member Functions | Static Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
QgsVisibilityPresetCollection Class Reference

Container class that allows storage of visibility presets consisting of visible map layers and layer styles. More...

#include <qgsvisibilitypresetcollection.h>

Inheritance diagram for QgsVisibilityPresetCollection:
Inheritance graph
[legend]

Classes

class  PresetRecord
 Individual preset record of visible layers and styles. More...
 

Signals

void presetsChanged ()
 Emitted when presets within the collection are changed. More...
 

Public Member Functions

 QgsVisibilityPresetCollection ()
 
void applyPresetCheckedLegendNodesToLayer (const QString &name, const QString &layerID)
 Apply check states of legend nodes of a given layer as defined in the preset. More...
 
void clear ()
 Remove all presets from the collection. More...
 
bool hasPreset (const QString &name) const
 Returns whether a preset with a matching name exists. More...
 
void insert (const QString &name, const PresetRecord &state)
 Inserts a new preset to the collection. More...
 
QStringList presets () const
 Returns a list of existing preset names. More...
 
PresetRecord presetState (const QString &name) const
 Returns the recorded state of a preset. More...
 
QMap< QString, QStringpresetStyleOverrides (const QString &name)
 Get layer style overrides (for QgsMapSettings) of the visible layers for given preset. More...
 
QStringList presetVisibleLayers (const QString &name) const
 Returns the list of layer IDs that should be visible for the specified preset. More...
 
void readXML (const QDomDocument &doc)
 Reads the preset collection state from XML. More...
 
void removePreset (const QString &name)
 Remove existing preset from collection. More...
 
void update (const QString &name, const PresetRecord &state)
 Updates a preset within the collection. More...
 
void writeXML (QDomDocument &doc)
 Writes the preset collection state to XML. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Static Public Member Functions

static void addVisibleLayersToPreset (QgsLayerTreeGroup *parent, PresetRecord &rec)
 Static method for adding visible layers from a layer tree group to a preset record. More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Types

typedef QMap< QString, PresetRecordPresetRecordMap
 

Protected Slots

void layerStyleRenamed (const QString &oldName, const QString &newName)
 Update style name if a stored style gets renamed. More...
 
void registryLayersRemoved (const QStringList &layerIDs)
 Handles updates of the preset collection when layers are removed from the registry. More...
 

Protected Member Functions

void reconnectToLayersStyleManager ()
 Reconnects all preset layers to handle style renames. More...
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

PresetRecordMap mPresets
 

Additional Inherited Members

- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Container class that allows storage of visibility presets consisting of visible map layers and layer styles.

Note
added in QGIS 2.12

Definition at line 36 of file qgsvisibilitypresetcollection.h.

Member Typedef Documentation

◆ PresetRecordMap

Definition at line 166 of file qgsvisibilitypresetcollection.h.

Constructor & Destructor Documentation

◆ QgsVisibilityPresetCollection()

QgsVisibilityPresetCollection::QgsVisibilityPresetCollection ( )

Definition at line 29 of file qgsvisibilitypresetcollection.cpp.

Member Function Documentation

◆ addVisibleLayersToPreset()

void QgsVisibilityPresetCollection::addVisibleLayersToPreset ( QgsLayerTreeGroup parent,
QgsVisibilityPresetCollection::PresetRecord rec 
)
static

Static method for adding visible layers from a layer tree group to a preset record.

Parameters
parentlayer tree group parent
recpreset record to amend

Definition at line 35 of file qgsvisibilitypresetcollection.cpp.

◆ applyPresetCheckedLegendNodesToLayer()

void QgsVisibilityPresetCollection::applyPresetCheckedLegendNodesToLayer ( const QString name,
const QString layerID 
)

Apply check states of legend nodes of a given layer as defined in the preset.

Parameters
namepreset name
layerIDlayer ID

Definition at line 104 of file qgsvisibilitypresetcollection.cpp.

◆ clear()

void QgsVisibilityPresetCollection::clear ( )

Remove all presets from the collection.

Definition at line 85 of file qgsvisibilitypresetcollection.cpp.

◆ hasPreset()

bool QgsVisibilityPresetCollection::hasPreset ( const QString name) const

Returns whether a preset with a matching name exists.

Parameters
namename of preset to check
Returns
true if preset exists

Definition at line 50 of file qgsvisibilitypresetcollection.cpp.

◆ insert()

void QgsVisibilityPresetCollection::insert ( const QString name,
const PresetRecord state 
)

Inserts a new preset to the collection.

Parameters
namename of preset
statepreset record
See also
update()

Definition at line 55 of file qgsvisibilitypresetcollection.cpp.

◆ layerStyleRenamed

void QgsVisibilityPresetCollection::layerStyleRenamed ( const QString oldName,
const QString newName 
)
protectedslot

Update style name if a stored style gets renamed.

Definition at line 297 of file qgsvisibilitypresetcollection.cpp.

◆ presets()

QStringList QgsVisibilityPresetCollection::presets ( ) const

Returns a list of existing preset names.

Definition at line 93 of file qgsvisibilitypresetcollection.cpp.

◆ presetsChanged

void QgsVisibilityPresetCollection::presetsChanged ( )
signal

Emitted when presets within the collection are changed.

◆ presetState()

PresetRecord QgsVisibilityPresetCollection::presetState ( const QString name) const
inline

Returns the recorded state of a preset.

Parameters
namename of preset

Definition at line 106 of file qgsvisibilitypresetcollection.h.

◆ presetStyleOverrides()

QMap< QString, QString > QgsVisibilityPresetCollection::presetStyleOverrides ( const QString name)

Get layer style overrides (for QgsMapSettings) of the visible layers for given preset.

Parameters
namepreset name

Definition at line 134 of file qgsvisibilitypresetcollection.cpp.

◆ presetVisibleLayers()

QStringList QgsVisibilityPresetCollection::presetVisibleLayers ( const QString name) const

Returns the list of layer IDs that should be visible for the specified preset.

Note
The order of the returned list is not guaranteed to reflect the order of layers in the canvas.
Parameters
namepreset name

Definition at line 98 of file qgsvisibilitypresetcollection.cpp.

◆ readXML()

void QgsVisibilityPresetCollection::readXML ( const QDomDocument doc)

Reads the preset collection state from XML.

Parameters
docDOM document
See also
writeXML

Definition at line 188 of file qgsvisibilitypresetcollection.cpp.

◆ reconnectToLayersStyleManager()

void QgsVisibilityPresetCollection::reconnectToLayersStyleManager ( )
protected

Reconnects all preset layers to handle style renames.

Definition at line 167 of file qgsvisibilitypresetcollection.cpp.

◆ registryLayersRemoved

void QgsVisibilityPresetCollection::registryLayersRemoved ( const QStringList layerIDs)
protectedslot

Handles updates of the preset collection when layers are removed from the registry.

Definition at line 281 of file qgsvisibilitypresetcollection.cpp.

◆ removePreset()

void QgsVisibilityPresetCollection::removePreset ( const QString name)

Remove existing preset from collection.

Parameters
namepreset name

Definition at line 74 of file qgsvisibilitypresetcollection.cpp.

◆ update()

void QgsVisibilityPresetCollection::update ( const QString name,
const PresetRecord state 
)

Updates a preset within the collection.

Parameters
namename of preset to update
statepreset record to replace existing preset
See also
insert()

Definition at line 63 of file qgsvisibilitypresetcollection.cpp.

◆ writeXML()

void QgsVisibilityPresetCollection::writeXML ( QDomDocument doc)

Writes the preset collection state to XML.

Parameters
docDOM document
See also
readXML

Definition at line 241 of file qgsvisibilitypresetcollection.cpp.

Member Data Documentation

◆ mPresets

PresetRecordMap QgsVisibilityPresetCollection::mPresets
protected

Definition at line 167 of file qgsvisibilitypresetcollection.h.


The documentation for this class was generated from the following files: