QGIS API Documentation
2.8.2-Wien
|
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc. More...
#include <qgsapplication.h>
Public Types | |
enum | ENDIAN { XDR = 0, NDR = 1 } |
constants for endian-ness More... | |
typedef enum QgsApplication::ENDIAN | endian_t |
constants for endian-ness |
Signals | |
void | preNotify (QObject *receiver, QEvent *event, bool *done) |
Public Member Functions | |
QgsApplication (int &argc, char **argv, bool GUIenabled, QString customConfigPath=QString()) | |
virtual | ~QgsApplication () |
virtual bool | event (QEvent *event) override |
Watch for QFileOpenEvent. | |
virtual bool | notify (QObject *receiver, QEvent *event) override |
Catch exceptions when sending event to receiver. |
Static Public Member Functions | |
static QString | absolutePathToRelativePath (QString apath, QString targetPath) |
Converts absolute path to path relative to target. | |
static const QString | activeThemePath () |
Returns the path to the currently active theme directory. | |
static void | applyGdalSkippedDrivers () |
Apply the skipped drivers list to gdal. | |
static const QString | authorsFilePath () |
Returns the path to the authors file. | |
static QString | buildOutputPath () |
Returns path to the build output directory. | |
static QString | buildSourcePath () |
Returns path to the source directory. | |
static const QString | contributorsFilePath () |
Returns the path to the contributors file. | |
static bool | createDB (QString *errorMessage=0) |
initialise qgis.db | |
static const QString | defaultStyleV2Path () |
Returns the path to default style (works as a starting point). | |
static const QString | defaultThemePath () |
Returns the path to the default theme directory. | |
static const QString | developersMapFilePath () |
Returns the path to the developers map file. | |
static const QString | donorsFilePath () |
Returns the path to the donors file. | |
static endian_t | endian () |
Returns whether this machine uses big or little endian. | |
static void | exitQgis () |
deletes provider registry and map layer registry | |
static QIcon | getThemeIcon (const QString &theName) |
Helper to get a theme icon. | |
static QPixmap | getThemePixmap (const QString &theName) |
Helper to get a theme icon as a pixmap. | |
static const QString | helpAppPath () |
Returns the path to the help application. | |
static const QString | i18nPath () |
Returns the path to the translation directory. | |
static QString | iconPath (QString iconFile) |
Returns path to the desired icon file. | |
static const QString | iconsPath () |
Returns the path to the icons image directory. | |
static void | init (QString customConfigPath=QString()) |
This method initialises paths etc for QGIS. | |
static void | initQgis () |
loads providers | |
static bool | isRunningFromBuildDir () |
Indicates whether running from build directory (not installed) | |
static const QString | libexecPath () |
Returns the path with utility executables (help viewer, crssync, ...) | |
static const QString | libraryPath () |
Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries. | |
static const QString | licenceFilePath () |
static int | maxThreads () |
Get maximum concurrent thread count. | |
static const QString | pkgDataPath () |
Returns the common root path of all application data directories. | |
static const QString | pluginPath () |
Returns the path to the application plugin directory. | |
static const QString | prefixPath () |
Returns the path to the application prefix directory. | |
static const QString | qgisMasterDbFilePath () |
Returns the path to the master qgis.db file. | |
static const QString | qgisSettingsDirPath () |
Returns the path to the settings directory in user's home dir. | |
static const QString | qgisUserDbFilePath () |
Returns the path to the user qgis.db file. | |
static void | registerOgrDrivers () |
Register OGR drivers ensuring this only happens once. | |
static QString | relativePathToAbsolutePath (QString rpath, QString targetPath) |
Converts path relative to target to an absolute path. | |
static QString | reportStyleSheet () |
get a standard css style sheet for reports. | |
static void | restoreGdalDriver (QString theDriver) |
Sets the GDAL_SKIP environment variable to exclude the specified driver and then calls GDALDriverManager::AutoSkipDrivers() to unregister it. | |
static void | setDefaultSvgPaths (const QStringList &pathList) |
Alters default svg paths - used by 3rd party apps. | |
static void | setFileOpenEventReceiver (QObject *receiver) |
Set the FileOpen event receiver. | |
static void | setMaxThreads (int maxThreads) |
Set maximum concurrent thread count. | |
static void | setPkgDataPath (const QString &thePkgDataPath) |
Alters pkg data path - used by 3rd party apps. | |
static void | setPluginPath (const QString &thePluginPath) |
Alters plugin path - used by 3rd party apps. | |
static void | setPrefixPath (const QString &thePrefixPath, bool useDefaultPaths=false) |
Alters prefix path - used by 3rd party apps. | |
static void | setThemeName (const QString &theThemeName) |
Set the active theme to the specified theme. | |
static QString | showSettings () |
Convenience function to get a summary of the paths used in this application instance useful for debugging mainly. | |
static void | skipGdalDriver (QString theDriver) |
Sets the GDAL_SKIP environment variable to include the specified driver and then calls GDALDriverManager::AutoSkipDrivers() to unregister it. | |
static QStringList | skippedGdalDrivers () |
Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable) | |
static const QString | splashPath () |
Returns the path to the splash screen image directory. | |
static const QString | sponsorsFilePath () |
Returns the path to the sponsors file. | |
static const QString | srsDbFilePath () |
Returns the path to the srs.db file. | |
static const QStringList | svgPaths () |
Returns the pathes to svg directories. | |
static const QMap< QString, QString > | systemEnvVars () |
Returns the system environment variables passed to application. | |
static const QString | themeName () |
Set the active theme to the specified theme. | |
static const QString | translatorsFilePath () |
Returns the path to the sponsors file. | |
static const QString | userStyleV2Path () |
Returns the path to user's style. |
Static Public Attributes | |
static const char * | QGIS_APPLICATION_NAME = "QGIS2" |
static const char * | QGIS_ORGANIZATION_DOMAIN = "qgis.org" |
static const char * | QGIS_ORGANIZATION_NAME = "QGIS" |
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
The QgsApplication class manages application-wide information.
This is a subclass of QApplication and should be instantiated in place of QApplication. Most methods are static in keeping witn the design of QApplication.
This class hides platform-specific path information and provides a portable way of referencing specific files and directories. Ideally, hard-coded paths should appear only here and not in other modules so that platform-conditional code is minimized and paths are easier to change due to centralization.
Definition at line 34 of file qgsapplication.h.
typedef enum QgsApplication::ENDIAN QgsApplication::endian_t |
constants for endian-ness
QgsApplication::QgsApplication | ( | int & | argc, |
char ** | argv, | ||
bool | GUIenabled, | ||
QString | customConfigPath = QString() |
||
) |
Definition at line 86 of file qgsapplication.cpp.
|
virtual |
Definition at line 206 of file qgsapplication.cpp.
|
static |
Converts absolute path to path relative to target.
Definition at line 776 of file qgsapplication.cpp.
|
static |
Returns the path to the currently active theme directory.
Definition at line 354 of file qgsapplication.cpp.
|
static |
Apply the skipped drivers list to gdal.
Definition at line 910 of file qgsapplication.cpp.
|
static |
Returns the path to the authors file.
Definition at line 434 of file qgsapplication.cpp.
|
inlinestatic |
Returns path to the build output directory.
Valid only when running from build directory
Definition at line 245 of file qgsapplication.h.
|
inlinestatic |
Returns path to the source directory.
Valid only when running from build directory
Definition at line 243 of file qgsapplication.h.
|
static |
Returns the path to the contributors file.
Contributors are people who have submitted patches but don't have commit access.
Definition at line 441 of file qgsapplication.cpp.
|
static |
initialise qgis.db
Definition at line 920 of file qgsapplication.cpp.
|
static |
Returns the path to default style (works as a starting point).
Definition at line 594 of file qgsapplication.cpp.
|
static |
Returns the path to the default theme directory.
Definition at line 350 of file qgsapplication.cpp.
|
static |
Returns the path to the developers map file.
The developers map was created by using leaflet framework, it shows the doc/contributors.json file.
Definition at line 445 of file qgsapplication.cpp.
|
static |
Returns the path to the donors file.
Definition at line 460 of file qgsapplication.cpp.
|
static |
Returns whether this machine uses big or little endian.
Definition at line 609 of file qgsapplication.cpp.
|
overridevirtual |
Watch for QFileOpenEvent.
Definition at line 210 of file qgsapplication.cpp.
|
static |
deletes provider registry and map layer registry
Definition at line 623 of file qgsapplication.cpp.
|
static |
Helper to get a theme icon.
It will fall back to the default theme if the active theme does not have the required icon.
Definition at line 371 of file qgsapplication.cpp.
|
static |
Helper to get a theme icon as a pixmap.
It will fall back to the default theme if the active theme does not have the required icon.
Definition at line 392 of file qgsapplication.cpp.
|
static |
Returns the path to the help application.
Definition at line 480 of file qgsapplication.cpp.
|
static |
Returns the path to the translation directory.
Definition at line 497 of file qgsapplication.cpp.
|
static |
Returns path to the desired icon file.
First it tries to use the active theme path, then default theme path
Definition at line 360 of file qgsapplication.cpp.
|
static |
Returns the path to the icons image directory.
Definition at line 540 of file qgsapplication.cpp.
|
static |
This method initialises paths etc for QGIS.
Called by the ctor or call it manually when your app does not extend the QApplication class.
Definition at line 92 of file qgsapplication.cpp.
|
static |
loads providers
Definition at line 614 of file qgsapplication.cpp.
|
inlinestatic |
Indicates whether running from build directory (not installed)
Definition at line 238 of file qgsapplication.h.
|
static |
Returns the path with utility executables (help viewer, crssync, ...)
Definition at line 604 of file qgsapplication.cpp.
|
static |
Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries.
Definition at line 599 of file qgsapplication.cpp.
|
static |
Returns the path to the licence file.
Definition at line 472 of file qgsapplication.cpp.
|
inlinestatic |
Get maximum concurrent thread count.
Definition at line 272 of file qgsapplication.h.
|
overridevirtual |
Catch exceptions when sending event to receiver.
Definition at line 238 of file qgsapplication.cpp.
|
static |
Returns the common root path of all application data directories.
Definition at line 346 of file qgsapplication.cpp.
|
static |
Returns the path to the application plugin directory.
Definition at line 342 of file qgsapplication.cpp.
|
static |
Returns the path to the application prefix directory.
Definition at line 330 of file qgsapplication.cpp.
|
signal |
|
static |
Returns the path to the master qgis.db file.
Definition at line 508 of file qgsapplication.cpp.
|
static |
Returns the path to the settings directory in user's home dir.
Returns the path to the settings directory in user's home dir
Definition at line 516 of file qgsapplication.cpp.
|
static |
Returns the path to the user qgis.db file.
Definition at line 524 of file qgsapplication.cpp.
|
static |
Register OGR drivers ensuring this only happens once.
This is a workaround for an issue with older gdal versions that caused duplicate driver name entries to appear in the list of registered drivers when QgsApplication::registerOgrDrivers was called multiple times.
Definition at line 768 of file qgsapplication.cpp.
|
static |
Converts path relative to target to an absolute path.
Definition at line 839 of file qgsapplication.cpp.
|
static |
get a standard css style sheet for reports.
Typically you will use this method by doing: QString myStyle = QgsApplication::reportStyleSheet(); textBrowserReport->document()->setDefaultStyleSheet(myStyle);
Definition at line 659 of file qgsapplication.cpp.
|
static |
Sets the GDAL_SKIP environment variable to exclude the specified driver and then calls GDALDriverManager::AutoSkipDrivers() to unregister it.
The driver name should be the short format of the Gdal driver name e.g. GTIFF.
Definition at line 896 of file qgsapplication.cpp.
|
static |
Alters default svg paths - used by 3rd party apps.
Definition at line 325 of file qgsapplication.cpp.
|
static |
Set the FileOpen event receiver.
Definition at line 276 of file qgsapplication.cpp.
|
static |
Set maximum concurrent thread count.
Definition at line 1051 of file qgsapplication.cpp.
|
static |
Alters pkg data path - used by 3rd party apps.
Definition at line 316 of file qgsapplication.cpp.
|
static |
Alters plugin path - used by 3rd party apps.
Definition at line 311 of file qgsapplication.cpp.
|
static |
Alters prefix path - used by 3rd party apps.
Definition at line 293 of file qgsapplication.cpp.
|
static |
Set the active theme to the specified theme.
The theme name should be a single word e.g. 'default','classic'. The theme search path usually will be pkgDataPath + "/themes/" + themName + "/" but plugin writers etc can use themeName() as a basis for searching for resources in their own datastores e.g. a Qt4 resource bundle.
Set the theme path to the specified theme.
Definition at line 411 of file qgsapplication.cpp.
|
static |
Convenience function to get a summary of the paths used in this application instance useful for debugging mainly.
Definition at line 634 of file qgsapplication.cpp.
|
static |
Sets the GDAL_SKIP environment variable to include the specified driver and then calls GDALDriverManager::AutoSkipDrivers() to unregister it.
The driver name should be the short format of the Gdal driver name e.g. GTIFF.
Definition at line 886 of file qgsapplication.cpp.
|
inlinestatic |
Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable)
Definition at line 262 of file qgsapplication.h.
|
static |
Returns the path to the splash screen image directory.
Definition at line 532 of file qgsapplication.cpp.
|
static |
Returns the path to the sponsors file.
Definition at line 452 of file qgsapplication.cpp.
|
static |
Returns the path to the srs.db file.
Definition at line 547 of file qgsapplication.cpp.
|
static |
Returns the pathes to svg directories.
Returns the paths to the svg directories.
Definition at line 573 of file qgsapplication.cpp.
|
inlinestatic |
Returns the system environment variables passed to application.
Definition at line 137 of file qgsapplication.h.
|
static |
Set the active theme to the specified theme.
The theme name should be a single word e.g. 'default','classic'. The theme search path usually will be pkgDataPath + "/themes/" + themName + "/" but plugin writers etc can use this method as a basis for searching for resources in their own datastores e.g. a Qt4 resource bundle.
Get the active theme name
Definition at line 427 of file qgsapplication.cpp.
|
static |
Returns the path to the sponsors file.
Definition at line 466 of file qgsapplication.cpp.
|
static |
Returns the path to user's style.
Definition at line 589 of file qgsapplication.cpp.
|
static |
Definition at line 40 of file qgsapplication.h.
|
static |
Definition at line 39 of file qgsapplication.h.
|
static |
Definition at line 38 of file qgsapplication.h.