15 #ifndef QGSAPPLICATION_H
16 #define QGSAPPLICATION_H
18 #include "qgis_core.h"
19 #include <QApplication>
21 #include <QStringList>
26 #include "qgsconfig.h"
55 class QgsAnnotationRegistry;
96 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
100 argc = PyList_GET_SIZE( argvlist );
104 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
108 for (
int a = 0; a < argc; ++a )
112 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
113 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
116 strcpy( argv[a], arg );
117 argv[a + argc + 1] = argv[a];
120 argv[argc + argc + 1] = argv[argc] = NULL;
127 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
129 for (
int a = 0, na = 0; a < argc; ++a )
132 if ( argv[na] == argv[a + argc + 1] )
135 PyList_SetSlice( argvlist, na, na + 1, NULL );
173 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"external" );
184 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" )];
192 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
197 static int nargc = argc;
199 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
202 qtgui_UpdatePyArgv( a0, argc, argv );
223 static void init( QString profileFolder = QString() )
SIP_SKIP;
226 bool event( QEvent *event ) override;
229 bool notify( QObject *receiver, QEvent *event ) override;
232 static
void setFileOpenEventReceiver( QObject *receiver );
244 static
void setThemeName( const QString &themeName );
250 static QString resolvePkgPath();
259 static QString themeName();
268 static
void setUITheme( const QString &themeName );
276 static QHash<QString, QString> uiThemes();
279 static QString authorsFilePath();
286 static QString contributorsFilePath();
294 static QString developersMapFilePath();
297 static QString sponsorsFilePath();
300 static QString donorsFilePath();
303 static QString serverResourcesPath();
308 static QString translatorsFilePath();
313 static QString licenceFilePath();
316 static QString i18nPath();
322 static QString metadataPath();
325 static QString qgisMasterDatabaseFilePath();
328 static QString qgisSettingsDirPath();
331 static QString qgisUserDatabaseFilePath();
334 static QString qgisAuthDatabaseFilePath();
337 static QString splashPath();
340 static QString iconsPath();
343 static QString srsDatabaseFilePath();
350 static
void setSvgPaths( const QStringList &svgPaths );
353 static QStringList svgPaths();
359 static QStringList layoutTemplatePaths();
362 static QMap<QString, QString> systemEnvVars();
365 static QString prefixPath();
368 static QString pluginPath();
371 static QString pkgDataPath();
374 static QString activeThemePath();
377 static QString defaultThemePath();
383 static QString iconPath( const QString &iconFile );
392 static QIcon getThemeIcon( const QString &name, const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );
415 static QCursor getThemeCursor( Cursor cursor );
425 static QPixmap getThemePixmap(
const QString &name,
const QColor &foreColor = QColor(),
const QColor &backColor = QColor(),
int size = 16 );
428 static QString userStylePath();
435 static QRegularExpression shortNameRegularExpression();
442 static QString userLoginName();
449 static QString userFullName();
456 static QString osName();
463 static QString platform();
469 static QString locale();
477 static void setLocale(
const QLocale &locale );
480 static QString userThemesFolder();
483 static QString defaultStylePath();
486 static QString defaultThemesFolder();
489 static QString libraryPath();
492 static QString libexecPath();
500 static QString qmlImportPath();
503 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
506 static void setPluginPath(
const QString &pluginPath );
509 static void setPkgDataPath(
const QString &pkgDataPath );
512 static void setDefaultSvgPaths(
const QStringList &pathList );
515 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
518 static void initQgis();
521 static bool createDatabase( QString *errorMessage =
nullptr );
524 static bool createThemeFolder();
527 static void exitQgis();
530 static QString appIconPath();
540 static endian_t endian();
562 static QString showSettings();
571 static void registerOgrDrivers();
574 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
576 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
580 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
581 static QString cfgIntDir()
SIP_SKIP;
584 static QString buildSourcePath();
586 static QString buildOutputPath();
593 static void skipGdalDriver(
const QString &driver );
600 static void restoreGdalDriver(
const QString &driver );
606 static QStringList skippedGdalDrivers();
614 static void applyGdalSkippedDrivers();
620 static void registerGdalDriversFromSettings();
628 static QStringList deferredSkippedGdalDrivers();
636 static void setSkippedGdalDrivers(
const QStringList &skippedGdalDrivers,
637 const QStringList &deferredSkippedGdalDrivers );
643 static int maxThreads();
650 static void setMaxThreads(
int maxThreads );
855 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
936 static QString nullRepresentation();
941 static
void setNullRepresentation( const QString &nullRepresentation );
950 static QVariantMap customVariables();
959 static
void setCustomVariables( const QVariantMap &customVariables );
966 static
void setCustomVariable( const QString &name, const QVariant &value );
977 static
int scaleIconSize(
int standardSize,
bool applyDevicePixelRatio = false );
987 int maxConcurrentConnectionsPerPool() const;
994 static
void setTranslation( const QString &translation );
1001 QString translation() const;
1026 bool x11EventFilter( XEvent *event );
1065 static void copyPath(
const QString &src,
const QString &dst );
1066 static QObject *
ABISYM( mFileOpenEventReceiver );
1068 static bool ABISYM( mInitialized );
1071 static bool ABISYM( mRunningFromBuildDir );
1076 static int ABISYM( sMaxThreads );
1078 QMap<QString, QIcon> mIconCache;
1079 QMap<Cursor, QCursor> mCursorCache;
1081 QTranslator *mQgisTranslator =
nullptr;
1082 QTranslator *mQtTranslator =
nullptr;
1083 QTranslator *mQtBaseTranslator =
nullptr;
1088 struct ApplicationMembers
1095 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
1111 std::unique_ptr<QgsProjectStorageRegistry> mProjectStorageRegistry;
1130 QString mNullRepresentation;
1131 QStringList mSvgPathCache;
1132 bool mSvgPathCacheValid =
false;
1134 ApplicationMembers();
1135 ~ApplicationMembers();
1139 ApplicationMembers *mApplicationMembers =
nullptr;
1141 static ApplicationMembers *sApplicationMembers;
1145 static ApplicationMembers *members();
1147 static void invalidateCaches();
1149 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.
Registry of external storage backends used by QgsExternalResourceWidget.
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...
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)