26  if ( !layers.empty() )
 
   29  for ( 
const QDomNode &layer : layers )
 
 
   37  const QString type = layerNode.toElement().attribute( QStringLiteral( 
"type" ) );
 
   41    QgsDebugError( QStringLiteral( 
"cannot find ``type'' attribute" ) );
 
   46  if ( 
"raster" == type )
 
   52  else if ( 
"vector" == type )
 
 
   66  const QDomNode dataSourceNode = layerNode.namedItem( QStringLiteral( 
"datasource" ) );
 
   68  if ( dataSourceNode.isNull() )
 
   70    QgsDebugError( QStringLiteral( 
"cannot find datasource node" ) );
 
   75  return dataSourceNode.toElement().text();
 
 
   90      if ( ds.contains( QLatin1String( 
"host=" ) ) )
 
   94      else if ( ds.contains( QLatin1String( 
"dbname=" ) ) )
 
  109      QgsDebugError( QStringLiteral( 
"unknown ``type'' attribute" ) );
 
 
  117  const QDomNode dataSourceNode = layerNode.namedItem( QStringLiteral( 
"datasource" ) );
 
  118  const QDomElement dataSourceElement = dataSourceNode.toElement();
 
  119  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)
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)