15#ifndef QGSAPPLICATION_H
16#define QGSAPPLICATION_H
19#include <QApplication>
56class QgsAnnotationRegistry;
99 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
103 argc = PyList_GET_SIZE( argvlist );
107 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
111 for (
int a = 0; a < argc; ++a )
115 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
116 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
119 strcpy( argv[a], arg );
120 argv[a + argc + 1] = argv[a];
123 argv[argc + argc + 1] = argv[argc] = NULL;
130 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
132 for (
int a = 0, na = 0; a < argc; ++a )
135 if ( argv[na] == argv[a + argc + 1] )
138 PyList_SetSlice( argvlist, na, na + 1, NULL );
176 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"external" );
187 QgsApplication( SIP_PYLIST argv,
bool GUIenabled, QString profileFolder = QString(), QString platformName =
"external" ) / PostHook = __pyQtQAppHook__ / [(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" )];
195 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
200 static int nargc = argc;
202 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
205 qtgui_UpdatePyArgv( a0, argc, argv );
226 static void init( QString profileFolder = QString() )
SIP_SKIP;
229 bool event( QEvent *event ) override;
232 bool notify( QObject *receiver, QEvent *event ) override;
235 static
void setFileOpenEventReceiver( QObject *receiver );
247 static
void setThemeName( const QString &themeName );
253 static QString resolvePkgPath();
262 static QString themeName();
271 static
void setUITheme( const QString &themeName );
279 static QHash<QString, QString> uiThemes();
282 static QString authorsFilePath();
289 static QString contributorsFilePath();
297 static QString developersMapFilePath();
300 static QString sponsorsFilePath();
303 static QString donorsFilePath();
306 static QString serverResourcesPath();
311 static QString translatorsFilePath();
316 static QString licenceFilePath();
319 static QString i18nPath();
325 static QString metadataPath();
328 static QString qgisMasterDatabaseFilePath();
331 static QString qgisSettingsDirPath();
334 static QString qgisUserDatabaseFilePath();
337 static QString qgisAuthDatabaseFilePath();
340 static QString splashPath();
343 static QString iconsPath();
346 static QString srsDatabaseFilePath();
353 static
void setSvgPaths( const QStringList &svgPaths );
356 static QStringList svgPaths();
362 static QStringList layoutTemplatePaths();
365 static QMap<QString, QString> systemEnvVars();
368 static QString prefixPath();
371 static QString pluginPath();
374 static QString pkgDataPath();
377 static QString activeThemePath();
380 static QString defaultThemePath();
386 static QString iconPath( const QString &iconFile );
395 static QIcon getThemeIcon( const QString &name, const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );
418 static QCursor getThemeCursor( Cursor cursor );
428 static QPixmap getThemePixmap(
const QString &name,
const QColor &foreColor = QColor(),
const QColor &backColor = QColor(),
int size = 16 );
431 static QString userStylePath();
438 static QRegularExpression shortNameRegularExpression();
445 static QString userLoginName();
452 static QString userFullName();
459 static QString osName();
468 static int systemMemorySizeMb();
475 static QString platform();
481 static QString locale();
489 static void setLocale(
const QLocale &locale );
492 static QString userThemesFolder();
495 static QString defaultStylePath();
498 static QString defaultThemesFolder();
501 static QString libraryPath();
504 static QString libexecPath();
512 static QString qmlImportPath();
515 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
518 static void setPluginPath(
const QString &pluginPath );
521 static void setPkgDataPath(
const QString &pkgDataPath );
524 static void setDefaultSvgPaths(
const QStringList &pathList );
527 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
530 static void initQgis();
533 static bool createDatabase( QString *errorMessage =
nullptr );
536 static bool createThemeFolder();
539 static void exitQgis();
542 static QString appIconPath();
552 static endian_t endian();
574 static QString showSettings();
583 static void registerOgrDrivers();
586 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
588 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
592#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
593 static QString cfgIntDir()
SIP_SKIP;
596 static QString buildSourcePath();
598 static QString buildOutputPath();
605 static void skipGdalDriver(
const QString &driver );
612 static void restoreGdalDriver(
const QString &driver );
618 static QStringList skippedGdalDrivers();
626 static void applyGdalSkippedDrivers();
632 static void registerGdalDriversFromSettings();
640 static QStringList deferredSkippedGdalDrivers();
648 static void setSkippedGdalDrivers(
const QStringList &skippedGdalDrivers,
649 const QStringList &deferredSkippedGdalDrivers );
655 static int maxThreads();
662 static void setMaxThreads(
int maxThreads );
881 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
968 static QString nullRepresentation();
973 static
void setNullRepresentation( const QString &nullRepresentation );
982 static QVariantMap customVariables();
991 static
void setCustomVariables( const QVariantMap &customVariables );
998 static
void setCustomVariable( const QString &name, const QVariant &value );
1009 static
int scaleIconSize(
int standardSize,
bool applyDevicePixelRatio = false );
1019 int maxConcurrentConnectionsPerPool() const;
1026 static
void setTranslation( const QString &translation );
1033 QString translation() const;
1058 bool x11EventFilter( XEvent *event );
1097 static void copyPath(
const QString &src,
const QString &dst );
1098 static QObject *
ABISYM( mFileOpenEventReceiver );
1100 static bool ABISYM( mInitialized );
1103 static bool ABISYM( mRunningFromBuildDir );
1108 static int ABISYM( sMaxThreads );
1110 QMap<QString, QIcon> mIconCache;
1111 QMap<Cursor, QCursor> mCursorCache;
1113 QTranslator *mQgisTranslator =
nullptr;
1114 QTranslator *mQtTranslator =
nullptr;
1115 QTranslator *mQtBaseTranslator =
nullptr;
1120 struct ApplicationMembers
1127 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
1165 QString mNullRepresentation;
1166 QStringList mSvgPathCache;
1167 bool mSvgPathCacheValid =
false;
1169 ApplicationMembers();
1170 ~ApplicationMembers();
1174 ApplicationMembers *mApplicationMembers =
nullptr;
1176 static ApplicationMembers *sApplicationMembers;
1180 static ApplicationMembers *members();
1182 static void invalidateCaches();
1184 friend class TestQgsApplication;
Keeps track of available 3D renderers.
Registry of available 3D symbol classes.
The action scope registry is an application wide registry that contains a list of available action sc...
Registry of available annotation item types.
Extends QApplication to provide access to QGIS specific resources such as theme paths,...
endian_t
Constants for endian-ness.
void customVariablesChanged()
Emitted whenever a custom global variable changes.
StyleSheetType
The StyleSheetType enum represents the stylesheet type that a widget supports.
@ WebBrowser
StyleSheet for Qt GUI widgets (based on QLabel or QTextBrowser), supports basic CSS and Qt extensions...
static const char * QGIS_APPLICATION_NAME
static const char * QGIS_ORGANIZATION_DOMAIN
void preNotify(QObject *receiver, QEvent *event, bool *done)
void localeChanged()
Emitted when project locale has been changed.
static const char * QGIS_ORGANIZATION_NAME
Cursor
The Cursor enum defines constants for QGIS custom cursors.
@ CrossHair
Precisely identify a point on the canvas.
@ Identify
Identify: obtain information about the object.
@ Select
Select a rectangle.
@ CapturePoint
Select and capture a point or a feature.
@ Sampler
Color/Value picker.
void requestForTranslatableObjects(QgsTranslationContext *translationContext)
Emitted when project strings which require translation are being collected for inclusion in a ....
void nullRepresentationChanged()
This string is used to represent the value NULL throughout QGIS.
static bool isRunningFromBuildDir()
Indicates whether running from build directory (not installed)
Singleton offering an interface to manage the authentication configuration database and to utilize co...
Manages storage of a set of bookmarks.
Registry of available callout classes.
This class manages all known classification methods.
Registry of color schemes.
A registry for saved data provider connections, allowing retrieval of saved connections by name and p...
A registry for known coordinate reference system (CRS) definitions, including any user-defined CRSes.
This class keeps a list of data item providers that may add items to the browser tree.
Handles logging of database queries.
Registry of external storage backends used by QgsExternalResourceWidget.
Manages available fonts and font installation for a QGIS instance.
A class to register / unregister existing GPS connections such that the information is available to a...
A cache for images derived from raster files.
Registry of available layout item types.
A registry class to hold localized data paths which can be used for basemaps, logos,...
Interface for logging messages from QGIS in GUI independent way.
Registry for temporary fetched files.
A registry for known page sizes.
Registry of available paint effects.
A registry of plugin layers types.
Registry of 2D renderers for point clouds.
Registry for various processing components, including providers, algorithms and various parameters an...
Registry of storage backends that QgsProject may use.
Registry for raster renderers.
Handles and tracks style items recently used in the QGIS GUI.
Provides a method of recording run time profiles of operations, allowing easy recording of their over...
The QgsScaleBarRendererRegistry manages registered scalebar renderers.
A boolean settings entry.
A string list settings entry.
QgsSettingsRegistryCore is used for settings introspection and collects all QgsSettingsEntry instance...
static const char * LOCALE
A cache for source strings that returns a local file path containing the source content.
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
A cache for images / pictures derived from SVG files.
Registry of available symbol layer classes.
Task manager for managing a set of long-running QgsTask tasks.
Tile download manager handles downloads of map tiles for the purpose of map rendering.
Used for the collecting of strings from projects for translation and creation of ts files.
User profile manager is used to manager list, and manage user profiles on the users machine.
User profile contains information about the user profile folders on the machine.
This class keeps a list of QgsAbstractValidityCheck checks which can be used when performing validity...
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
#define SIP_KEEPREFERENCE
#define SIP_IF_FEATURE(feature)
QObject * ABISYM(QgsApplication::mFileOpenEventReceiver)