/************************************************************************ * This file has been generated automatically from * * * * src/core/qgsapplication.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ class QgsApplication : QApplication { %Docstring 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. %End %TypeHeaderCode #include "qgsapplication.h" %End %TypeCode // Convert a Python argv list to a conventional C argc count and argv array. static char **qtgui_ArgvToC( PyObject *argvlist, int &argc ) { char **argv; argc = PyList_GET_SIZE( argvlist ); // Allocate space for two copies of the argument pointers, plus the // terminating NULL. if ( ( argv = ( char ** )sipMalloc( 2 * ( argc + 1 ) * sizeof( char * ) ) ) == NULL ) return NULL; // Convert the list. for ( int a = 0; a < argc; ++a ) { char *arg; // Get the argument and allocate memory for it. if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL || ( argv[a] = ( char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL ) return NULL; // Copy the argument and save a pointer to it. strcpy( argv[a], arg ); argv[a + argc + 1] = argv[a]; } argv[argc + argc + 1] = argv[argc] = NULL; return argv; } // Remove arguments from the Python argv list that have been removed from the // C argv array. static void qtgui_UpdatePyArgv( PyObject *argvlist, int argc, char **argv ) { for ( int a = 0, na = 0; a < argc; ++a ) { // See if it was removed. if ( argv[na] == argv[a + argc + 1] ) ++na; else PyList_SetSlice( argvlist, na, na + 1, NULL ); } } %End public: enum StyleSheetType { Qt, WebBrowser, }; static const char *QGIS_ORGANIZATION_NAME; static const char *QGIS_ORGANIZATION_DOMAIN; static const char *QGIS_APPLICATION_NAME; 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" )]; %MethodCode // The Python interface is a list of argument strings that is modified. int argc; char **argv; // Convert the list. if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL ) sipIsErr = 1; else { // Create it now the arguments are right. static int nargc = argc; sipCpp = new sipQgsApplication( nargc, argv, a1, *a2, *a3 ); // Now modify the original list. qtgui_UpdatePyArgv( a0, argc, argv ); } %End ~QgsApplication(); static QgsApplication *instance(); %Docstring Returns the singleton instance of the QgsApplication. .. versionadded:: 3.0 %End virtual bool event( QEvent *event ); %Docstring Watch for QFileOpenEvent. %End virtual bool notify( QObject *receiver, QEvent *event ); %Docstring Catch exceptions when sending event to receiver. %End static void setFileOpenEventReceiver( QObject *receiver ); %Docstring Sets the FileOpen event receiver %End static void setThemeName( const QString &themeName ); %Docstring 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'. %End static QString resolvePkgPath(); %Docstring Calculate the application pkg path :return: the resolved pkg path %End static QString themeName(); %Docstring 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. %End static void setUITheme( const QString &themeName ); %Docstring 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. :param themeName: The name of the theme. .. note:: using an invalid theme name will reset to default %End static QHash uiThemes(); %Docstring All themes found in ~/.qgis3/themes folder. The path is to the root folder for the theme :return: A hash of theme name and theme path. Valid theme folders contain style.qss .. note:: Valid theme folders must contain a style.qss file. %End static QString authorsFilePath(); %Docstring Returns the path to the authors file. %End static QString contributorsFilePath(); %Docstring Returns the path to the contributors file. Contributors are people who have submitted patches but don't have commit access. * %End static QString developersMapFilePath(); %Docstring Returns the path to the developers map file. The developers map was created by using leaflet framework, it shows the contributors.json file. .. versionadded:: 2.7 %End static QString sponsorsFilePath(); %Docstring Returns the path to the sponsors file. %End static QString donorsFilePath(); %Docstring Returns the path to the donors file. %End static QString serverResourcesPath(); %Docstring Returns the path to the server resources directory. %End static QString translatorsFilePath(); %Docstring Returns the path to the sponsors file. %End static QString licenceFilePath(); %Docstring Returns the path to the licence file. %End static QString i18nPath(); %Docstring Returns the path to the translation directory. %End static QString metadataPath(); %Docstring Returns the path to the metadata directory. .. versionadded:: 3.0 %End static QString qgisMasterDatabaseFilePath(); %Docstring Returns the path to the master qgis.db file. %End static QString qgisSettingsDirPath(); %Docstring Returns the path to the settings directory in user's home dir %End static QString qgisUserDatabaseFilePath(); %Docstring Returns the path to the user qgis.db file. %End static QString qgisAuthDatabaseFilePath(); %Docstring Returns the path to the user authentication database file: qgis-auth.db. %End static QString splashPath(); %Docstring Returns the path to the splash screen image directory. %End static QString iconsPath(); %Docstring Returns the path to the icons image directory. %End static QString srsDatabaseFilePath(); %Docstring Returns the path to the srs.db file. %End static QStringList svgPaths(); %Docstring Returns the paths to svg directories. %End static QStringList layoutTemplatePaths(); %Docstring Returns the paths to layout template directories. .. versionadded:: 3.0 %End static QMap systemEnvVars(); %Docstring Returns the system environment variables passed to application. %End static QString prefixPath(); %Docstring Returns the path to the application prefix directory. %End static QString pluginPath(); %Docstring Returns the path to the application plugin directory. %End static QString pkgDataPath(); %Docstring Returns the common root path of all application data directories. %End static QString activeThemePath(); %Docstring Returns the path to the currently active theme directory. %End static QString defaultThemePath(); %Docstring Returns the path to the default theme directory. %End static QString iconPath( const QString &iconFile ); %Docstring Returns path to the desired icon file. First it tries to use the active theme path, then default theme path %End static QIcon getThemeIcon( const QString &name ); %Docstring Helper to get a theme icon. It will fall back to the default theme if the active theme does not have the required icon. %End enum Cursor { ZoomIn, ZoomOut, Identify, CrossHair, CapturePoint, Select, Sampler, }; static QCursor getThemeCursor( Cursor cursor ); %Docstring 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. %End static QPixmap getThemePixmap( const QString &name ); %Docstring 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. %End static QString userStylePath(); %Docstring Returns the path to user's style. %End static QRegExp shortNameRegExp(); %Docstring Returns the short name regular expression for line edit validator %End static QString userLoginName(); %Docstring Returns the user's operating system login account name. .. seealso:: :py:func:`userFullName` .. versionadded:: 2.14 %End static QString userFullName(); %Docstring Returns the user's operating system login account full display name. .. seealso:: :py:func:`userLoginName` .. versionadded:: 2.14 %End static QString osName(); %Docstring Returns a string name of the operating system QGIS is running on. .. seealso:: :py:func:`platform` .. versionadded:: 2.14 %End static QString platform(); %Docstring Returns the QGIS platform name, e.g., "desktop" or "server". .. seealso:: :py:func:`osName` .. versionadded:: 2.14 %End static QString locale(); %Docstring Returns the QGIS locale. .. versionadded:: 3.0 %End static QString userThemesFolder(); %Docstring Returns the path to user's themes folder %End static QString defaultStylePath(); %Docstring Returns the path to default style (works as a starting point). %End static QString defaultThemesFolder(); %Docstring Returns the path to default themes folder from install (works as a starting point). %End static QString libraryPath(); %Docstring Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries %End static QString libexecPath(); %Docstring Returns the path with utility executables (help viewer, crssync, ...) %End static QString qmlImportPath(); %Docstring Returns the path where QML components are installed for QGIS Quick library. Returns empty string when QGIS is built without Quick support .. versionadded:: 3.2 %End static void setPrefixPath( const QString &prefixPath, bool useDefaultPaths = false ); %Docstring Alters prefix path - used by 3rd party apps %End static void setPluginPath( const QString &pluginPath ); %Docstring Alters plugin path - used by 3rd party apps %End static void setPkgDataPath( const QString &pkgDataPath ); %Docstring Alters pkg data path - used by 3rd party apps %End static void setDefaultSvgPaths( const QStringList &pathList ); %Docstring Alters default svg paths - used by 3rd party apps. %End static void setAuthDatabaseDirPath( const QString &authDbDirPath ); %Docstring Alters authentication data base directory path - used by 3rd party apps %End static void initQgis(); %Docstring loads providers %End static bool createDatabase( QString *errorMessage = 0 ); %Docstring initialize qgis.db %End static bool createThemeFolder(); %Docstring Create the users theme folder %End static void exitQgis(); %Docstring deletes provider registry and map layer registry %End static QString appIconPath(); %Docstring Gets application icon %End enum endian_t { XDR, NDR }; static endian_t endian(); %Docstring Returns whether this machine uses big or little endian %End static QString reportStyleSheet( const StyleSheetType &styleSheetType = StyleSheetType::Qt ); %Docstring 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