QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Container class that allows storage of visibility presets consisting of visible map layers and layer styles. More...
#include <qgsvisibilitypresetcollection.h>
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, QString > | presetStyleOverrides (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) |
QObject * | child (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< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) 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 QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () 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) |
QThread * | thread () 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, PresetRecord > | PresetRecordMap |
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 |
QObject * | sender () 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 | |
Container class that allows storage of visibility presets consisting of visible map layers and layer styles.
Definition at line 36 of file qgsvisibilitypresetcollection.h.
|
protected |
Definition at line 166 of file qgsvisibilitypresetcollection.h.
QgsVisibilityPresetCollection::QgsVisibilityPresetCollection | ( | ) |
Definition at line 29 of file qgsvisibilitypresetcollection.cpp.
|
static |
Static method for adding visible layers from a layer tree group to a preset record.
parent | layer tree group parent |
rec | preset record to amend |
Definition at line 35 of file qgsvisibilitypresetcollection.cpp.
void QgsVisibilityPresetCollection::applyPresetCheckedLegendNodesToLayer | ( | const QString & | name, |
const QString & | layerID | ||
) |
Apply check states of legend nodes of a given layer as defined in the preset.
name | preset name |
layerID | layer ID |
Definition at line 104 of file qgsvisibilitypresetcollection.cpp.
void QgsVisibilityPresetCollection::clear | ( | ) |
Remove all presets from the collection.
Definition at line 85 of file qgsvisibilitypresetcollection.cpp.
bool QgsVisibilityPresetCollection::hasPreset | ( | const QString & | name | ) | const |
Returns whether a preset with a matching name exists.
name | name of preset to check |
Definition at line 50 of file qgsvisibilitypresetcollection.cpp.
void QgsVisibilityPresetCollection::insert | ( | const QString & | name, |
const PresetRecord & | state | ||
) |
Inserts a new preset to the collection.
name | name of preset |
state | preset record |
Definition at line 55 of file qgsvisibilitypresetcollection.cpp.
|
protectedslot |
Update style name if a stored style gets renamed.
Definition at line 297 of file qgsvisibilitypresetcollection.cpp.
QStringList QgsVisibilityPresetCollection::presets | ( | ) | const |
Returns a list of existing preset names.
Definition at line 93 of file qgsvisibilitypresetcollection.cpp.
|
signal |
Emitted when presets within the collection are changed.
|
inline |
Returns the recorded state of a preset.
name | name of preset |
Definition at line 106 of file qgsvisibilitypresetcollection.h.
QMap< QString, QString > QgsVisibilityPresetCollection::presetStyleOverrides | ( | const QString & | name | ) |
Get layer style overrides (for QgsMapSettings) of the visible layers for given preset.
name | preset name |
Definition at line 134 of file qgsvisibilitypresetcollection.cpp.
QStringList QgsVisibilityPresetCollection::presetVisibleLayers | ( | const QString & | name | ) | const |
Returns the list of layer IDs that should be visible for the specified preset.
name | preset name |
Definition at line 98 of file qgsvisibilitypresetcollection.cpp.
void QgsVisibilityPresetCollection::readXML | ( | const QDomDocument & | doc | ) |
Reads the preset collection state from XML.
doc | DOM document |
Definition at line 188 of file qgsvisibilitypresetcollection.cpp.
|
protected |
Reconnects all preset layers to handle style renames.
Definition at line 167 of file qgsvisibilitypresetcollection.cpp.
|
protectedslot |
Handles updates of the preset collection when layers are removed from the registry.
Definition at line 281 of file qgsvisibilitypresetcollection.cpp.
void QgsVisibilityPresetCollection::removePreset | ( | const QString & | name | ) |
Remove existing preset from collection.
name | preset name |
Definition at line 74 of file qgsvisibilitypresetcollection.cpp.
void QgsVisibilityPresetCollection::update | ( | const QString & | name, |
const PresetRecord & | state | ||
) |
Updates a preset within the collection.
name | name of preset to update |
state | preset record to replace existing preset |
Definition at line 63 of file qgsvisibilitypresetcollection.cpp.
void QgsVisibilityPresetCollection::writeXML | ( | QDomDocument & | doc | ) |
Writes the preset collection state to XML.
doc | DOM document |
Definition at line 241 of file qgsvisibilitypresetcollection.cpp.
|
protected |
Definition at line 167 of file qgsvisibilitypresetcollection.h.