15 #ifndef QGSAPPLICATION_H
16 #define QGSAPPLICATION_H
18 #include "qgis_core.h"
19 #include <QApplication>
21 #include <QStringList>
25 #include "qgsconfig.h"
26 #include "qgssettingsentry.h"
29 class QgsSettingsRegistryCore;
52 class QgsAnnotationRegistry;
92 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
96 argc = PyList_GET_SIZE( argvlist );
100 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
104 for (
int a = 0; a < argc; ++a )
108 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
109 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
112 strcpy( argv[a], arg );
113 argv[a + argc + 1] = argv[a];
116 argv[argc + argc + 1] = argv[argc] = NULL;
123 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
125 for (
int a = 0, na = 0; a < argc; ++a )
128 if ( argv[na] == argv[a + argc + 1] )
131 PyList_SetSlice( argvlist, na, na + 1, NULL );
159 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" );
161 QgsApplication( SIP_PYLIST argv,
bool GUIenabled, QString profileFolder = QString(), QString platformName =
"desktop" ) / PostHook = __pyQtQAppHook__ / [(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" )];
169 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
174 static int nargc = argc;
176 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
179 qtgui_UpdatePyArgv( a0, argc, argv );
200 static void init( QString profileFolder = QString() )
SIP_SKIP;
203 bool event( QEvent *event ) override;
206 bool notify( QObject *receiver, QEvent *event ) override;
209 static
void setFileOpenEventReceiver( QObject *receiver );
221 static
void setThemeName( const QString &themeName );
227 static QString resolvePkgPath();
236 static QString themeName();
245 static
void setUITheme( const QString &themeName );
253 static QHash<QString, QString> uiThemes();
256 static QString authorsFilePath();
263 static QString contributorsFilePath();
271 static QString developersMapFilePath();
274 static QString sponsorsFilePath();
277 static QString donorsFilePath();
280 static QString serverResourcesPath();
285 static QString translatorsFilePath();
290 static QString licenceFilePath();
293 static QString i18nPath();
299 static QString metadataPath();
302 static QString qgisMasterDatabaseFilePath();
305 static QString qgisSettingsDirPath();
308 static QString qgisUserDatabaseFilePath();
311 static QString qgisAuthDatabaseFilePath();
314 static QString splashPath();
317 static QString iconsPath();
320 static QString srsDatabaseFilePath();
327 static
void setSvgPaths( const QStringList &svgPaths );
330 static QStringList svgPaths();
336 static QStringList layoutTemplatePaths();
339 static QMap<QString, QString> systemEnvVars();
342 static QString prefixPath();
345 static QString pluginPath();
348 static QString pkgDataPath();
351 static QString activeThemePath();
354 static QString defaultThemePath();
360 static QString iconPath( const QString &iconFile );
369 static QIcon getThemeIcon( const QString &name, const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );
392 static QCursor getThemeCursor( Cursor cursor );
402 static QPixmap getThemePixmap(
const QString &name,
const QColor &foreColor = QColor(),
const QColor &backColor = QColor(),
int size = 16 );
405 static QString userStylePath();
408 static QRegExp shortNameRegExp();
415 static QString userLoginName();
422 static QString userFullName();
429 static QString osName();
436 static QString platform();
442 static QString locale();
445 static QString userThemesFolder();
448 static QString defaultStylePath();
451 static QString defaultThemesFolder();
454 static QString libraryPath();
457 static QString libexecPath();
465 static QString qmlImportPath();
468 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
471 static void setPluginPath(
const QString &pluginPath );
474 static void setPkgDataPath(
const QString &pkgDataPath );
477 static void setDefaultSvgPaths(
const QStringList &pathList );
480 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
483 static void initQgis();
486 static bool createDatabase( QString *errorMessage =
nullptr );
489 static bool createThemeFolder();
492 static void exitQgis();
495 static QString appIconPath();
505 static endian_t endian();
527 static QString showSettings();
536 static void registerOgrDrivers();
539 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
541 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
545 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
546 static QString cfgIntDir()
SIP_SKIP;
549 static QString buildSourcePath();
551 static QString buildOutputPath();
558 static void skipGdalDriver(
const QString &driver );
565 static void restoreGdalDriver(
const QString &driver );
571 static QStringList skippedGdalDrivers();
579 static void applyGdalSkippedDrivers();
585 static void registerGdalDriversFromSettings();
593 static QStringList deferredSkippedGdalDrivers();
601 static void setSkippedGdalDrivers(
const QStringList &skippedGdalDrivers,
602 const QStringList &deferredSkippedGdalDrivers );
608 static int maxThreads();
615 static void setMaxThreads(
int maxThreads );
808 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
883 static QString nullRepresentation();
888 static
void setNullRepresentation( const QString &nullRepresentation );
897 static QVariantMap customVariables();
906 static
void setCustomVariables( const QVariantMap &customVariables );
913 static
void setCustomVariable( const QString &name, const QVariant &value );
924 static
int scaleIconSize(
int standardSize,
bool applyDevicePixelRatio = false );
934 int maxConcurrentConnectionsPerPool() const;
941 static
void setTranslation( const QString &translation );
952 static const inline QgsSettingsEntryString settingsLocaleUserLocale = QgsSettingsEntryString( QStringLiteral(
"locale/userLocale" ), QgsSettings::NoSection, QString() );
954 static const inline QgsSettingsEntryBool settingsLocaleOverrideFlag = QgsSettingsEntryBool( QStringLiteral(
"locale/overrideFlag" ), QgsSettings::NoSection,
false );
956 static const inline QgsSettingsEntryString settingsLocaleGlobalLocale = QgsSettingsEntryString( QStringLiteral(
"locale/globalLocale" ), QgsSettings::NoSection, QString() );
958 static const inline QgsSettingsEntryBool settingsLocaleShowGroupSeparator = QgsSettingsEntryBool( QStringLiteral(
"locale/showGroupSeparator" ), QgsSettings::NoSection,
false );
960 static const inline QgsSettingsEntryStringList settingsSearchPathsForSVG = QgsSettingsEntryStringList( QStringLiteral(
"svg/searchPathsForSVG" ), QgsSettings::NoSection, QStringList() );
966 bool x11EventFilter( XEvent *event );
996 static void copyPath(
const QString &src,
const QString &dst );
997 static QObject *
ABISYM( mFileOpenEventReceiver );
999 static bool ABISYM( mInitialized );
1002 static bool ABISYM( mRunningFromBuildDir );
1007 static int ABISYM( sMaxThreads );
1009 QMap<QString, QIcon> mIconCache;
1010 QMap<Cursor, QCursor> mCursorCache;
1012 QTranslator *mQgisTranslator =
nullptr;
1013 QTranslator *mQtTranslator =
nullptr;
1018 struct ApplicationMembers
1020 QgsSettingsRegistryCore *mSettingsRegistryCore =
nullptr;
1025 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
1057 QString mNullRepresentation;
1058 QStringList mSvgPathCache;
1059 bool mSvgPathCacheValid =
false;
1061 ApplicationMembers();
1062 ~ApplicationMembers();
1066 ApplicationMembers *mApplicationMembers =
nullptr;
1068 static ApplicationMembers *sApplicationMembers;
1072 static ApplicationMembers *members();
1074 static void invalidateCaches();
1076 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)
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.
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.
Provides a method of recording run time profiles of operations, allowing easy recording of their over...
The QgsScaleBarRendererRegistry manages registered scalebar renderers.
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)