QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | 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...
 
enum  StyleSheetType { Qt , WebBrowser }
 The StyleSheetType enum represents the stylesheet type that a widget supports. More...
 

Signals

void customVariablesChanged ()
 Emitted whenever a custom global variable changes.
 
void localeChanged ()
 Emitted when project locale has been changed.
 
void nullRepresentationChanged ()
 This string is used to represent the value NULL throughout QGIS.
 
void preNotify (QObject *receiver, QEvent *event, bool *done)
 
void requestForTranslatableObjects (QgsTranslationContext *translationContext)
 Emitted when project strings which require translation are being collected for inclusion in a .ts file.
 

Public Member Functions

 QgsApplication (int &argc, char **argv, bool GUIenabled, const QString &profileFolder=QString(), const QString &platformName="external")
 Constructor for QgsApplication.
 
 ~QgsApplication () override
 
void collectTranslatableObjects (QgsTranslationContext *translationContext)
 Emits the signal to collect all the strings of .qgs to be included in ts file.
 
bool event (QEvent *event) override
 Watch for QFileOpenEvent.
 
int maxConcurrentConnectionsPerPool () const
 The maximum number of concurrent connections per connections pool.
 
bool notify (QObject *receiver, QEvent *event) override
 Catch exceptions when sending event to receiver.
 
QString translation () const
 Returns the current application translation locale code.
 

Static Public Member Functions

static QString absolutePathToRelativePath (const QString &apath, const QString &targetPath)
 Converts absolute path to path relative to target.
 
static QgsActionScopeRegistryactionScopeRegistry ()
 Returns the action scope registry.
 
static QString activeThemePath ()
 Returns the path to the currently active theme directory.
 
static QgsAnnotationItemRegistryannotationItemRegistry ()
 Returns the application's annotation item registry, used for annotation item types.
 
static QgsAnnotationRegistry * annotationRegistry ()
 Returns the application's annotation registry, used for managing annotation types.
 
static QString appIconPath ()
 Gets application icon.
 
static QString applicationFullName ()
 Returns the QGIS application full name.
 
static void applyGdalSkippedDrivers ()
 Apply the skipped drivers list to gdal.
 
static QgsAuthManagerauthManager ()
 Returns the application's authentication manager instance.
 
static QString authorsFilePath ()
 Returns the path to the authors file.
 
static QgsBookmarkManagerbookmarkManager ()
 Returns the application's bookmark manager, used for storing installation-wide bookmarks.
 
static QString buildOutputPath ()
 Returns path to the build output directory. Valid only when running from build directory.
 
static QString buildSourcePath ()
 Returns path to the source directory. Valid only when running from build directory.
 
static QgsCalloutRegistrycalloutRegistry ()
 Returns the application's callout registry, used for managing callout types.
 
static QgsClassificationMethodRegistryclassificationMethodRegistry ()
 Returns the application's classification methods registry, used in graduated renderer.
 
static QgsColorSchemeRegistrycolorSchemeRegistry ()
 Returns the application's color scheme registry, used for managing color schemes.
 
static QgsConnectionRegistryconnectionRegistry ()
 Returns the application's connection registry, used for managing saved data provider connections.
 
static QString contributorsFilePath ()
 Returns the path to the contributors file.
 
static QgsCoordinateReferenceSystemRegistrycoordinateReferenceSystemRegistry ()
 Returns the application's coordinate reference system (CRS) registry, which handles known CRS definitions (including user-defined CRSes).
 
static bool createDatabase (QString *errorMessage=nullptr)
 initialize qgis.db
 
static bool createThemeFolder ()
 Create the users theme folder.
 
static QVariantMap customVariables ()
 Custom expression variables for this application.
 
static QgsDatabaseQueryLogdatabaseQueryLog ()
 Returns the database query log.
 
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.
 
static QgsStyleModeldefaultStyleModel ()
 Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).
 
static QString defaultStylePath ()
 Returns the path to default style (works as a starting point).
 
static QString defaultThemePath ()
 Returns the path to the default theme directory.
 
static QString defaultThemesFolder ()
 Returns the path to default themes folder from install (works as a starting point).
 
static QStringList deferredSkippedGdalDrivers ()
 Returns the list of gdal drivers that have been disabled in the current session, and thus, for safety, should not be disabled right now, but at the next application restart.
 
static QString developersMapFilePath ()
 Returns the path to the developers map file.
 
static 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 QgsExternalStorageRegistryexternalStorageRegistry ()
 Returns registry of available external storage implementations.
 
static QgsFieldFormatterRegistryfieldFormatterRegistry ()
 Gets the registry of available field formatters.
 
static QgsFontManagerfontManager ()
 Returns the application font manager, which manages available fonts and font installation for the QGIS instance.
 
static QCursor getThemeCursor (Cursor cursor)
 Helper to get a theme cursor.
 
static QIcon getThemeIcon (const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
 Helper to get a theme icon.
 
static QPixmap getThemePixmap (const QString &name, const QColor &foreColor=QColor(), const QColor &backColor=QColor(), int size=16)
 Helper to get a theme icon as a pixmap.
 
static QgsBabelFormatRegistrygpsBabelFormatRegistry ()
 Returns the application's GPSBabel format registry, used for managing GPSBabel formats.
 
static QgsGpsConnectionRegistrygpsConnectionRegistry ()
 Returns the application's GPS connection registry, used for managing GPS connections.
 
static QString i18nPath ()
 Returns the path to the translation directory.
 
static QString iconPath (const QString &iconFile)
 Returns path to the desired icon file.
 
static QString iconsPath ()
 Returns the path to the icons image directory.
 
static QgsImageCacheimageCache ()
 Returns the application's image cache, used for caching resampled versions of raster images.
 
static void init (QString profileFolder=QString())
 This method initializes paths etc for QGIS.
 
static void initQgis ()
 loads providers
 
static QgsApplicationinstance ()
 Returns the singleton instance of the QgsApplication.
 
static bool isRunningFromBuildDir ()
 Indicates whether running from build directory (not installed)
 
static QgsLayerMetadataProviderRegistrylayerMetadataProviderRegistry ()
 Returns registry of available layer metadata provider implementations.
 
static QgsLayoutItemRegistrylayoutItemRegistry ()
 Returns the application's layout item registry, used for layout item types.
 
static QStringList layoutTemplatePaths ()
 Returns the paths to layout template directories.
 
static QString libexecPath ()
 Returns the path with utility executables (help viewer, crssync, ...)
 
static QString libraryPath ()
 Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries.
 
static QString licenceFilePath ()
 Returns the path to the licence file.
 
static QString locale ()
 Returns the QGIS locale.
 
static QgsLocalizedDataPathRegistrylocalizedDataPathRegistry ()
 Returns the registry of data repositories These are used as paths for basemaps, logos, etc.
 
static int maxThreads ()
 Gets maximum concurrent thread count.
 
static QgsMessageLogmessageLog ()
 Returns the application's message log.
 
static QString metadataPath ()
 Returns the path to the metadata directory.
 
static QgsNetworkContentFetcherRegistrynetworkContentFetcherRegistry ()
 Returns the application's network content registry used for fetching temporary files during QGIS session.
 
static QString nullRepresentation ()
 This string is used to represent the value NULL throughout QGIS.
 
static QgsNumericFormatRegistrynumericFormatRegistry ()
 Gets the registry of available numeric formats.
 
static QString osName ()
 Returns a string name of the operating system QGIS is running on.
 
static QgsPageSizeRegistrypageSizeRegistry ()
 Returns the application's page size registry, used for managing layout page sizes.
 
static QgsPaintEffectRegistrypaintEffectRegistry ()
 Returns the application's paint effect registry, used for managing paint effects.
 
static QString pkgDataPath ()
 Returns the common root path of all application data directories.
 
static QString platform ()
 Returns the QGIS platform name, e.g., "desktop", "server", "qgis_process" or "external" (for external CLI scripts).
 
static QgsPluginLayerRegistrypluginLayerRegistry ()
 Returns the application's plugin layer registry, used for managing plugin layer types.
 
static QString pluginPath ()
 Returns the path to the application plugin directory.
 
static QgsPointCloudRendererRegistrypointCloudRendererRegistry ()
 Returns the application's point cloud renderer registry, used for managing point cloud layer 2D renderers.
 
static QString prefixPath ()
 Returns the path to the application prefix directory.
 
static QgsProcessingRegistryprocessingRegistry ()
 Returns the application's processing registry, used for managing processing providers, algorithms, and various parameters and outputs.
 
static QgsRuntimeProfilerprofiler ()
 Returns the application runtime profiler.
 
static QgsProfileSourceRegistryprofileSourceRegistry ()
 Returns registry of available profile source implementations.
 
static QgsProjectStorageRegistryprojectStorageRegistry ()
 Returns registry of available project storage implementations.
 
static QString qgisAuthDatabaseFilePath ()
 Returns the path to the user authentication database file: qgis-auth.db.
 
static QString qgisMasterDatabaseFilePath ()
 Returns the path to the master qgis.db file.
 
static QString qgisSettingsDirPath ()
 Returns the path to the settings directory in user's home dir.
 
static QString qgisUserDatabaseFilePath ()
 Returns the path to the user qgis.db file.
 
static QString qmlImportPath ()
 Returns the path where QML components are installed for QGIS Quick library.
 
static QgsRasterRendererRegistryrasterRendererRegistry ()
 Returns the application's raster renderer registry, used for managing raster layer renderers.
 
static QgsRecentStyleHandlerrecentStyleHandler ()
 Returns the handler for recently used style items.
 
static void registerGdalDriversFromSettings ()
 Register gdal drivers, excluding the ones mentioned in "gdal/skipList" setting.
 
static void registerOgrDrivers ()
 Register OGR drivers ensuring this only happens once.
 
static QString relativePathToAbsolutePath (const QString &rpath, const QString &targetPath)
 Converts path relative to target to an absolute path.
 
static Qgs3DRendererRegistryrenderer3DRegistry ()
 Returns registry of available 3D renderers.
 
static QgsRendererRegistryrendererRegistry ()
 Returns the application's renderer registry, used for managing vector layer renderers.
 
static QString reportStyleSheet (QgsApplication::StyleSheetType styleSheetType=QgsApplication::StyleSheetType::Qt)
 Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet is supported by the widget.
 
static QString resolvePkgPath ()
 Calculate the application pkg path.
 
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.
 
static QgsScaleBarRendererRegistryscaleBarRendererRegistry ()
 Gets the registry of available scalebar renderers.
 
static int scaleIconSize (int standardSize, bool applyDevicePixelRatio=false)
 Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly, whilst still resulting in pixel-perfect sizes for low-dpi displays.
 
static QgsSensorRegistrysensorRegistry ()
 Returns the application's sensor registry, used for sensor types.
 
static QString serverResourcesPath ()
 Returns the path to the server resources directory.
 
static void setAuthDatabaseDirPath (const QString &authDbDirPath)
 Alters authentication data base directory path - used by 3rd party apps.
 
static void setCustomVariable (const QString &name, const QVariant &value)
 Set a single custom expression variable.
 
static void setCustomVariables (const QVariantMap &customVariables)
 Custom expression variables for this application.
 
static void setDefaultSvgPaths (const QStringList &pathList)
 Alters default svg paths - used by 3rd party apps.
 
static void setFileOpenEventReceiver (QObject *receiver)
 Sets the FileOpen event receiver.
 
static void setLocale (const QLocale &locale)
 Sets the QGIS locale - used mainly by 3rd party apps and tests.
 
static void setMaxThreads (int maxThreads)
 Set maximum concurrent thread count.
 
static void setNullRepresentation (const QString &nullRepresentation)
 This string is used to represent the value NULL throughout QGIS.
 
static void setPkgDataPath (const QString &pkgDataPath)
 Alters pkg data path - used by 3rd party apps.
 
static void setPluginPath (const QString &pluginPath)
 Alters plugin path - used by 3rd party apps.
 
static void setPrefixPath (const QString &prefixPath, bool useDefaultPaths=false)
 Alters prefix path - used by 3rd party apps.
 
static void setSkippedGdalDrivers (const QStringList &skippedGdalDrivers, const QStringList &deferredSkippedGdalDrivers)
 Sets the list of gdal drivers that should be disabled (skippedGdalDrivers), but excludes for now the ones defines in deferredSkippedGdalDrivers.
 
static void setSvgPaths (const QStringList &svgPaths)
 Sets the paths to svg directories and invalidates the svg path list cache.
 
static void setThemeName (const QString &themeName)
 Set the active theme to the specified theme.
 
static Q_DECL_DEPRECATED QgsSettingsRegistryCoresettingsRegistryCore ()
 Returns the application's settings registry, used for managing application settings.
 
static void setTranslation (const QString &translation)
 Set translation locale code.
 
static void setUITheme (const QString &themeName)
 Set the current UI theme used to style the interface.
 
static QRegularExpression shortNameRegularExpression ()
 Returns the short name regular expression for line edit validator.
 
static QString showSettings ()
 Convenience function to get a summary of the paths used in this application instance useful for debugging mainly.
 
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.
 
static QStringList skippedGdalDrivers ()
 Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable)
 
static QgsSourceCachesourceCache ()
 Returns the application's source cache, used for caching embedded and remote source strings as local files.
 
static QString splashPath ()
 Returns the path to the splash screen image directory.
 
static QString sponsorsFilePath ()
 Returns the path to the sponsors file.
 
static QString srsDatabaseFilePath ()
 Returns the path to the srs.db file.
 
static QgsSvgCachesvgCache ()
 Returns the application's SVG cache, used for caching SVG images and handling parameter replacement within SVG files.
 
static QStringList svgPaths ()
 Returns the paths to svg directories.
 
static Qgs3DSymbolRegistrysymbol3DRegistry ()
 Returns registry of available 3D symbols.
 
static QgsSymbolLayerRegistrysymbolLayerRegistry ()
 Returns the application's symbol layer registry, used for managing symbol layers.
 
static QMap< QString, QString > systemEnvVars ()
 Returns the system environment variables passed to application.
 
static int systemMemorySizeMb ()
 Returns the size of the system memory (RAM) in megabytes.
 
static QgsTaskManagertaskManager ()
 Returns the application's task manager, used for managing application wide background task handling.
 
static QString themeName ()
 Set the active theme to the specified theme.
 
static QgsTileDownloadManagertileDownloadManager ()
 Returns the application's tile download manager, used for download of map tiles when rendering.
 
static QgsTiledSceneRendererRegistrytiledSceneRendererRegistry ()
 Returns the application's tiled scene renderer registry, used for managing tiled scene layer 2D renderers.
 
static QString translatorsFilePath ()
 Returns the path to the sponsors file.
 
static QHash< QString, QString > uiThemes ()
 All themes found in ~/.qgis3/themes folder.
 
static QString userFullName ()
 Returns the user's operating system login account full display name.
 
static QString userLoginName ()
 Returns the user's operating system login account name.
 
static QString userStylePath ()
 Returns the path to user's style.
 
static QString userThemesFolder ()
 Returns the path to user's themes folder.
 
static QgsValidityCheckRegistryvalidityCheckRegistry ()
 Returns the application's validity check registry, used for managing validity checks.
 

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"
 
static const QgsSettingsEntryStringsettingsLocaleGlobalLocale = new QgsSettingsEntryString( QStringLiteral( "globalLocale" ), QgsSettingsTree::sTreeLocale, QString() )
 Settings entry locale global locale.
 
static const QgsSettingsEntryBoolsettingsLocaleOverrideFlag = new QgsSettingsEntryBool( QStringLiteral( "overrideFlag" ), QgsSettingsTree::sTreeLocale, false )
 Settings entry locale override flag.
 
static const QgsSettingsEntryBoolsettingsLocaleShowGroupSeparator = new QgsSettingsEntryBool( QStringLiteral( "showGroupSeparator" ), QgsSettingsTree::sTreeLocale, false )
 Settings entry locale show group separator.
 
static const QgsSettingsEntryStringsettingsLocaleUserLocale = new QgsSettingsEntryString( QStringLiteral( "userLocale" ), QgsSettingsTree::sTreeLocale, QString() )
 Settings entry locale user locale.
 
static const QgsSettingsEntryStringListsettingsSearchPathsForSVG = new QgsSettingsEntryStringList( QStringLiteral( "searchPathsForSVG" ), QgsSettingsTree::sTreeSvg, QStringList() )
 Settings entry search path for SVG.
 

Friends

class TestQgsApplication
 

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 96 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 400 of file qgsapplication.h.

◆ endian_t

Constants for endian-ness.

Enumerator
XDR 
NDR 

Definition at line 553 of file qgsapplication.h.

◆ StyleSheetType

The StyleSheetType enum represents the stylesheet type that a widget supports.

Is is used by widgets that display HTML content to retrieve the standard QGIS stylesheet, maintained according to QGIS visual guidelines.

Enumerator
Qt 
WebBrowser 

StyleSheet for Qt GUI widgets (based on QLabel or QTextBrowser), supports basic CSS and Qt extensions.

Definition at line 159 of file qgsapplication.h.

Constructor & Destructor Documentation

◆ QgsApplication()

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

Constructor for QgsApplication.

Parameters
argccommand line argument count
argvcommand line arguments
GUIenabledset to true if a GUI application is required, or false for a console only application
profileFolderoptional string representing the profile to load at startup
platformNamethe QGIS platform name, e.g., "desktop", "server", "qgis_process" or "external" (for external CLI scripts)

Definition at line 203 of file qgsapplication.cpp.

◆ ~QgsApplication()

QgsApplication::~QgsApplication ( )
override

Definition at line 533 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 1798 of file qgsapplication.cpp.

◆ actionScopeRegistry()

QgsActionScopeRegistry * QgsApplication::actionScopeRegistry ( )
static

Returns the action scope registry.

Definition at line 2153 of file qgsapplication.cpp.

◆ activeThemePath()

QString QgsApplication::activeThemePath ( )
static

Returns the path to the currently active theme directory.

Definition at line 739 of file qgsapplication.cpp.

◆ annotationItemRegistry()

QgsAnnotationItemRegistry * QgsApplication::annotationItemRegistry ( )
static

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

Since
QGIS 3.16

Definition at line 2519 of file qgsapplication.cpp.

◆ annotationRegistry()

QgsAnnotationRegistry * QgsApplication::annotationRegistry ( )
static

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

Note
not available in Python bindings

Definition at line 2604 of file qgsapplication.cpp.

◆ appIconPath()

QString QgsApplication::appIconPath ( )
static

Gets application icon.

Definition at line 754 of file qgsapplication.cpp.

◆ applicationFullName()

QString QgsApplication::applicationFullName ( )
static

Returns the QGIS application full name.

It can be defined by the environment variable QGIS_APPLICATION_FULL_NAME or the /qgis/application_full_name in the QGIS config file.

By default it is equal to applicationName()+' '+platform()

See also
platform()
Since
QGIS 3.30

Definition at line 1440 of file qgsapplication.cpp.

◆ applyGdalSkippedDrivers()

void QgsApplication::applyGdalSkippedDrivers ( )
static

Apply the skipped drivers list to gdal.

See also
skipGdalDriver
restoreGdalDriver
skippedGdalDrivers

Definition at line 1999 of file qgsapplication.cpp.

◆ authManager()

QgsAuthManager * QgsApplication::authManager ( )
static

Returns the application's authentication manager instance.

Note
this can be nullptr if called before initQgis
See also
initQgis

Definition at line 1551 of file qgsapplication.cpp.

◆ authorsFilePath()

QString QgsApplication::authorsFilePath ( )
static

Returns the path to the authors file.

Definition at line 1134 of file qgsapplication.cpp.

◆ bookmarkManager()

QgsBookmarkManager * QgsApplication::bookmarkManager ( )
static

Returns the application's bookmark manager, used for storing installation-wide bookmarks.

Since
QGIS 3.10

Definition at line 2549 of file qgsapplication.cpp.

◆ buildOutputPath()

QString QgsApplication::buildOutputPath ( )
static

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

Definition at line 1918 of file qgsapplication.cpp.

◆ buildSourcePath()

QString QgsApplication::buildSourcePath ( )
static

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

Definition at line 1913 of file qgsapplication.cpp.

◆ calloutRegistry()

QgsCalloutRegistry * QgsApplication::calloutRegistry ( )
static

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

Since
QGIS 3.10

Definition at line 2509 of file qgsapplication.cpp.

◆ classificationMethodRegistry()

QgsClassificationMethodRegistry * QgsApplication::classificationMethodRegistry ( )
static

Returns the application's classification methods registry, used in graduated renderer.

Since
QGIS 3.10

Definition at line 2544 of file qgsapplication.cpp.

◆ collectTranslatableObjects()

void QgsApplication::collectTranslatableObjects ( QgsTranslationContext translationContext)

Emits the signal to collect all the strings of .qgs to be included in ts file.

Since
QGIS 3.4

Definition at line 2124 of file qgsapplication.cpp.

◆ colorSchemeRegistry()

QgsColorSchemeRegistry * QgsApplication::colorSchemeRegistry ( )
static

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

Definition at line 2424 of file qgsapplication.cpp.

◆ connectionRegistry()

QgsConnectionRegistry * QgsApplication::connectionRegistry ( )
static

Returns the application's connection registry, used for managing saved data provider connections.

Since
QGIS 3.14

Definition at line 2589 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 1139 of file qgsapplication.cpp.

◆ coordinateReferenceSystemRegistry()

QgsCoordinateReferenceSystemRegistry * QgsApplication::coordinateReferenceSystemRegistry ( )
static

Returns the application's coordinate reference system (CRS) registry, which handles known CRS definitions (including user-defined CRSes).

Since
QGIS 3.18

Definition at line 2474 of file qgsapplication.cpp.

◆ createDatabase()

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

initialize qgis.db

Definition at line 2158 of file qgsapplication.cpp.

◆ createThemeFolder()

bool QgsApplication::createThemeFolder ( )
static

Create the users theme folder.

Definition at line 2015 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::globalScope().

Definition at line 2048 of file qgsapplication.cpp.

◆ customVariablesChanged

void QgsApplication::customVariablesChanged ( )
signal

Emitted whenever a custom global variable changes.

◆ databaseQueryLog()

QgsDatabaseQueryLog * QgsApplication::databaseQueryLog ( )
static

Returns the database query log.

Since
QGIS 3.24

Definition at line 2564 of file qgsapplication.cpp.

◆ 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.

Definition at line 2454 of file qgsapplication.cpp.

◆ defaultStyleModel()

QgsStyleModel * QgsApplication::defaultStyleModel ( )
static

Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).

Using this shared model instead of creating a new QgsStyleModel improves performance.

Since
QGIS 3.10

Definition at line 2569 of file qgsapplication.cpp.

◆ defaultStylePath()

QString QgsApplication::defaultStylePath ( )
static

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

Definition at line 1489 of file qgsapplication.cpp.

◆ defaultThemePath()

QString QgsApplication::defaultThemePath ( )
static

Returns the path to the default theme directory.

Definition at line 735 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 1494 of file qgsapplication.cpp.

◆ deferredSkippedGdalDrivers()

QStringList QgsApplication::deferredSkippedGdalDrivers ( )
static

Returns the list of gdal drivers that have been disabled in the current session, and thus, for safety, should not be disabled right now, but at the next application restart.

Since
QGIS 3.10

Definition at line 1994 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 contributors.json file.

Definition at line 1143 of file qgsapplication.cpp.

◆ donorsFilePath()

QString QgsApplication::donorsFilePath ( )
static

Returns the path to the donors file.

Definition at line 1153 of file qgsapplication.cpp.

◆ endian()

QgsApplication::endian_t QgsApplication::endian ( )
static

Returns whether this machine uses big or little endian.

Definition at line 1519 of file qgsapplication.cpp.

◆ event()

bool QgsApplication::event ( QEvent *  event)
override

Watch for QFileOpenEvent.

Definition at line 565 of file qgsapplication.cpp.

◆ exitQgis()

void QgsApplication::exitQgis ( )
static

deletes provider registry and map layer registry

Definition at line 1571 of file qgsapplication.cpp.

◆ externalStorageRegistry()

QgsExternalStorageRegistry * QgsApplication::externalStorageRegistry ( )
static

Returns registry of available external storage implementations.

Since
QGIS 3.20

Definition at line 2639 of file qgsapplication.cpp.

◆ fieldFormatterRegistry()

QgsFieldFormatterRegistry * QgsApplication::fieldFormatterRegistry ( )
static

Gets the registry of available field formatters.

Definition at line 2614 of file qgsapplication.cpp.

◆ fontManager()

QgsFontManager * QgsApplication::fontManager ( )
static

Returns the application font manager, which manages available fonts and font installation for the QGIS instance.

Since
QGIS 3.28

Definition at line 2574 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 849 of file qgsapplication.cpp.

◆ getThemeIcon()

QIcon QgsApplication::getThemeIcon ( const QString &  name,
const QColor &  fillColor = QColor(),
const QColor &  strokeColor = QColor() 
)
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.

Since QGIS 3.20, the optional fillColor and strokeColor arguments can be used to control the color of parameter based SVG icons.

Definition at line 775 of file qgsapplication.cpp.

◆ getThemePixmap()

QPixmap QgsApplication::getThemePixmap ( const QString &  name,
const QColor &  foreColor = QColor(),
const QColor &  backColor = QColor(),
int  size = 16 
)
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.

If foreColor or backColor are specified, then these colors will be used for parametrized colors in SVG files wherever available. If colors are specified then the size argument also must be set.

Definition at line 914 of file qgsapplication.cpp.

◆ gpsBabelFormatRegistry()

QgsBabelFormatRegistry * QgsApplication::gpsBabelFormatRegistry ( )
static

Returns the application's GPSBabel format registry, used for managing GPSBabel formats.

Since
QGIS 3.22

Definition at line 2534 of file qgsapplication.cpp.

◆ gpsConnectionRegistry()

QgsGpsConnectionRegistry * QgsApplication::gpsConnectionRegistry ( )
static

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

Definition at line 2529 of file qgsapplication.cpp.

◆ i18nPath()

QString QgsApplication::i18nPath ( )
static

Returns the path to the translation directory.

Definition at line 1168 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 764 of file qgsapplication.cpp.

◆ iconsPath()

QString QgsApplication::iconsPath ( )
static

Returns the path to the icons image directory.

Definition at line 1206 of file qgsapplication.cpp.

◆ imageCache()

QgsImageCache * QgsApplication::imageCache ( )
static

Returns the application's image cache, used for caching resampled versions of raster images.

See also
svgCache()
Since
QGIS 3.6

Definition at line 2484 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 223 of file qgsapplication.cpp.

◆ initQgis()

void QgsApplication::initQgis ( )
static

loads providers

Definition at line 1524 of file qgsapplication.cpp.

◆ instance()

QgsApplication * QgsApplication::instance ( )
static

Returns the singleton instance of the QgsApplication.

Definition at line 560 of file qgsapplication.cpp.

◆ isRunningFromBuildDir()

static bool QgsApplication::isRunningFromBuildDir ( )
inlinestatic

Indicates whether running from build directory (not installed)

Definition at line 599 of file qgsapplication.h.

◆ layerMetadataProviderRegistry()

QgsLayerMetadataProviderRegistry * QgsApplication::layerMetadataProviderRegistry ( )
static

Returns registry of available layer metadata provider implementations.

Since
QGIS 3.28

Definition at line 2594 of file qgsapplication.cpp.

◆ layoutItemRegistry()

QgsLayoutItemRegistry * QgsApplication::layoutItemRegistry ( )
static

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

Definition at line 2514 of file qgsapplication.cpp.

◆ layoutTemplatePaths()

QStringList QgsApplication::layoutTemplatePaths ( )
static

Returns the paths to layout template directories.

Definition at line 1275 of file qgsapplication.cpp.

◆ libexecPath()

QString QgsApplication::libexecPath ( )
static

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

Definition at line 1509 of file qgsapplication.cpp.

◆ libraryPath()

QString QgsApplication::libraryPath ( )
static

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

Definition at line 1504 of file qgsapplication.cpp.

◆ licenceFilePath()

QString QgsApplication::licenceFilePath ( )
static

Returns the path to the licence file.

Definition at line 1163 of file qgsapplication.cpp.

◆ locale()

QString QgsApplication::locale ( )
static

Returns the QGIS locale.

Definition at line 1459 of file qgsapplication.cpp.

◆ localeChanged

void QgsApplication::localeChanged ( )
signal

Emitted when project locale has been changed.

Since
QGIS 3.22.2

◆ localizedDataPathRegistry()

QgsLocalizedDataPathRegistry * QgsApplication::localizedDataPathRegistry ( )
static

Returns the registry of data repositories These are used as paths for basemaps, logos, etc.

which can be referenced differently across work stations.

See also
QgsLocalizedDataPathRegistry
Since
QGIS 3.14

Definition at line 2649 of file qgsapplication.cpp.

◆ maxConcurrentConnectionsPerPool()

int QgsApplication::maxConcurrentConnectionsPerPool ( ) const

The maximum number of concurrent connections per connections pool.

Note
QGIS may in some situations allocate more than this amount of connections to avoid deadlocks.
Since
QGIS 3.4

Definition at line 2105 of file qgsapplication.cpp.

◆ maxThreads()

int QgsApplication::maxThreads ( )
static

Gets maximum concurrent thread count.

Definition at line 759 of file qgsapplication.cpp.

◆ messageLog()

QgsMessageLog * QgsApplication::messageLog ( )
static

Returns the application's message log.

Definition at line 2579 of file qgsapplication.cpp.

◆ metadataPath()

QString QgsApplication::metadataPath ( )
static

Returns the path to the metadata directory.

Definition at line 1176 of file qgsapplication.cpp.

◆ networkContentFetcherRegistry()

QgsNetworkContentFetcherRegistry * QgsApplication::networkContentFetcherRegistry ( )
static

Returns the application's network content registry used for fetching temporary files during QGIS session.

Since
QGIS 3.2

Definition at line 2494 of file qgsapplication.cpp.

◆ notify()

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

Catch exceptions when sending event to receiver.

Definition at line 593 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 2129 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.

◆ numericFormatRegistry()

QgsNumericFormatRegistry * QgsApplication::numericFormatRegistry ( )
static

Gets the registry of available numeric formats.

Since
QGIS 3.12

Definition at line 2609 of file qgsapplication.cpp.

◆ osName()

QString QgsApplication::osName ( )
static

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

See also
platform()

Definition at line 1376 of file qgsapplication.cpp.

◆ pageSizeRegistry()

QgsPageSizeRegistry * QgsApplication::pageSizeRegistry ( )
static

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

Definition at line 2599 of file qgsapplication.cpp.

◆ paintEffectRegistry()

QgsPaintEffectRegistry * QgsApplication::paintEffectRegistry ( )
static

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

Definition at line 2429 of file qgsapplication.cpp.

◆ pkgDataPath()

QString QgsApplication::pkgDataPath ( )
static

Returns the common root path of all application data directories.

Definition at line 727 of file qgsapplication.cpp.

◆ platform()

QString QgsApplication::platform ( )
static

Returns the QGIS platform name, e.g., "desktop", "server", "qgis_process" or "external" (for external CLI scripts).

See also
osName()

Definition at line 1435 of file qgsapplication.cpp.

◆ pluginLayerRegistry()

QgsPluginLayerRegistry * QgsApplication::pluginLayerRegistry ( )
static

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

Definition at line 2539 of file qgsapplication.cpp.

◆ pluginPath()

QString QgsApplication::pluginPath ( )
static

Returns the path to the application plugin directory.

Definition at line 722 of file qgsapplication.cpp.

◆ pointCloudRendererRegistry()

QgsPointCloudRendererRegistry * QgsApplication::pointCloudRendererRegistry ( )
static

Returns the application's point cloud renderer registry, used for managing point cloud layer 2D renderers.

Since
QGIS 3.18

Definition at line 2444 of file qgsapplication.cpp.

◆ prefixPath()

QString QgsApplication::prefixPath ( )
static

Returns the path to the application prefix directory.

Definition at line 704 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.

Definition at line 2584 of file qgsapplication.cpp.

◆ profiler()

QgsRuntimeProfiler * QgsApplication::profiler ( )
static

Returns the application runtime profiler.

Definition at line 631 of file qgsapplication.cpp.

◆ profileSourceRegistry()

QgsProfileSourceRegistry * QgsApplication::profileSourceRegistry ( )
static

Returns registry of available profile source implementations.

Since
QGIS 3.38

Definition at line 2644 of file qgsapplication.cpp.

◆ projectStorageRegistry()

QgsProjectStorageRegistry * QgsApplication::projectStorageRegistry ( )
static

Returns registry of available project storage implementations.

Since
QGIS 3.2

Definition at line 2634 of file qgsapplication.cpp.

◆ qgisAuthDatabaseFilePath()

QString QgsApplication::qgisAuthDatabaseFilePath ( )
static

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

Definition at line 1196 of file qgsapplication.cpp.

◆ qgisMasterDatabaseFilePath()

QString QgsApplication::qgisMasterDatabaseFilePath ( )
static

Returns the path to the master qgis.db file.

Definition at line 1181 of file qgsapplication.cpp.

◆ qgisSettingsDirPath()

QString QgsApplication::qgisSettingsDirPath ( )
static

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

Definition at line 1186 of file qgsapplication.cpp.

◆ qgisUserDatabaseFilePath()

QString QgsApplication::qgisUserDatabaseFilePath ( )
static

Returns the path to the user qgis.db file.

Definition at line 1191 of file qgsapplication.cpp.

◆ qmlImportPath()

QString QgsApplication::qmlImportPath ( )
static

Returns the path where QML components are installed for QGIS Quick library.

Returns empty string when QGIS is built without Quick support

Since
QGIS 3.2

Definition at line 1514 of file qgsapplication.cpp.

◆ rasterRendererRegistry()

QgsRasterRendererRegistry * QgsApplication::rasterRendererRegistry ( )
static

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

Note
not available in Python bindings

Definition at line 2439 of file qgsapplication.cpp.

◆ recentStyleHandler()

QgsRecentStyleHandler * QgsApplication::recentStyleHandler ( )
static

Returns the handler for recently used style items.

Since
QGIS 3.22

Definition at line 2559 of file qgsapplication.cpp.

◆ registerGdalDriversFromSettings()

void QgsApplication::registerGdalDriversFromSettings ( )
static

Register gdal drivers, excluding the ones mentioned in "gdal/skipList" setting.

Since
QGIS 3.10

Definition at line 1971 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 1790 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 1863 of file qgsapplication.cpp.

◆ renderer3DRegistry()

Qgs3DRendererRegistry * QgsApplication::renderer3DRegistry ( )
static

Returns registry of available 3D renderers.

Definition at line 2619 of file qgsapplication.cpp.

◆ rendererRegistry()

QgsRendererRegistry * QgsApplication::rendererRegistry ( )
static

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

Definition at line 2434 of file qgsapplication.cpp.

◆ reportStyleSheet()

QString QgsApplication::reportStyleSheet ( QgsApplication::StyleSheetType  styleSheetType = QgsApplication::StyleSheetType::Qt)
static

Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet is supported by the widget.

Typically you will use this method by doing: QString myStyle = QgsApplication::reportStyleSheet(); textBrowserReport->document()->setDefaultStyleSheet(myStyle); if you are using a QgsWebView you will need to manually inject the CSS into a head -> script tag instead.

Returns
the stylesheet CSS rules.
Note
if styleSheetType equals StyleSheetType::Qt you can use the special Qt extensions too, for example the gradient fills for backgrounds.

Definition at line 1639 of file qgsapplication.cpp.

◆ requestForTranslatableObjects

void QgsApplication::requestForTranslatableObjects ( QgsTranslationContext translationContext)
signal

Emitted when project strings which require translation are being collected for inclusion in a .ts file.

In order to register translatable strings, connect to this signal and register the strings within the specified translationContext.

Since
QGIS 3.4

◆ resolvePkgPath()

QString QgsApplication::resolvePkgPath ( )
static

Calculate the application pkg path.

Returns
the resolved pkg path

Definition at line 934 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 1940 of file qgsapplication.cpp.

◆ scaleBarRendererRegistry()

QgsScaleBarRendererRegistry * QgsApplication::scaleBarRendererRegistry ( )
static

Gets the registry of available scalebar renderers.

Since
QGIS 3.14

Definition at line 2629 of file qgsapplication.cpp.

◆ scaleIconSize()

int QgsApplication::scaleIconSize ( int  standardSize,
bool  applyDevicePixelRatio = false 
)
static

Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly, whilst still resulting in pixel-perfect sizes for low-dpi displays.

standardSize should be set to a standard icon size, e.g. 16, 24, 48, etc.

Since
QGIS 3.16

Definition at line 2092 of file qgsapplication.cpp.

◆ sensorRegistry()

QgsSensorRegistry * QgsApplication::sensorRegistry ( )
static

Returns the application's sensor registry, used for sensor types.

Since
QGIS 3.32

Definition at line 2524 of file qgsapplication.cpp.

◆ serverResourcesPath()

QString QgsApplication::serverResourcesPath ( )
static

Returns the path to the server resources directory.

Definition at line 1499 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 695 of file qgsapplication.cpp.

◆ setCustomVariable()

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

Set a single custom expression variable.

Definition at line 2082 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::globalScope().

Definition at line 2067 of file qgsapplication.cpp.

◆ setDefaultSvgPaths()

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

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

Definition at line 690 of file qgsapplication.cpp.

◆ setFileOpenEventReceiver()

void QgsApplication::setFileOpenEventReceiver ( QObject *  receiver)
static

Sets the FileOpen event receiver.

Definition at line 636 of file qgsapplication.cpp.

◆ setLocale()

void QgsApplication::setLocale ( const QLocale &  locale)
static

Sets the QGIS locale - used mainly by 3rd party apps and tests.

In QGIS this is internally triggered by the application in startup.

Since
QGIS 3.22.2

Definition at line 1478 of file qgsapplication.cpp.

◆ setMaxThreads()

void QgsApplication::setMaxThreads ( int  maxThreads)
static

Set maximum concurrent thread count.

Note
must be between 2 and #cores, -1 means use all available cores

Definition at line 2390 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 2139 of file qgsapplication.cpp.

◆ setPkgDataPath()

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

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

Definition at line 679 of file qgsapplication.cpp.

◆ setPluginPath()

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

Alters plugin path - used by 3rd party apps.

Definition at line 674 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 653 of file qgsapplication.cpp.

◆ setSkippedGdalDrivers()

void QgsApplication::setSkippedGdalDrivers ( const QStringList &  skippedGdalDrivers,
const QStringList &  deferredSkippedGdalDrivers 
)
static

Sets the list of gdal drivers that should be disabled (skippedGdalDrivers), but excludes for now the ones defines in deferredSkippedGdalDrivers.

This writes the "gdal/skipList" setting.

Since
QGIS 3.10

Definition at line 1959 of file qgsapplication.cpp.

◆ setSvgPaths()

void QgsApplication::setSvgPaths ( const QStringList &  svgPaths)
static

Sets the paths to svg directories and invalidates the svg path list cache.

Since
QGIS 3.18

Definition at line 1234 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 929 of file qgsapplication.cpp.

◆ settingsRegistryCore()

QgsSettingsRegistryCore * QgsApplication::settingsRegistryCore ( )
static

Returns the application's settings registry, used for managing application settings.

Since
QGIS 3.20
Deprecated:
since QGIS 3.30 use QgsSettings::treeRoot() instead

Definition at line 2419 of file qgsapplication.cpp.

◆ setTranslation()

void QgsApplication::setTranslation ( const QString &  translation)
static

Set translation locale code.

Since
QGIS 3.4

Definition at line 2110 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 1020 of file qgsapplication.cpp.

◆ shortNameRegularExpression()

QRegularExpression QgsApplication::shortNameRegularExpression ( )
static

Returns the short name regular expression for line edit validator.

Note
This functionality was previously available as shortNameRegExp for QGIS <= 3.20
Since
QGIS 3.22

Definition at line 1292 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 1612 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 1930 of file qgsapplication.cpp.

◆ skippedGdalDrivers()

QStringList QgsApplication::skippedGdalDrivers ( )
static

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

Definition at line 1954 of file qgsapplication.cpp.

◆ sourceCache()

QgsSourceCache * QgsApplication::sourceCache ( )
static

Returns the application's source cache, used for caching embedded and remote source strings as local files.

Since
QGIS 3.16

Definition at line 2489 of file qgsapplication.cpp.

◆ splashPath()

QString QgsApplication::splashPath ( )
static

Returns the path to the splash screen image directory.

Definition at line 1201 of file qgsapplication.cpp.

◆ sponsorsFilePath()

QString QgsApplication::sponsorsFilePath ( )
static

Returns the path to the sponsors file.

Definition at line 1148 of file qgsapplication.cpp.

◆ srsDatabaseFilePath()

QString QgsApplication::srsDatabaseFilePath ( )
static

Returns the path to the srs.db file.

Definition at line 1211 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.

See also
imageCache()

Definition at line 2479 of file qgsapplication.cpp.

◆ svgPaths()

QStringList QgsApplication::svgPaths ( )
static

Returns the paths to svg directories.

Definition at line 1240 of file qgsapplication.cpp.

◆ symbol3DRegistry()

Qgs3DSymbolRegistry * QgsApplication::symbol3DRegistry ( )
static

Returns registry of available 3D symbols.

Since
QGIS 3.16

Definition at line 2624 of file qgsapplication.cpp.

◆ symbolLayerRegistry()

QgsSymbolLayerRegistry * QgsApplication::symbolLayerRegistry ( )
static

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

Definition at line 2504 of file qgsapplication.cpp.

◆ systemEnvVars()

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

Returns the system environment variables passed to application.

Definition at line 1282 of file qgsapplication.cpp.

◆ systemMemorySizeMb()

int QgsApplication::systemMemorySizeMb ( )
static

Returns the size of the system memory (RAM) in megabytes.

This is only supported on some platforms, and will return -1 if not supported.

Since
QGIS 3.26

Definition at line 1399 of file qgsapplication.cpp.

◆ taskManager()

QgsTaskManager * QgsApplication::taskManager ( )
static

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

Definition at line 2414 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 1015 of file qgsapplication.cpp.

◆ tileDownloadManager()

QgsTileDownloadManager * QgsApplication::tileDownloadManager ( )
static

Returns the application's tile download manager, used for download of map tiles when rendering.

Note
not available in Python bindings
Since
QGIS 3.18

Definition at line 2554 of file qgsapplication.cpp.

◆ tiledSceneRendererRegistry()

QgsTiledSceneRendererRegistry * QgsApplication::tiledSceneRendererRegistry ( )
static

Returns the application's tiled scene renderer registry, used for managing tiled scene layer 2D renderers.

Since
QGIS 3.34

Definition at line 2449 of file qgsapplication.cpp.

◆ translation()

QString QgsApplication::translation ( ) const

Returns the current application translation locale code.

See also
setTranslation()
Since
QGIS 3.22

Definition at line 2119 of file qgsapplication.cpp.

◆ translatorsFilePath()

QString QgsApplication::translatorsFilePath ( )
static

Returns the path to the sponsors file.

Definition at line 1158 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 1109 of file qgsapplication.cpp.

◆ userFullName()

QString QgsApplication::userFullName ( )
static

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

See also
userLoginName()

Definition at line 1338 of file qgsapplication.cpp.

◆ userLoginName()

QString QgsApplication::userLoginName ( )
static

Returns the user's operating system login account name.

See also
userFullName()

Definition at line 1298 of file qgsapplication.cpp.

◆ userStylePath()

QString QgsApplication::userStylePath ( )
static

Returns the path to user's style.

Definition at line 1287 of file qgsapplication.cpp.

◆ userThemesFolder()

QString QgsApplication::userThemesFolder ( )
static

Returns the path to user's themes folder.

Definition at line 1484 of file qgsapplication.cpp.

◆ validityCheckRegistry()

QgsValidityCheckRegistry * QgsApplication::validityCheckRegistry ( )
static

Returns the application's validity check registry, used for managing validity checks.

Since
QGIS 3.6

Definition at line 2499 of file qgsapplication.cpp.

Friends And Related Symbol Documentation

◆ TestQgsApplication

friend class TestQgsApplication
friend

Definition at line 1195 of file qgsapplication.h.

Member Data Documentation

◆ QGIS_APPLICATION_NAME

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

Definition at line 167 of file qgsapplication.h.

◆ QGIS_ORGANIZATION_DOMAIN

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

Definition at line 166 of file qgsapplication.h.

◆ QGIS_ORGANIZATION_NAME

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

Definition at line 165 of file qgsapplication.h.

◆ settingsLocaleGlobalLocale

const QgsSettingsEntryString * QgsApplication::settingsLocaleGlobalLocale = new QgsSettingsEntryString( QStringLiteral( "globalLocale" ), QgsSettingsTree::sTreeLocale, QString() )
static

Settings entry locale global locale.

Definition at line 1052 of file qgsapplication.h.

◆ settingsLocaleOverrideFlag

const QgsSettingsEntryBool * QgsApplication::settingsLocaleOverrideFlag = new QgsSettingsEntryBool( QStringLiteral( "overrideFlag" ), QgsSettingsTree::sTreeLocale, false )
static

Settings entry locale override flag.

Definition at line 1050 of file qgsapplication.h.

◆ settingsLocaleShowGroupSeparator

const QgsSettingsEntryBool * QgsApplication::settingsLocaleShowGroupSeparator = new QgsSettingsEntryBool( QStringLiteral( "showGroupSeparator" ), QgsSettingsTree::sTreeLocale, false )
static

Settings entry locale show group separator.

Definition at line 1054 of file qgsapplication.h.

◆ settingsLocaleUserLocale

const QgsSettingsEntryString * QgsApplication::settingsLocaleUserLocale = new QgsSettingsEntryString( QStringLiteral( "userLocale" ), QgsSettingsTree::sTreeLocale, QString() )
static

Settings entry locale user locale.

Definition at line 1048 of file qgsapplication.h.

◆ settingsSearchPathsForSVG

const QgsSettingsEntryStringList * QgsApplication::settingsSearchPathsForSVG = new QgsSettingsEntryStringList( QStringLiteral( "searchPathsForSVG" ), QgsSettingsTree::sTreeSvg, QStringList() )
static

Settings entry search path for SVG.

Definition at line 1056 of file qgsapplication.h.


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