57 if ( !mPluginLayerTypes.isEmpty() )
59 QgsDebugMsg( QStringLiteral(
"QgsPluginLayerRegistry::~QgsPluginLayerRegistry(): creator list not empty" ) );
60 const QStringList keys = mPluginLayerTypes.keys();
61 for (
const QString &key : keys )
70 return mPluginLayerTypes.keys();
78 if ( mPluginLayerTypes.contains( type->
name() ) )
81 mPluginLayerTypes[type->
name()] = type;
88 if ( !mPluginLayerTypes.contains(
typeName ) )
93 const auto constLayers = layers;
96 if ( layer->type() == Qgis::LayerType::Plugin )
102 QStringList() << layer->id() );
107 delete mPluginLayerTypes.take(
typeName );
113 return mPluginLayerTypes.value(
typeName,
nullptr );
126 if ( !uri.isEmpty() )
Base class for all map layer types.
bool addPluginLayerType(QgsPluginLayerType *pluginLayerType)
Add plugin layer type (take ownership) and return true on success.
~QgsPluginLayerRegistry()
bool removePluginLayerType(const QString &typeName)
Remove plugin layer type and return true on success.
QStringList pluginLayerTypes()
List all known layer types.
QgsPluginLayerType * pluginLayerType(const QString &typeName)
Returns plugin layer type metadata or nullptr if doesn't exist.
QgsPluginLayer * createLayer(const QString &typeName, const QString &uri=QString())
Returns new layer if corresponding plugin has been found else returns nullptr.
Class for creating plugin specific layers.
virtual bool showLayerProperties(QgsPluginLayer *layer)
Show plugin layer properties dialog. Return false if the dialog cannot be shown.
QgsPluginLayerType(const QString &name)
virtual QgsPluginLayer * createLayer()
Returns new layer of this type. Return nullptr on error.
Base class for plugin layers.
QString pluginLayerType()
Returns plugin layer type (the same as used in QgsPluginLayerRegistry)
static QgsProject * instance()
Returns the QgsProject singleton instance.
void removeMapLayers(const QStringList &layerIds)
Remove a set of layers from the registry by layer ID.
QMap< QString, QgsMapLayer * > mapLayers(const bool validOnly=false) const
Returns a map of all registered layers by layer ID.