QGIS API Documentation  3.0.2-Girona (307d082)
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
QgsApplication Class Reference

Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc. More...

#include <qgsapplication.h>

Inheritance diagram for QgsApplication:
Inheritance graph
[legend]

Public Types

enum  Cursor {
  ZoomIn, ZoomOut, Identify, CrossHair,
  CapturePoint, Select, Sampler
}
 The Cursor enum defines constants for QGIS custom cursors. More...
 
enum  endian_t { XDR = 0, NDR = 1 }
 Constants for endian-ness. More...
 

Signals

void customVariablesChanged ()
 Emitted whenever a custom global variable changes. More...
 
void nullRepresentationChanged ()
 This string is used to represent the value NULL throughout QGIS. More...
 
void preNotify (QObject *receiver, QEvent *event, bool *done)
 

Public Member Functions

 QgsApplication (int &argc, char **argv, bool GUIenabled, const QString &profileFolder=QString(), const QString &platformName="desktop")
 
 ~QgsApplication () override
 
bool event (QEvent *event) override
 Watch for QFileOpenEvent. More...
 
bool notify (QObject *receiver, QEvent *event) override
 Catch exceptions when sending event to receiver. More...
 

Static Public Member Functions

static QString absolutePathToRelativePath (const QString &apath, const QString &targetPath)
 Converts absolute path to path relative to target. More...
 
static QgsActionScopeRegistryactionScopeRegistry ()
 Returns the action scope registry. More...
 
static QString activeThemePath ()
 Returns the path to the currently active theme directory. More...
 
static QgsAnnotationRegistry * annotationRegistry ()
 Returns the application's annotation registry, used for managing annotation types. More...
 
static QString appIconPath ()
 get application icon More...
 
static void applyGdalSkippedDrivers ()
 Apply the skipped drivers list to gdal. More...
 
static QgsAuthManagerauthManager ()
 Returns the application's authentication manager instance. More...
 
static QString authorsFilePath ()
 Returns the path to the authors file. More...
 
static QString buildOutputPath ()
 Returns path to the build output directory. Valid only when running from build directory. More...
 
static QString buildSourcePath ()
 Returns path to the source directory. Valid only when running from build directory. More...
 
static QgsColorSchemeRegistrycolorSchemeRegistry ()
 Returns the application's color scheme registry, used for managing color schemes. More...
 
static QString contributorsFilePath ()
 Returns the path to the contributors file. More...
 
static bool createDatabase (QString *errorMessage=nullptr)
 initialize qgis.db More...
 
static bool createThemeFolder ()
 Create the users theme folder. More...
 
static QVariantMap customVariables ()
 Custom expression variables for this application. More...
 
static QgsDataItemProviderRegistrydataItemProviderRegistry ()
 Returns the application's data item provider registry, which keeps a list of data item providers that may add items to the browser tree. More...
 
static QString defaultStylePath ()
 Returns the path to default style (works as a starting point). More...
 
static QString defaultThemePath ()
 Returns the path to the default theme directory. More...
 
static QString defaultThemesFolder ()
 Returns the path to default themes folder from install (works as a starting point). More...
 
static QString developersMapFilePath ()
 Returns the path to the developers map file. More...
 
static QString donorsFilePath ()
 Returns the path to the donors file. More...
 
static endian_t endian ()
 Returns whether this machine uses big or little endian. More...
 
template<typename T >
static void endian_swap (T &value)
 Swap the endianness of the specified value. More...
 
static void exitQgis ()
 deletes provider registry and map layer registry More...
 
static QgsFieldFormatterRegistryfieldFormatterRegistry ()
 Get the registry of available field formatters. More...
 
static QCursor getThemeCursor (Cursor cursor)
 Helper to get a theme cursor. More...
 
static QIcon getThemeIcon (const QString &name)
 Helper to get a theme icon. More...
 
static QPixmap getThemePixmap (const QString &name)
 Helper to get a theme icon as a pixmap. More...
 
static QgsGpsConnectionRegistrygpsConnectionRegistry ()
 Returns the application's GPS connection registry, used for managing GPS connections. More...
 
static QString i18nPath ()
 Returns the path to the translation directory. More...
 
static QString iconPath (const QString &iconFile)
 Returns path to the desired icon file. More...
 
static QString iconsPath ()
 Returns the path to the icons image directory. More...
 
static void init (QString profileFolder=QString())
 This method initializes paths etc for QGIS. More...
 
static void initQgis ()
 loads providers More...
 
static QgsApplicationinstance ()
 Returns the singleton instance of the QgsApplication. More...
 
static bool isRunningFromBuildDir ()
 Indicates whether running from build directory (not installed) More...
 
static QgsLayoutItemRegistrylayoutItemRegistry ()
 Returns the application's layout item registry, used for layout item types. More...
 
static QStringList layoutTemplatePaths ()
 Returns the paths to layout template directories. More...
 
static QString libexecPath ()
 Returns the path with utility executables (help viewer, crssync, ...) More...
 
static QString libraryPath ()
 Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries. More...
 
static QString licenceFilePath ()
 Returns the path to the licence file. More...
 
static QString locale ()
 Returns the QGIS locale. More...
 
static int maxThreads ()
 Get maximum concurrent thread count. More...
 
static QgsMessageLogmessageLog ()
 Returns the application's message log. More...
 
static QString metadataPath ()
 Returns the path to the metadata directory. More...
 
static QString nullRepresentation ()
 This string is used to represent the value NULL throughout QGIS. More...
 
static QString osName ()
 Returns a string name of the operating system QGIS is running on. More...
 
static QgsPageSizeRegistrypageSizeRegistry ()
 Returns the application's page size registry, used for managing layout page sizes. More...
 
static QgsPaintEffectRegistrypaintEffectRegistry ()
 Returns the application's paint effect registry, used for managing paint effects. More...
 
static QString pkgDataPath ()
 Returns the common root path of all application data directories. More...
 
static QString platform ()
 Returns the QGIS platform name, e.g., "desktop" or "server". More...
 
static QgsPluginLayerRegistrypluginLayerRegistry ()
 Returns the application's plugin layer registry, used for managing plugin layer types. More...
 
static QString pluginPath ()
 Returns the path to the application plugin directory. More...
 
static QString prefixPath ()
 Returns the path to the application prefix directory. More...
 
static QgsProcessingRegistryprocessingRegistry ()
 Returns the application's processing registry, used for managing processing providers, algorithms, and various parameters and outputs. More...
 
static QgsRuntimeProfilerprofiler ()
 Returns the application runtime profiler. More...
 
static QString qgisAuthDatabaseFilePath ()
 Returns the path to the user authentication database file: qgis-auth.db. More...
 
static QString qgisMasterDatabaseFilePath ()
 Returns the path to the master qgis.db file. More...
 
static QString qgisSettingsDirPath ()
 Returns the path to the settings directory in user's home dir. More...
 
static QString qgisUserDatabaseFilePath ()
 Returns the path to the user qgis.db file. More...
 
static QgsRasterRendererRegistryrasterRendererRegistry ()
 Returns the application's raster renderer registry, used for managing raster layer renderers. More...
 
static void registerOgrDrivers ()
 Register OGR drivers ensuring this only happens once. More...
 
static QString relativePathToAbsolutePath (const QString &rpath, const QString &targetPath)
 Converts path relative to target to an absolute path. More...
 
static Qgs3DRendererRegistryrenderer3DRegistry ()
 Returns registry of available 3D renderers. More...
 
static QgsRendererRegistryrendererRegistry ()
 Returns the application's renderer registry, used for managing vector layer renderers. More...
 
static QString reportStyleSheet ()
 get a standard css style sheet for reports. More...
 
static QString resolvePkgPath ()
 Calculate the application pkg path. More...
 
static void restoreGdalDriver (const QString &driver)
 Sets the GDAL_SKIP environment variable to exclude the specified driver and then calls GDALDriverManager::AutoSkipDrivers() to unregister it. More...
 
static QString serverResourcesPath ()
 Returns the path to the server resources directory. More...
 
static void setAuthDatabaseDirPath (const QString &authDbDirPath)
 Alters authentication data base directory path - used by 3rd party apps. More...
 
static void setCustomVariable (const QString &name, const QVariant &value)
 Set a single custom expression variable. More...
 
static void setCustomVariables (const QVariantMap &customVariables)
 Custom expression variables for this application. More...
 
static void setDefaultSvgPaths (const QStringList &pathList)
 Alters default svg paths - used by 3rd party apps. More...
 
static void setFileOpenEventReceiver (QObject *receiver)
 Set the FileOpen event receiver. More...
 
static void setMaxThreads (int maxThreads)
 Set maximum concurrent thread count. More...
 
static void setNullRepresentation (const QString &nullRepresentation)
 This string is used to represent the value NULL throughout QGIS. More...
 
static void setPkgDataPath (const QString &pkgDataPath)
 Alters pkg data path - used by 3rd party apps. More...
 
static void setPluginPath (const QString &pluginPath)
 Alters plugin path - used by 3rd party apps. More...
 
static void setPrefixPath (const QString &prefixPath, bool useDefaultPaths=false)
 Alters prefix path - used by 3rd party apps. More...
 
static void setThemeName (const QString &themeName)
 Set the active theme to the specified theme. More...
 
static void setUITheme (const QString &themeName)
 Set the current UI theme used to style the interface. More...
 
static QRegExp shortNameRegExp ()
 Returns the short name regular expression for line edit validator. More...
 
static QString showSettings ()
 Convenience function to get a summary of the paths used in this application instance useful for debugging mainly. More...
 
static void skipGdalDriver (const QString &driver)
 Sets the GDAL_SKIP environment variable to include the specified driver and then calls GDALDriverManager::AutoSkipDrivers() to unregister it. More...
 
static QStringList skippedGdalDrivers ()
 Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable) More...
 
static QString splashPath ()
 Returns the path to the splash screen image directory. More...
 
static QString sponsorsFilePath ()
 Returns the path to the sponsors file. More...
 
static QString srsDatabaseFilePath ()
 Returns the path to the srs.db file. More...
 
static QgsSvgCachesvgCache ()
 Returns the application's SVG cache, used for caching SVG images and handling parameter replacement within SVG files. More...
 
static QStringList svgPaths ()
 Returns the paths to svg directories. More...
 
static QgsSymbolLayerRegistrysymbolLayerRegistry ()
 Returns the application's symbol layer registry, used for managing symbol layers. More...
 
static QMap< QString, QString > systemEnvVars ()
 Returns the system environment variables passed to application. More...
 
static QgsTaskManagertaskManager ()
 Returns the application's task manager, used for managing application wide background task handling. More...
 
static QString themeName ()
 Set the active theme to the specified theme. More...
 
static QString translatorsFilePath ()
 Returns the path to the sponsors file. More...
 
static QHash< QString, QString > uiThemes ()
 All themes found in ~/.qgis3/themes folder. More...
 
static QString userFullName ()
 Returns the user's operating system login account full display name. More...
 
static QString userLoginName ()
 Returns the user's operating system login account name. More...
 
static QString userStylePath ()
 Returns the path to user's style. More...
 
static QString userThemesFolder ()
 Returns the path to user's themes folder. More...
 

Static Public Attributes

static const char * QGIS_APPLICATION_NAME = "QGIS3"
 
static const char * QGIS_ORGANIZATION_DOMAIN = "qgis.org"
 
static const char * QGIS_ORGANIZATION_NAME = "QGIS"
 

Detailed Description

Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.

This is a subclass of QApplication and should be instantiated in place of QApplication. Most methods are static in keeping with 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 64 of file qgsapplication.h.

Member Enumeration Documentation

◆ Cursor

The Cursor enum defines constants for QGIS custom cursors.

Enumerator
ZoomIn 

Zoom in.

ZoomOut 

Zoom out.

Identify 

Identify: obtain information about the object.

CrossHair 

Precisely identify a point on the canvas.

CapturePoint 

Select and capture a point or a feature.

Select 

Select a rectangle.

Sampler 

Color/Value picker.

Definition at line 327 of file qgsapplication.h.

◆ endian_t

Constants for endian-ness.

Enumerator
XDR 
NDR 

Definition at line 438 of file qgsapplication.h.

Constructor & Destructor Documentation

◆ QgsApplication()

QgsApplication::QgsApplication ( int &  argc,
char **  argv,
bool  GUIenabled,
const QString &  profileFolder = QString(),
const QString &  platformName = "desktop" 
)

Definition at line 121 of file qgsapplication.cpp.

◆ ~QgsApplication()

QgsApplication::~QgsApplication ( )
override

Definition at line 272 of file qgsapplication.cpp.

Member Function Documentation

◆ absolutePathToRelativePath()

QString QgsApplication::absolutePathToRelativePath ( const QString &  apath,
const QString &  targetPath 
)
static

Converts absolute path to path relative to target.

Definition at line 1203 of file qgsapplication.cpp.

◆ actionScopeRegistry()

QgsActionScopeRegistry * QgsApplication::actionScopeRegistry ( )
static

Returns the action scope registry.

Since
QGIS 3.0

Definition at line 1452 of file qgsapplication.cpp.

◆ activeThemePath()

QString QgsApplication::activeThemePath ( )
static

Returns the path to the currently active theme directory.

Definition at line 441 of file qgsapplication.cpp.

◆ annotationRegistry()

QgsAnnotationRegistry * QgsApplication::annotationRegistry ( )
static

Returns the application's annotation registry, used for managing annotation types.

Since
QGIS 3.0
Note
not available in Python bindings

Definition at line 1690 of file qgsapplication.cpp.

◆ appIconPath()

QString QgsApplication::appIconPath ( )
static

get application icon

Definition at line 456 of file qgsapplication.cpp.

◆ applyGdalSkippedDrivers()

void QgsApplication::applyGdalSkippedDrivers ( )
static

Apply the skipped drivers list to gdal.

See also
skipGdalDriver
restoreGdalDriver
skippedGdalDrivers

Definition at line 1342 of file qgsapplication.cpp.

◆ authManager()

QgsAuthManager * QgsApplication::authManager ( )
static

Returns the application's authentication manager instance.

Note
this can be a null pointer if called before initQgis
See also
initQgis
Since
QGIS 3.0

Definition at line 1025 of file qgsapplication.cpp.

◆ authorsFilePath()

QString QgsApplication::authorsFilePath ( )
static

Returns the path to the authors file.

Definition at line 709 of file qgsapplication.cpp.

◆ buildOutputPath()

static QString QgsApplication::buildOutputPath ( )
inlinestatic

Returns path to the build output directory. Valid only when running from build directory.

Definition at line 502 of file qgsapplication.h.

◆ buildSourcePath()

static QString QgsApplication::buildSourcePath ( )
inlinestatic

Returns path to the source directory. Valid only when running from build directory.

Definition at line 500 of file qgsapplication.h.

◆ colorSchemeRegistry()

QgsColorSchemeRegistry * QgsApplication::colorSchemeRegistry ( )
static

Returns the application's color scheme registry, used for managing color schemes.

Since
QGIS 3.0

Definition at line 1610 of file qgsapplication.cpp.

◆ contributorsFilePath()

QString QgsApplication::contributorsFilePath ( )
static

Returns the path to the contributors file.

Contributors are people who have submitted patches but don't have commit access.

Definition at line 714 of file qgsapplication.cpp.

◆ createDatabase()

bool QgsApplication::createDatabase ( QString *  errorMessage = nullptr)
static

initialize qgis.db

Definition at line 1457 of file qgsapplication.cpp.

◆ createThemeFolder()

bool QgsApplication::createThemeFolder ( )
static

Create the users theme folder.

Definition at line 1352 of file qgsapplication.cpp.

◆ customVariables()

QVariantMap QgsApplication::customVariables ( )
static

Custom expression variables for this application.

This does not include generated variables (like system name, user name etc.)

See also
QgsExpressionContextUtils::globalVariables().
Since
QGIS 3.0

Definition at line 1383 of file qgsapplication.cpp.

◆ customVariablesChanged

void QgsApplication::customVariablesChanged ( )
signal

Emitted whenever a custom global variable changes.

Since
QGIS 3.0

◆ dataItemProviderRegistry()

QgsDataItemProviderRegistry * QgsApplication::dataItemProviderRegistry ( )
static

Returns the application's data item provider registry, which keeps a list of data item providers that may add items to the browser tree.

Since
QGIS 3.0

Definition at line 1630 of file qgsapplication.cpp.

◆ defaultStylePath()

QString QgsApplication::defaultStylePath ( )
static

Returns the path to default style (works as a starting point).

Definition at line 967 of file qgsapplication.cpp.

◆ defaultThemePath()

QString QgsApplication::defaultThemePath ( )
static

Returns the path to the default theme directory.

Definition at line 437 of file qgsapplication.cpp.

◆ defaultThemesFolder()

QString QgsApplication::defaultThemesFolder ( )
static

Returns the path to default themes folder from install (works as a starting point).

Definition at line 972 of file qgsapplication.cpp.

◆ developersMapFilePath()

QString QgsApplication::developersMapFilePath ( )
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.

Since
QGIS 2.7

Definition at line 718 of file qgsapplication.cpp.

◆ donorsFilePath()

QString QgsApplication::donorsFilePath ( )
static

Returns the path to the donors file.

Definition at line 728 of file qgsapplication.cpp.

◆ endian()

QgsApplication::endian_t QgsApplication::endian ( )
static

Returns whether this machine uses big or little endian.

Definition at line 992 of file qgsapplication.cpp.

◆ endian_swap()

template<typename T >
static void QgsApplication::endian_swap ( T &  value)
inlinestatic

Swap the endianness of the specified value.

Note
not available in Python bindings

Definition at line 453 of file qgsapplication.h.

◆ event()

bool QgsApplication::event ( QEvent *  event)
override

Watch for QFileOpenEvent.

Definition at line 283 of file qgsapplication.cpp.

◆ exitQgis()

void QgsApplication::exitQgis ( )
static

deletes provider registry and map layer registry

Definition at line 1046 of file qgsapplication.cpp.

◆ fieldFormatterRegistry()

QgsFieldFormatterRegistry * QgsApplication::fieldFormatterRegistry ( )
static

Get the registry of available field formatters.

Definition at line 1695 of file qgsapplication.cpp.

◆ getThemeCursor()

QCursor QgsApplication::getThemeCursor ( Cursor  cursor)
static

Helper to get a theme cursor.

It will fall back to the default theme if the active theme does not have the required icon. Cursors are automatically scaled to look like a 16px cursor on 96dpi screens.

Definition at line 502 of file qgsapplication.cpp.

◆ getThemeIcon()

QIcon QgsApplication::getThemeIcon ( const QString &  name)
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 472 of file qgsapplication.cpp.

◆ getThemePixmap()

QPixmap QgsApplication::getThemePixmap ( const QString &  name)
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 574 of file qgsapplication.cpp.

◆ gpsConnectionRegistry()

QgsGpsConnectionRegistry * QgsApplication::gpsConnectionRegistry ( )
static

Returns the application's GPS connection registry, used for managing GPS connections.

Since
QGIS 3.0

Definition at line 1665 of file qgsapplication.cpp.

◆ i18nPath()

QString QgsApplication::i18nPath ( )
static

Returns the path to the translation directory.

Definition at line 743 of file qgsapplication.cpp.

◆ iconPath()

QString QgsApplication::iconPath ( const QString &  iconFile)
static

Returns path to the desired icon file.

First it tries to use the active theme path, then default theme path

Definition at line 461 of file qgsapplication.cpp.

◆ iconsPath()

QString QgsApplication::iconsPath ( )
static

Returns the path to the icons image directory.

Definition at line 781 of file qgsapplication.cpp.

◆ init()

void QgsApplication::init ( QString  profileFolder = QString())
static

This method initializes paths etc for QGIS.

Called by the ctor or call it manually when your app does not extend the QApplication class.

Note
you will probably want to call initQgis too to load the providers in the above case.
not available in Python bindings

Definition at line 131 of file qgsapplication.cpp.

◆ initQgis()

void QgsApplication::initQgis ( )
static

loads providers

Definition at line 997 of file qgsapplication.cpp.

◆ instance()

QgsApplication * QgsApplication::instance ( )
static

Returns the singleton instance of the QgsApplication.

Since
QGIS 3.0

Definition at line 278 of file qgsapplication.cpp.

◆ isRunningFromBuildDir()

static bool QgsApplication::isRunningFromBuildDir ( )
inlinestatic

Indicates whether running from build directory (not installed)

Definition at line 495 of file qgsapplication.h.

◆ layoutItemRegistry()

QgsLayoutItemRegistry * QgsApplication::layoutItemRegistry ( )
static

Returns the application's layout item registry, used for layout item types.

Since
QGIS 3.0

Definition at line 1660 of file qgsapplication.cpp.

◆ layoutTemplatePaths()

QStringList QgsApplication::layoutTemplatePaths ( )
static

Returns the paths to layout template directories.

Since
QGIS 3.0

Definition at line 832 of file qgsapplication.cpp.

◆ libexecPath()

QString QgsApplication::libexecPath ( )
static

Returns the path with utility executables (help viewer, crssync, ...)

Definition at line 987 of file qgsapplication.cpp.

◆ libraryPath()

QString QgsApplication::libraryPath ( )
static

Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries.

Definition at line 982 of file qgsapplication.cpp.

◆ licenceFilePath()

QString QgsApplication::licenceFilePath ( )
static

Returns the path to the licence file.

Definition at line 738 of file qgsapplication.cpp.

◆ locale()

QString QgsApplication::locale ( )
static

Returns the QGIS locale.

Since
QGIS 3.0

Definition at line 941 of file qgsapplication.cpp.

◆ maxThreads()

static int QgsApplication::maxThreads ( )
inlinestatic

Get maximum concurrent thread count.

Since
QGIS 2.4

Definition at line 534 of file qgsapplication.h.

◆ messageLog()

QgsMessageLog * QgsApplication::messageLog ( )
static

Returns the application's message log.

Since
QGIS 3.0

Definition at line 1675 of file qgsapplication.cpp.

◆ metadataPath()

QString QgsApplication::metadataPath ( )
static

Returns the path to the metadata directory.

Since
QGIS 3.0

Definition at line 751 of file qgsapplication.cpp.

◆ notify()

bool QgsApplication::notify ( QObject *  receiver,
QEvent *  event 
)
override

Catch exceptions when sending event to receiver.

Definition at line 311 of file qgsapplication.cpp.

◆ nullRepresentation()

QString QgsApplication::nullRepresentation ( )
static

This string is used to represent the value NULL throughout QGIS.

In general, when passing values around, prefer to use a null QVariant QVariant( field.type() ) or QVariant( QVariant::Int ). This value should only be used in the final presentation step when showing values in a widget or sending it to a web browser.

Definition at line 1428 of file qgsapplication.cpp.

◆ nullRepresentationChanged

void QgsApplication::nullRepresentationChanged ( )
signal

This string is used to represent the value NULL throughout QGIS.

In general, when passing values around, prefer to use a null QVariant QVariant( field.type() ) or QVariant( QVariant::Int ). This value should only be used in the final presentation step when showing values in a widget or sending it to a web browser.

◆ osName()

QString QgsApplication::osName ( )
static

Returns a string name of the operating system QGIS is running on.

Since
QGIS 2.14
See also
platform()

Definition at line 921 of file qgsapplication.cpp.

◆ pageSizeRegistry()

QgsPageSizeRegistry * QgsApplication::pageSizeRegistry ( )
static

Returns the application's page size registry, used for managing layout page sizes.

Since
QGIS 3.0

Definition at line 1685 of file qgsapplication.cpp.

◆ paintEffectRegistry()

QgsPaintEffectRegistry * QgsApplication::paintEffectRegistry ( )
static

Returns the application's paint effect registry, used for managing paint effects.

Since
QGIS 3.0

Definition at line 1615 of file qgsapplication.cpp.

◆ pkgDataPath()

QString QgsApplication::pkgDataPath ( )
static

Returns the common root path of all application data directories.

Definition at line 433 of file qgsapplication.cpp.

◆ platform()

QString QgsApplication::platform ( )
static

Returns the QGIS platform name, e.g., "desktop" or "server".

Since
QGIS 2.14
See also
osName()

Definition at line 936 of file qgsapplication.cpp.

◆ pluginLayerRegistry()

QgsPluginLayerRegistry * QgsApplication::pluginLayerRegistry ( )
static

Returns the application's plugin layer registry, used for managing plugin layer types.

Since
QGIS 3.0

Definition at line 1670 of file qgsapplication.cpp.

◆ pluginPath()

QString QgsApplication::pluginPath ( )
static

Returns the path to the application plugin directory.

Definition at line 429 of file qgsapplication.cpp.

◆ prefixPath()

QString QgsApplication::prefixPath ( )
static

Returns the path to the application prefix directory.

Definition at line 417 of file qgsapplication.cpp.

◆ preNotify

void QgsApplication::preNotify ( QObject *  receiver,
QEvent *  event,
bool *  done 
)
signal
Note
not available in Python bindings

◆ processingRegistry()

QgsProcessingRegistry * QgsApplication::processingRegistry ( )
static

Returns the application's processing registry, used for managing processing providers, algorithms, and various parameters and outputs.

Since
QGIS 3.0

Definition at line 1680 of file qgsapplication.cpp.

◆ profiler()

QgsRuntimeProfiler * QgsApplication::profiler ( )
static

Returns the application runtime profiler.

Since
QGIS 3.0

Definition at line 349 of file qgsapplication.cpp.

◆ qgisAuthDatabaseFilePath()

QString QgsApplication::qgisAuthDatabaseFilePath ( )
static

Returns the path to the user authentication database file: qgis-auth.db.

Definition at line 771 of file qgsapplication.cpp.

◆ qgisMasterDatabaseFilePath()

QString QgsApplication::qgisMasterDatabaseFilePath ( )
static

Returns the path to the master qgis.db file.

Definition at line 756 of file qgsapplication.cpp.

◆ qgisSettingsDirPath()

QString QgsApplication::qgisSettingsDirPath ( )
static

Returns the path to the settings directory in user's home dir.

Definition at line 761 of file qgsapplication.cpp.

◆ qgisUserDatabaseFilePath()

QString QgsApplication::qgisUserDatabaseFilePath ( )
static

Returns the path to the user qgis.db file.

Definition at line 766 of file qgsapplication.cpp.

◆ rasterRendererRegistry()

QgsRasterRendererRegistry * QgsApplication::rasterRendererRegistry ( )
static

Returns the application's raster renderer registry, used for managing raster layer renderers.

Since
QGIS 3.0
Note
not available in Python bindings

Definition at line 1625 of file qgsapplication.cpp.

◆ registerOgrDrivers()

void QgsApplication::registerOgrDrivers ( )
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 1195 of file qgsapplication.cpp.

◆ relativePathToAbsolutePath()

QString QgsApplication::relativePathToAbsolutePath ( const QString &  rpath,
const QString &  targetPath 
)
static

Converts path relative to target to an absolute path.

Definition at line 1268 of file qgsapplication.cpp.

◆ renderer3DRegistry()

Qgs3DRendererRegistry * QgsApplication::renderer3DRegistry ( )
static

Returns registry of available 3D renderers.

Note
not available in Python bindings
Since
QGIS 3.0

Definition at line 1700 of file qgsapplication.cpp.

◆ rendererRegistry()

QgsRendererRegistry * QgsApplication::rendererRegistry ( )
static

Returns the application's renderer registry, used for managing vector layer renderers.

Since
QGIS 3.0

Definition at line 1620 of file qgsapplication.cpp.

◆ reportStyleSheet()

QString QgsApplication::reportStyleSheet ( )
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);

Returns
QString containing the CSS 2.1 compliant stylesheet.
Note
you can use the special Qt extensions too, for example the gradient fills for backgrounds.

Definition at line 1094 of file qgsapplication.cpp.

◆ resolvePkgPath()

QString QgsApplication::resolvePkgPath ( )
static

Calculate the application pkg path.

Returns
the resolved pkg path

Definition at line 595 of file qgsapplication.cpp.

◆ restoreGdalDriver()

void QgsApplication::restoreGdalDriver ( const QString &  driver)
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 1328 of file qgsapplication.cpp.

◆ serverResourcesPath()

QString QgsApplication::serverResourcesPath ( )
static

Returns the path to the server resources directory.

Definition at line 977 of file qgsapplication.cpp.

◆ setAuthDatabaseDirPath()

void QgsApplication::setAuthDatabaseDirPath ( const QString &  authDbDirPath)
static

Alters authentication data base directory path - used by 3rd party apps.

Definition at line 408 of file qgsapplication.cpp.

◆ setCustomVariable()

void QgsApplication::setCustomVariable ( const QString &  name,
const QVariant &  value 
)
static

Set a single custom expression variable.

Since
QGIS 3.0

Definition at line 1417 of file qgsapplication.cpp.

◆ setCustomVariables()

void QgsApplication::setCustomVariables ( const QVariantMap &  customVariables)
static

Custom expression variables for this application.

Do not include generated variables (like system name, user name etc.)

See also
QgsExpressionContextUtils::globalVariables().
Since
QGIS 3.0

Definition at line 1402 of file qgsapplication.cpp.

◆ setDefaultSvgPaths()

void QgsApplication::setDefaultSvgPaths ( const QStringList &  pathList)
static

Alters default svg paths - used by 3rd party apps.

Definition at line 403 of file qgsapplication.cpp.

◆ setFileOpenEventReceiver()

void QgsApplication::setFileOpenEventReceiver ( QObject *  receiver)
static

Set the FileOpen event receiver.

Definition at line 354 of file qgsapplication.cpp.

◆ setMaxThreads()

void QgsApplication::setMaxThreads ( int  maxThreads)
static

Set maximum concurrent thread count.

Note
must be between 1 and #cores, -1 means use all available cores
Since
QGIS 2.4

Definition at line 1584 of file qgsapplication.cpp.

◆ setNullRepresentation()

void QgsApplication::setNullRepresentation ( const QString &  nullRepresentation)
static

This string is used to represent the value NULL throughout QGIS.

In general, when passing values around, prefer to use a null QVariant QVariant( field.type() ) or QVariant( QVariant::Int ). This value should only be used in the final presentation step when showing values in a widget or sending it to a web browser.

Definition at line 1438 of file qgsapplication.cpp.

◆ setPkgDataPath()

void QgsApplication::setPkgDataPath ( const QString &  pkgDataPath)
static

Alters pkg data path - used by 3rd party apps.

Definition at line 394 of file qgsapplication.cpp.

◆ setPluginPath()

void QgsApplication::setPluginPath ( const QString &  pluginPath)
static

Alters plugin path - used by 3rd party apps.

Definition at line 389 of file qgsapplication.cpp.

◆ setPrefixPath()

void QgsApplication::setPrefixPath ( const QString &  prefixPath,
bool  useDefaultPaths = false 
)
static

Alters prefix path - used by 3rd party apps.

Definition at line 371 of file qgsapplication.cpp.

◆ setThemeName()

void QgsApplication::setThemeName ( const QString &  themeName)
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.

Note
A basic test will be carried out to ensure the theme search path based on the supplied theme name exists. If it does not the theme name will be reverted to 'default'.

Definition at line 590 of file qgsapplication.cpp.

◆ setUITheme()

void QgsApplication::setUITheme ( const QString &  themeName)
static

Set the current UI theme used to style the interface.

Use uiThemes() to find valid themes to use. Variables found in variables.qss will be added to the stylesheet on load.

Parameters
themeNameThe name of the theme.
Note
using an invalid theme name will reset to default

Definition at line 630 of file qgsapplication.cpp.

◆ shortNameRegExp()

QRegExp QgsApplication::shortNameRegExp ( )
static

Returns the short name regular expression for line edit validator.

Definition at line 847 of file qgsapplication.cpp.

◆ showSettings()

QString QgsApplication::showSettings ( )
static

Convenience function to get a summary of the paths used in this application instance useful for debugging mainly.

Definition at line 1067 of file qgsapplication.cpp.

◆ skipGdalDriver()

void QgsApplication::skipGdalDriver ( const QString &  driver)
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 1318 of file qgsapplication.cpp.

◆ skippedGdalDrivers()

static QStringList QgsApplication::skippedGdalDrivers ( )
inlinestatic

Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable)

Definition at line 522 of file qgsapplication.h.

◆ splashPath()

QString QgsApplication::splashPath ( )
static

Returns the path to the splash screen image directory.

Definition at line 776 of file qgsapplication.cpp.

◆ sponsorsFilePath()

QString QgsApplication::sponsorsFilePath ( )
static

Returns the path to the sponsors file.

Definition at line 723 of file qgsapplication.cpp.

◆ srsDatabaseFilePath()

QString QgsApplication::srsDatabaseFilePath ( )
static

Returns the path to the srs.db file.

Definition at line 786 of file qgsapplication.cpp.

◆ svgCache()

QgsSvgCache * QgsApplication::svgCache ( )
static

Returns the application's SVG cache, used for caching SVG images and handling parameter replacement within SVG files.

Since
QGIS 3.0

Definition at line 1650 of file qgsapplication.cpp.

◆ svgPaths()

QStringList QgsApplication::svgPaths ( )
static

Returns the paths to svg directories.

Definition at line 809 of file qgsapplication.cpp.

◆ symbolLayerRegistry()

QgsSymbolLayerRegistry * QgsApplication::symbolLayerRegistry ( )
static

Returns the application's symbol layer registry, used for managing symbol layers.

Since
QGIS 3.0

Definition at line 1655 of file qgsapplication.cpp.

◆ systemEnvVars()

static QMap<QString, QString> QgsApplication::systemEnvVars ( )
inlinestatic

Returns the system environment variables passed to application.

Definition at line 294 of file qgsapplication.h.

◆ taskManager()

QgsTaskManager * QgsApplication::taskManager ( )
static

Returns the application's task manager, used for managing application wide background task handling.

Since
QGIS 3.0

Definition at line 1605 of file qgsapplication.cpp.

◆ themeName()

QString QgsApplication::themeName ( )
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.

Definition at line 625 of file qgsapplication.cpp.

◆ translatorsFilePath()

QString QgsApplication::translatorsFilePath ( )
static

Returns the path to the sponsors file.

Definition at line 733 of file qgsapplication.cpp.

◆ uiThemes()

QHash< QString, QString > QgsApplication::uiThemes ( )
static

All themes found in ~/.qgis3/themes folder.

The path is to the root folder for the theme

Returns
A hash of theme name and theme path. Valid theme folders contain style.qss
Note
Valid theme folders must contain a style.qss file.

Definition at line 686 of file qgsapplication.cpp.

◆ userFullName()

QString QgsApplication::userFullName ( )
static

Returns the user's operating system login account full display name.

Since
QGIS 2.14
See also
userLoginName()

Definition at line 887 of file qgsapplication.cpp.

◆ userLoginName()

QString QgsApplication::userLoginName ( )
static

Returns the user's operating system login account name.

Since
QGIS 2.14
See also
userFullName()

Definition at line 852 of file qgsapplication.cpp.

◆ userStylePath()

QString QgsApplication::userStylePath ( )
static

Returns the path to user's style.

Definition at line 842 of file qgsapplication.cpp.

◆ userThemesFolder()

QString QgsApplication::userThemesFolder ( )
static

Returns the path to user's themes folder.

Definition at line 962 of file qgsapplication.cpp.

Member Data Documentation

◆ QGIS_APPLICATION_NAME

const char * QgsApplication::QGIS_APPLICATION_NAME = "QGIS3"
static

Definition at line 121 of file qgsapplication.h.

◆ QGIS_ORGANIZATION_DOMAIN

const char * QgsApplication::QGIS_ORGANIZATION_DOMAIN = "qgis.org"
static

Definition at line 120 of file qgsapplication.h.

◆ QGIS_ORGANIZATION_NAME

const char * QgsApplication::QGIS_ORGANIZATION_NAME = "QGIS"
static

Definition at line 119 of file qgsapplication.h.


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