QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | Static Public Attributes | List of all members
QgsLocalizedDataPathRegistry Class Reference

A registry class to hold localized data paths which can be used for basemaps, logos, etc. More...

#include <qgslocalizeddatapathregistry.h>

Public Member Functions

 QgsLocalizedDataPathRegistry ()
 
QString globalPath (const QString &localizedPath) const
 Returns the global path if the file has been found in one of the paths, an empty string otherwise. More...
 
QString localizedPath (const QString &globalPath) const
 Returns the localized path if the file has been found in one of the path, an empty string otherwise. More...
 
QStringList paths () const
 Returns a list of registered localized paths. More...
 
void registerPath (const QString &path, int position=-1)
 Registers a localized path If position is given, the path is inserted at the given position in the list Since the paths are stored by order of preference, lower positions in the list take precedence. More...
 
void setPaths (const QStringList &paths)
 Sets the complete list of localized path. More...
 
void unregisterPath (const QString &path)
 Unregisters a localized path. More...
 

Static Public Attributes

static const QgsSettingsEntryStringList settingsLocalizedDataPaths = QgsSettingsEntryStringList( QStringLiteral( "localized_data_paths" ), QgsSettings::Prefix::QGIS, QStringList() )
 Settings entry localized data paths. More...
 

Detailed Description

A registry class to hold localized data paths which can be used for basemaps, logos, etc.

Paths are meant to be absolute paths and are stored by order of preference.

If a layer from one of the paths is loaded, it will be saved as localized in the project file. For instance, if you have C:/my_maps in your localized paths, C:/my_maps/my_country/ortho.tif will be save in your project as localized:my_country/ortho.tif.

The resolving of the file paths happens in QgsPathResolver.

Since
QGIS 3.14

Definition at line 42 of file qgslocalizeddatapathregistry.h.

Constructor & Destructor Documentation

◆ QgsLocalizedDataPathRegistry()

QgsLocalizedDataPathRegistry::QgsLocalizedDataPathRegistry ( )

Definition at line 24 of file qgslocalizeddatapathregistry.cpp.

Member Function Documentation

◆ globalPath()

QString QgsLocalizedDataPathRegistry::globalPath ( const QString &  localizedPath) const

Returns the global path if the file has been found in one of the paths, an empty string otherwise.

Definition at line 29 of file qgslocalizeddatapathregistry.cpp.

◆ localizedPath()

QString QgsLocalizedDataPathRegistry::localizedPath ( const QString &  globalPath) const

Returns the localized path if the file has been found in one of the path, an empty string otherwise.

Definition at line 40 of file qgslocalizeddatapathregistry.cpp.

◆ paths()

QStringList QgsLocalizedDataPathRegistry::paths ( ) const

Returns a list of registered localized paths.

Definition at line 52 of file qgslocalizeddatapathregistry.cpp.

◆ registerPath()

void QgsLocalizedDataPathRegistry::registerPath ( const QString &  path,
int  position = -1 
)

Registers a localized path If position is given, the path is inserted at the given position in the list Since the paths are stored by order of preference, lower positions in the list take precedence.

Definition at line 78 of file qgslocalizeddatapathregistry.cpp.

◆ setPaths()

void QgsLocalizedDataPathRegistry::setPaths ( const QStringList &  paths)

Sets the complete list of localized path.

Definition at line 62 of file qgslocalizeddatapathregistry.cpp.

◆ unregisterPath()

void QgsLocalizedDataPathRegistry::unregisterPath ( const QString &  path)

Unregisters a localized path.

Definition at line 97 of file qgslocalizeddatapathregistry.cpp.

Member Data Documentation

◆ settingsLocalizedDataPaths

const QgsSettingsEntryStringList QgsLocalizedDataPathRegistry::settingsLocalizedDataPaths = QgsSettingsEntryStringList( QStringLiteral( "localized_data_paths" ), QgsSettings::Prefix::QGIS, QStringList() )
inlinestatic

Settings entry localized data paths.

Definition at line 71 of file qgslocalizeddatapathregistry.h.


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