24#include "moc_qgsselectivemaskingsourcesetmanager.cpp"
26using namespace Qt::StringLiterals;
52 if ( set.
id().isEmpty() )
57 if ( l->id() == set.
id() )
97 QVector<QgsSelectiveMaskingSourceSet> res;
129 QDomElement setsElem = element;
130 if ( element.tagName() !=
"SelectiveMaskingSourceSets"_L1 )
132 setsElem = element.firstChildElement( u
"SelectiveMaskingSourceSets"_s );
138 const QDomNodeList setsNodes = setsElem.childNodes();
140 for (
int i = 0; i < setsNodes.size(); ++i )
142 if ( setsNodes.at( i ).nodeName() !=
"selectiveMaskingSourceSet"_L1 )
146 if ( !set.
readXml( setsNodes.at( i ).toElement(), doc, context ) )
164 QDomElement setsElem = doc.createElement( u
"SelectiveMaskingSourceSets"_s );
167 QDomElement setElem = l->writeXml( doc, context );
168 setsElem.appendChild( setElem );
183 while ( name.isEmpty() || names.contains( name ) )
185 name = tr(
"Masking Source Set %1" ).arg(
id );
QgsSelectiveMaskingSourceSet * objectByName(const QString &name) const
QList< QgsSelectiveMaskingSourceSet * > mObjects
bool addObject(QgsSelectiveMaskingSourceSet *object)
bool removeObject(QgsSelectiveMaskingSourceSet *object)
QgsAbstractProjectStoredObjectManager(QgsProject *project=nullptr)
void objectAdded(const QString &name)
Emitted when an object has been added to the manager.
void objectRemoved(const QString &name)
Emitted when an object was removed from the manager.
void objectAboutToBeAdded(const QString &name)
Emitted when an object is about to be added to the manager.
void objectAboutToBeRemoved(const QString &name)
Emitted when an object is about to be removed from the manager.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
A container for the context for various read/write operations on objects.
Scoped object for logging of the runtime for a single operation or group of operations.
bool renameSet(const QString &oldName, const QString &newName)
Renames a set in the manager from oldName to newName.
QVector< QgsSelectiveMaskingSourceSet > sets() const
Returns a list of all sets contained in the manager.
void setRemoved(const QString &name)
Emitted when a set was removed from the manager.
QgsSelectiveMaskingSourceSet setByName(const QString &name) const
Returns the set with a matching name, or an invalid set if no matching sets were found.
void setRenamed(const QString &oldName, const QString &newName)
Emitted when a set is renamed.
void clear()
Removes and deletes all sets from the manager.
bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)
Reads the manager's state from a DOM element, restoring all sets present in the XML document.
QgsSelectiveMaskingSourceSet setById(const QString &id) const
Returns the set with a matching id, or an invalid set if no matching sets were found.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Returns a DOM element representing the state of the manager.
void setAdded(const QString &name)
Emitted when a set has been added to the manager.
QgsSelectiveMaskingSourceSetManager(QgsProject *project=nullptr)
Constructor for QgsSelectiveMaskingSourceSetManager.
bool addSet(const QgsSelectiveMaskingSourceSet &set)
Adds a set to the manager.
QString generateUniqueTitle() const
Generates a unique title for a new set, which does not clash with any already contained by the manage...
void setAboutToBeAdded(const QString &name)
Emitted when a set is about to be added to the manager.
bool removeSet(const QString &name)
Removes the set with matching name from the manager.
~QgsSelectiveMaskingSourceSetManager() override
void setAboutToBeRemoved(const QString &name)
Emitted when a set is about to be removed from the manager.
void changed()
Emitted whenever sets stored within the manager are changed.
bool updateSet(const QgsSelectiveMaskingSourceSet &set)
Updates the definition of a set already in the manager.
Represents a named set of selective masking sources (QgsSelectiveMaskSource).
void setName(const QString &name)
Sets the set's unique name.
QString id() const
Returns a unique identifier for the set.
QVector< QgsSelectiveMaskSource > sources() const
Returns the list of selective mask sources configured in this set.
bool readXml(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets the set's state from a DOM element.