26 Q_FOREACH (
const QDomNode &layer, layers )
34 QString type = layerNode.toElement().attribute( QStringLiteral(
"type" ) );
43 if (
"raster" == type )
49 else if (
"vector" == type )
63 QDomNode dataSourceNode = layerNode.namedItem( QStringLiteral(
"datasource" ) );
65 if ( dataSourceNode.isNull() )
72 return dataSourceNode.toElement().text();
87 if ( ds.contains( QLatin1String(
"host=" ) ) )
91 else if ( ds.contains( QLatin1String(
"dbname=" ) ) )
114 QDomNode dataSourceNode = layerNode.namedItem( QStringLiteral(
"datasource" ) );
115 QDomElement dataSourceElement = dataSourceNode.toElement();
116 QDomText dataSourceText = dataSourceElement.firstChild().toText();
118 QgsDebugMsg(
"datasource changed from " + dataSourceText.data() );
120 dataSourceText.setData( dataSource );
DataType
file data representation
void setDataSource(QDomNode &layerNode, const QString &dataSource)
Set the datasource element to the new value.
ProviderType
the flavors for data storage
static QgsMessageLog * messageLog()
Returns the application's message log.
DataType dataType(const QDomNode &layerNode)
Returns data type associated with the given QgsProject file Dom node.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QString dataSource(const QDomNode &layerNode)
Returns the data source for the given layer.
virtual void handleBadLayers(const QList< QDomNode > &layers)
This method will be called whenever the project tries to load layers which cannot be accessed...
ProviderType providerType(const QDomNode &layerNode)
Returns the physical storage type associated with the given layer.