QGIS API Documentation  2.99.0-Master (c42dad3)
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
QgsProjectBadLayerGuiHandler Class Reference

Handler for missing layers within project. More...

#include <qgsprojectbadlayerguihandler.h>

Inheritance diagram for QgsProjectBadLayerGuiHandler:
Inheritance graph
[legend]

Public Member Functions

 QgsProjectBadLayerGuiHandler ()
 
virtual void handleBadLayers (const QList< QDomNode > &layers) override
 This method will be called whenever the project tries to load layers which cannot be accessed. More...
 
- Public Member Functions inherited from QgsProjectBadLayerHandler
virtual ~QgsProjectBadLayerHandler ()
 

Static Public Attributes

static bool mIgnore = false
 Flag to store the Ignore button press of MessageBox used by QgsLegend. More...
 

Protected Member Functions

bool findLayer (const QString &fileFilters, const QDomNode &constLayerNode)
 Find relocated data source for the given layer. More...
 
void findLayers (const QString &fileFilters, const QList< QDomNode > &layerNodes)
 Find relocated data sources for given layers These QDom objects represent QgsProject nodes that map to specific layers. More...
 
bool findMissingFile (const QString &fileFilters, QDomNode &layerNode)
 This is used to locate files that have moved or otherwise are missing. More...
 
- Protected Member Functions inherited from QgsProjectBadLayerHandler
QString dataSource (const QDomNode &layerNode)
 Return the data source for the given layer. More...
 
DataType dataType (const QDomNode &layerNode)
 Returns data type associated with the given QgsProject file Dom node. More...
 
ProviderType providerType (const QDomNode &layerNode)
 Return the physical storage type associated with the given layer. More...
 
void setDataSource (QDomNode &layerNode, const QString &dataSource)
 Set the datasource element to the new value. More...
 

Additional Inherited Members

- Protected Types inherited from QgsProjectBadLayerHandler
enum  DataType { IS_VECTOR, IS_RASTER, IS_BOGUS }
 file data representation More...
 
enum  ProviderType { IS_FILE, IS_DATABASE, IS_URL, IS_Unknown }
 the flavors for data storage More...
 

Detailed Description

Handler for missing layers within project.

Gives user a chance to select path to the missing layers.

Definition at line 26 of file qgsprojectbadlayerguihandler.h.

Constructor & Destructor Documentation

§ QgsProjectBadLayerGuiHandler()

QgsProjectBadLayerGuiHandler::QgsProjectBadLayerGuiHandler ( )

Definition at line 29 of file qgsprojectbadlayerguihandler.cpp.

Member Function Documentation

§ findLayer()

bool QgsProjectBadLayerGuiHandler::findLayer ( const QString &  fileFilters,
const QDomNode &  constLayerNode 
)
protected

Find relocated data source for the given layer.

This QDom object represents a QgsProject node that maps to a specific layer.

Parameters
fileFiltersfile filters to use
constLayerNodeQDom node containing layer project information
Todo:

XXX Only implemented for file based layers. It will need to be extended for XXX other data source types such as databases.

Definition at line 83 of file qgsprojectbadlayerguihandler.cpp.

§ findLayers()

void QgsProjectBadLayerGuiHandler::findLayers ( const QString &  fileFilters,
const QList< QDomNode > &  layerNodes 
)
protected

Find relocated data sources for given layers These QDom objects represent QgsProject nodes that map to specific layers.

Definition at line 176 of file qgsprojectbadlayerguihandler.cpp.

§ findMissingFile()

bool QgsProjectBadLayerGuiHandler::findMissingFile ( const QString &  fileFilters,
QDomNode &  layerNode 
)
protected

This is used to locate files that have moved or otherwise are missing.

Definition at line 111 of file qgsprojectbadlayerguihandler.cpp.

§ handleBadLayers()

void QgsProjectBadLayerGuiHandler::handleBadLayers ( const QList< QDomNode > &  layers)
overridevirtual

This method will be called whenever the project tries to load layers which cannot be accessed.

It should inform the user about this and if possible offer to fix the unavailable layers by setting a valid datasource, e.g. by showing a file dialog.

The default implementation will dismiss all bad layers and write information to the log.

Note
Added in QGIS 3.0
See also
QgsProjectBadLayerGuiHandler

Reimplemented from QgsProjectBadLayerHandler.

Definition at line 35 of file qgsprojectbadlayerguihandler.cpp.

Member Data Documentation

§ mIgnore

bool QgsProjectBadLayerGuiHandler::mIgnore = false
static

Flag to store the Ignore button press of MessageBox used by QgsLegend.

Definition at line 36 of file qgsprojectbadlayerguihandler.h.


The documentation for this class was generated from the following files: