QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Resolves relative paths into absolute paths and vice versa. More...
#include <qgspathresolver.h>
Public Member Functions | |
QgsPathResolver (const QString &baseFileName=QString()) | |
Initialize path resolver with a base filename. Null filename means no conversion between relative/absolute path. More... | |
QString | readPath (const QString &filename) const |
Turn filename read from the project file to an absolute path. More... | |
QString | writePath (const QString &filename) const |
Prepare a filename to save it to the project file. More... | |
Static Public Member Functions | |
static bool | removePathPreprocessor (const QString &id) |
Removes the custom pre-processor function with matching id. More... | |
static QString | setPathPreprocessor (const std::function< QString(const QString &filename)> &processor) |
Sets a path pre-processor function, which allows for manipulation of paths and data sources prior to resolving them to file references or layer sources. More... | |
Resolves relative paths into absolute paths and vice versa.
Used for writing
Definition at line 31 of file qgspathresolver.h.
|
explicit |
Initialize path resolver with a base filename. Null filename means no conversion between relative/absolute path.
Definition at line 29 of file qgspathresolver.cpp.
QString QgsPathResolver::readPath | ( | const QString & | filename | ) | const |
Turn filename read from the project file to an absolute path.
Definition at line 35 of file qgspathresolver.cpp.
|
static |
Removes the custom pre-processor function with matching id.
The id must correspond to a pre-processor previously added via a call to setPathPreprocessor().
Returns true
if processor existed and was removed.
Definition at line 182 of file qgspathresolver.cpp.
|
static |
Sets a path pre-processor function, which allows for manipulation of paths and data sources prior to resolving them to file references or layer sources.
The processor function must accept a single string argument (representing the original file path or data source), and return a processed version of this path.
The path pre-processor function is called before any bad layer handler.
If multiple preprocessors are set, they will be called in sequence based on the order in which they were originally set.
Definition at line 175 of file qgspathresolver.cpp.
QString QgsPathResolver::writePath | ( | const QString & | filename | ) | const |
Prepare a filename to save it to the project file.
Creates an absolute or relative path according to the project settings. Paths written to the project file should be prepared with this method.
Definition at line 192 of file qgspathresolver.cpp.