26using namespace Qt::StringLiterals;
30 if ( !layers.empty() )
33 for (
const QDomNode &layer : layers )
41 const QString type = layerNode.toElement().attribute( u
"type"_s );
50 if (
"raster" == type )
56 else if (
"vector" == type )
70 const QDomNode dataSourceNode = layerNode.namedItem( u
"datasource"_s );
72 if ( dataSourceNode.isNull() )
79 return dataSourceNode.toElement().text();
94 if ( ds.contains(
"host="_L1 ) )
98 else if ( ds.contains(
"dbname="_L1 ) )
121 const QDomNode dataSourceNode = layerNode.namedItem( u
"datasource"_s );
122 const QDomElement dataSourceElement = dataSourceNode.toElement();
123 QDomText dataSourceText = dataSourceElement.firstChild().toText();
static QString removePassword(const QString &aUri, bool hide=false)
Removes the password element from a URI.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
void setDataSource(QDomNode &layerNode, const QString &dataSource)
Set the datasource element to the new value.
ProviderType
the flavors for data storage
@ IS_FILE
Saved in a file.
@ IS_Unknown
Unknown type.
@ IS_DATABASE
Saved in a database.
@ IS_URL
Retrieved from a URL.
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.
QString dataSource(const QDomNode &layerNode)
Returns the data source for the given layer.
DataType dataType(const QDomNode &layerNode)
Returns data type associated with the given QgsProject file Dom node.
DataType
file data representation
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)