61 #include <QFileOpenEvent> 62 #include <QMessageBox> 67 #include <QThreadPool> 72 #include <netinet/in.h> 78 #define SECURITY_WIN32 80 #pragma comment( lib, "Secur32.lib" ) 83 #include "qgsconfig.h" 90 #define CONN_POOL_MAX_CONCURRENT_CONNS 4 92 QObject *
ABISYM( QgsApplication::mFileOpenEventReceiver );
93 QStringList
ABISYM( QgsApplication::mFileOpenEventList );
94 QString
ABISYM( QgsApplication::mPrefixPath );
95 QString
ABISYM( QgsApplication::mPluginPath );
96 QString
ABISYM( QgsApplication::mPkgDataPath );
97 QString
ABISYM( QgsApplication::mLibraryPath );
98 QString
ABISYM( QgsApplication::mLibexecPath );
99 QString
ABISYM( QgsApplication::mQmlImportPath );
100 QString
ABISYM( QgsApplication::mThemeName );
101 QString
ABISYM( QgsApplication::mUIThemeName );
102 QString
ABISYM( QgsApplication::mProfilePath );
104 QStringList
ABISYM( QgsApplication::mDefaultSvgPaths );
105 QMap<QString, QString>
ABISYM( QgsApplication::mSystemEnvVars );
106 QString
ABISYM( QgsApplication::mConfigPath );
108 bool ABISYM( QgsApplication::mInitialized ) =
false;
109 bool ABISYM( QgsApplication::mRunningFromBuildDir ) =
false;
110 QString
ABISYM( QgsApplication::mBuildSourcePath );
111 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 112 QString
ABISYM( QgsApplication::mCfgIntDir );
114 QString
ABISYM( QgsApplication::mBuildOutputPath );
115 QStringList
ABISYM( QgsApplication::mGdalSkipList );
116 int ABISYM( QgsApplication::mMaxThreads );
117 QString
ABISYM( QgsApplication::mAuthDbDirPath );
119 QString QgsApplication::sUserName;
120 QString QgsApplication::sUserFullName;
121 QString QgsApplication::sPlatformName = QStringLiteral(
"desktop" );
122 QString QgsApplication::sTranslation;
128 QgsApplication::ApplicationMembers *QgsApplication::sApplicationMembers =
nullptr;
132 : QApplication( argc, argv, GUIenabled )
134 sPlatformName = platformName;
136 if ( sTranslation != QLatin1String(
"C" ) )
138 mQgisTranslator =
new QTranslator();
139 if ( mQgisTranslator->load( QStringLiteral(
"qgis_" ) + sTranslation,
i18nPath() ) )
141 installTranslator( mQgisTranslator );
145 QgsDebugMsg( QStringLiteral(
"loading of qgis translation failed %1/qgis_%2" ).arg(
i18nPath(), sTranslation ) );
153 mQtTranslator =
new QTranslator();
154 if ( mQtTranslator->load( QStringLiteral(
"qt_" ) + sTranslation, QLibraryInfo::location( QLibraryInfo::TranslationsPath ) ) )
156 installTranslator( mQtTranslator );
160 QgsDebugMsg( QStringLiteral(
"loading of qt translation failed %1/qt_%2" ).arg( QLibraryInfo::location( QLibraryInfo::TranslationsPath ), sTranslation ) );
164 mApplicationMembers =
new ApplicationMembers();
166 ABISYM( mProfilePath ) = profileFolder;
171 if ( profileFolder.isEmpty() )
173 if ( getenv(
"QGIS_CUSTOM_CONFIG_PATH" ) )
175 profileFolder = getenv(
"QGIS_CUSTOM_CONFIG_PATH" );
179 profileFolder = QStandardPaths::standardLocations( QStandardPaths::AppDataLocation ).value( 0 );
186 profileFolder = profile->
folder();
190 ABISYM( mProfilePath ) = profileFolder;
192 qRegisterMetaType<QgsGeometry::Error>(
"QgsGeometry::Error" );
193 qRegisterMetaType<QgsProcessingFeatureSourceDefinition>(
"QgsProcessingFeatureSourceDefinition" );
194 qRegisterMetaType<QgsProcessingOutputLayerDefinition>(
"QgsProcessingOutputLayerDefinition" );
195 qRegisterMetaType<QgsUnitTypes::LayoutUnit>(
"QgsUnitTypes::LayoutUnit" );
196 qRegisterMetaType<QgsFeatureId>(
"QgsFeatureId" );
197 qRegisterMetaType<QgsFeatureIds>(
"QgsFeatureIds" );
198 qRegisterMetaType<QgsProperty>(
"QgsProperty" );
199 qRegisterMetaType<Qgis::MessageLevel>(
"Qgis::MessageLevel" );
200 qRegisterMetaType<QgsReferencedRectangle>(
"QgsReferencedRectangle" );
201 qRegisterMetaType<QgsReferencedPointXY>(
"QgsReferencedPointXY" );
202 qRegisterMetaType<QgsLayoutRenderContext::Flags>(
"QgsLayoutRenderContext::Flags" );
203 qRegisterMetaType<QgsStyle::StyleEntity>(
"QgsStyle::StyleEntity" );
204 qRegisterMetaType<QgsCoordinateReferenceSystem>(
"QgsCoordinateReferenceSystem" );
205 qRegisterMetaType<QgsAuthManager::MessageLevel>(
"QgsAuthManager::MessageLevel" );
209 if ( ABISYM( mRunningFromBuildDir ) )
212 ABISYM( mPrefixPath ) = QString();
213 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 214 setPluginPath( ABISYM( mBuildOutputPath ) +
'/' + QString( QGIS_PLUGIN_SUBDIR ) +
'/' + ABISYM( mCfgIntDir ) );
216 setPluginPath( ABISYM( mBuildOutputPath ) +
'/' + QStringLiteral( QGIS_PLUGIN_SUBDIR ) );
219 ABISYM( mLibraryPath ) = ABISYM( mBuildOutputPath ) +
'/' + QGIS_LIB_SUBDIR +
'/';
220 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 221 ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) +
'/' + QGIS_LIBEXEC_SUBDIR +
'/' + ABISYM( mCfgIntDir ) +
'/';
223 ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) +
'/' + QGIS_LIBEXEC_SUBDIR +
'/';
225 #if defined( HAVE_QUICK ) 226 ABISYM( mQmlImportPath ) = ABISYM( mBuildOutputPath ) +
'/' + QGIS_QML_SUBDIR +
'/';
231 char *
prefixPath = getenv(
"QGIS_PREFIX_PATH" );
234 if ( ABISYM( mPrefixPath ).isNull() )
236 #if defined(Q_OS_MACX) || defined(Q_OS_WIN) 238 #elif defined(ANDROID) 240 QDir myDir( QDir::homePath() );
242 QString myPrefix = myDir.absolutePath();
245 QDir myDir( applicationDirPath() );
247 if ( applicationDirPath().contains( QStringLiteral(
"cgi-bin" ) ) )
252 QString myPrefix = myDir.absolutePath();
263 ABISYM( mConfigPath ) = profileFolder +
'/';
267 if ( getenv(
"QGIS_AUTH_DB_DIR_PATH" ) )
273 QMap<QString, QString> systemEnvVarMap;
274 QString passfile( QStringLiteral(
"QGIS_AUTH_PASSWORD_FILE" ) );
275 Q_FOREACH (
const QString &varStr, QProcess::systemEnvironment() )
277 int pos = varStr.indexOf( QLatin1Char(
'=' ) );
280 QString varStrName = varStr.left( pos );
281 QString varStrValue = varStr.mid( pos + 1 );
282 if ( varStrName != passfile )
284 systemEnvVarMap.insert( varStrName, varStrValue );
287 ABISYM( mSystemEnvVars ) = systemEnvVarMap;
290 QCoreApplication::addLibraryPath(
pluginPath() );
295 ABISYM( mMaxThreads ) = -1;
300 ABISYM( mInitialized ) =
true;
305 delete mDataItemProviderRegistry;
306 delete mApplicationMembers;
307 delete mQgisTranslator;
308 delete mQtTranslator;
316 void QgsApplication::invalidateCaches()
328 return qobject_cast<
QgsApplication *>( QCoreApplication::instance() );
334 if ( event->type() == QEvent::FileOpen )
337 if ( ABISYM( mFileOpenEventReceiver ) )
340 done =
notify( ABISYM( mFileOpenEventReceiver ), event );
347 ABISYM( mFileOpenEventList ).append( static_cast<QFileOpenEvent *>( event )->file() );
354 done = QApplication::event( event );
363 if ( thread() == receiver->thread() )
364 emit
preNotify( receiver, event, &done );
373 done = QApplication::notify( receiver, event );
378 if ( qApp->thread() == QThread::currentThread() )
379 QMessageBox::critical( activeWindow(), tr(
"Exception" ), e.
what() );
381 catch ( std::exception &e )
383 QgsDebugMsg(
"Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
384 if ( qApp->thread() == QThread::currentThread() )
385 QMessageBox::critical( activeWindow(), tr(
"Exception" ), e.what() );
389 QgsDebugMsg( QStringLiteral(
"Caught unhandled unknown exception" ) );
390 if ( qApp->thread() == QThread::currentThread() )
391 QMessageBox::critical( activeWindow(), tr(
"Exception" ), tr(
"unknown exception" ) );
399 return members()->mProfiler;
405 ABISYM( mFileOpenEventReceiver ) = receiver;
407 if ( ABISYM( mFileOpenEventList ).count() > 0 )
409 QStringListIterator i( ABISYM( mFileOpenEventList ) );
410 while ( i.hasNext() )
412 QFileOpenEvent foe( i.next() );
413 QgsApplication::sendEvent( ABISYM( mFileOpenEventReceiver ), &foe );
415 ABISYM( mFileOpenEventList ).clear();
422 #if defined(_MSC_VER) 423 if ( ABISYM( mPrefixPath ).endsWith(
"/bin" ) )
425 ABISYM( mPrefixPath ).chop( 4 );
428 if ( useDefaultPaths && !ABISYM( mRunningFromBuildDir ) )
430 setPluginPath( ABISYM( mPrefixPath ) +
'/' + QStringLiteral( QGIS_PLUGIN_SUBDIR ) );
431 setPkgDataPath( ABISYM( mPrefixPath ) +
'/' + QStringLiteral( QGIS_DATA_SUBDIR ) );
433 ABISYM( mLibraryPath ) = ABISYM( mPrefixPath ) +
'/' + QGIS_LIB_SUBDIR +
'/';
434 ABISYM( mLibexecPath ) = ABISYM( mPrefixPath ) +
'/' + QGIS_LIBEXEC_SUBDIR +
'/';
435 #if defined( HAVE_QUICK ) 436 ABISYM( mQmlImportPath ) = ABISYM( mPrefixPath ) +
'/' + QGIS_QML_SUBDIR +
'/';
448 QString mySvgPath = pkgDataPath + ( ABISYM( mRunningFromBuildDir ) ?
"/images/svg/" :
"/svg/" );
450 if ( !ABISYM( mDefaultSvgPaths ).contains( mySvgPath ) )
451 ABISYM( mDefaultSvgPaths ) << mySvgPath;
456 ABISYM( mDefaultSvgPaths ) = pathList;
461 QFileInfo fi( authDbDirPath );
462 if ( fi.exists() && fi.isDir() && fi.isWritable() )
464 ABISYM( mAuthDbDirPath ) = fi.canonicalFilePath() + QDir::separator();
470 if ( ABISYM( mRunningFromBuildDir ) )
472 static bool sOnce =
true;
476 ( void ) blockNotifications;
477 qWarning(
"!!! prefix path was requested, but it is not valid - we do not run from installed path !!!" );
482 return ABISYM( mPrefixPath );
486 return ABISYM( mPluginPath );
490 if ( ABISYM( mPkgDataPath ).isNull() )
493 return ABISYM( mPkgDataPath );
497 return QStringLiteral(
":/images/themes/default/" );
502 QDir dir( usersThemes );
510 return defaultThemes;
516 return iconsPath() + QStringLiteral(
"qgis-icon-60x60.png" );
523 if ( QFile::exists( path + iconFile ) )
524 return path + iconFile;
533 if ( app && app->mIconCache.contains( name ) )
534 return app->mIconCache.value( name );
538 QString myPreferredPath =
activeThemePath() + QDir::separator() + name;
540 if ( QFile::exists( myPreferredPath ) )
542 icon = QIcon( myPreferredPath );
544 else if ( QFile::exists( myDefaultPath ) )
548 icon = QIcon( myDefaultPath );
556 app->mIconCache.insert( name, icon );
563 if ( app && app->mCursorCache.contains( cursor ) )
564 return app->mCursorCache.value( cursor );
575 name = QStringLiteral(
"mZoomIn.svg" );
580 name = QStringLiteral(
"mZoomOut.svg" );
587 name = QStringLiteral(
"mIdentify.svg" );
590 name = QStringLiteral(
"mCrossHair.svg" );
593 name = QStringLiteral(
"mCapturePoint.svg" );
596 name = QStringLiteral(
"mSelect.svg" );
603 name = QStringLiteral(
"mSampler.svg" );
608 Q_ASSERT( ! name.isEmpty( ) );
610 QIcon icon =
getThemeIcon( QStringLiteral(
"cursors" ) + QDir::separator() + name );
613 if ( ! icon.isNull( ) )
617 cursorIcon = QCursor( icon.pixmap( std::ceil( scale * 32 ), std::ceil( scale * 32 ) ), std::ceil( scale * activeX ), std::ceil( scale * activeY ) );
620 app->mCursorCache.insert( cursor, cursorIcon );
627 QString myPreferredPath =
activeThemePath() + QDir::separator() + name;
629 if ( QFile::exists( myPreferredPath ) )
631 return QPixmap( myPreferredPath );
637 return QPixmap( myDefaultPath );
648 static QString appPath;
649 if ( appPath.isNull() )
651 if ( QCoreApplication::instance() )
653 appPath = applicationDirPath();
657 qWarning(
"Application path not initialized" );
661 if ( !appPath.isNull() || getenv(
"QGIS_PREFIX_PATH" ) )
663 QString prefix = getenv(
"QGIS_PREFIX_PATH" ) ? getenv(
"QGIS_PREFIX_PATH" ) : appPath;
668 Q_FOREACH (
const QString &path, QStringList() <<
"" <<
"/.." <<
"/bin" <<
"/../../.." )
670 f.setFileName( prefix + path +
"/qgisbuildpath.txt" );
674 if ( f.exists() && f.open( QIODevice::ReadOnly ) )
676 ABISYM( mRunningFromBuildDir ) =
true;
677 ABISYM( mBuildSourcePath ) = f.readLine().trimmed();
678 ABISYM( mBuildOutputPath ) = f.readLine().trimmed();
680 QgsDebugMsgLevel( QStringLiteral(
"- source directory: %1" ).arg( ABISYM( mBuildSourcePath ).toUtf8().constData() ), 4 );
681 QgsDebugMsgLevel( QStringLiteral(
"- output directory of the build: %1" ).arg( ABISYM( mBuildOutputPath ).toUtf8().constData() ), 4 );
682 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 683 ABISYM( mCfgIntDir ) = appPath.split(
'/', QString::SkipEmptyParts ).last();
684 qDebug(
"- cfg: %s", ABISYM( mCfgIntDir ).toUtf8().constData() );
690 if ( getenv(
"QGIS_PREFIX_PATH" ) )
691 prefixPath = getenv(
"QGIS_PREFIX_PATH" );
696 QDir dir( QDir::homePath() );
698 prefixPath = dir.absolutePath();
701 #if defined(Q_OS_MACX) || defined(Q_OS_WIN) 702 prefixPath = appPath;
703 #if defined(_MSC_VER) 704 if ( prefixPath.endsWith(
"/bin" ) )
705 prefixPath.chop( 4 );
710 if ( appPath.contains( QStringLiteral(
"cgi-bin" ) ) )
715 prefixPath = dir.absolutePath();
720 if ( ABISYM( mRunningFromBuildDir ) )
721 return ABISYM( mBuildSourcePath );
723 return prefixPath +
'/' + QStringLiteral( QGIS_DATA_SUBDIR );
728 return ABISYM( mThemeName );
735 if ( themeName == QStringLiteral(
"default" ) || !themes.contains( themeName ) )
738 qApp->setStyleSheet( QString() );
742 QString path = themes.value( themeName );
743 QString stylesheetname = path +
"/style.qss";
745 QFile file( stylesheetname );
746 QFile variablesfile( path +
"/variables.qss" );
748 QFileInfo variableInfo( variablesfile );
750 if ( !file.open( QIODevice::ReadOnly ) || ( variableInfo.exists() && !variablesfile.open( QIODevice::ReadOnly ) ) )
755 QString styledata = file.readAll();
756 styledata.replace( QStringLiteral(
"@theme_path" ), path );
758 if ( variableInfo.exists() )
760 QTextStream in( &variablesfile );
761 while ( !in.atEnd() )
763 QString line = in.readLine();
765 if ( line.startsWith(
'@' ) )
767 int index = line.indexOf(
':' );
768 QString name = line.mid( 0, index );
769 QString value = line.mid( index + 1, line.length() );
770 styledata.replace( name, value );
773 variablesfile.close();
781 QRegularExpression regex( QStringLiteral(
"(?<=[\\s:])([0-9\\.]+)(?=em)" ) );
782 QRegularExpressionMatch match = regex.match( styledata, index );
783 while ( match.hasMatch() )
785 index = match.capturedStart();
786 styledata.remove( index, match.captured( 0 ).length() );
788 styledata.insert( index, number );
789 index += number.length();
790 match = regex.match( styledata, index );
794 qApp->setStyleSheet( styledata );
796 QFile palettefile( path +
"/palette.txt" );
797 QFileInfo paletteInfo( palettefile );
798 if ( paletteInfo.exists() && palettefile.open( QIODevice::ReadOnly ) )
800 QPalette
pal = qApp->palette();
801 QTextStream in( &palettefile );
802 while ( !in.atEnd() )
804 QString line = in.readLine();
805 QStringList parts = line.split(
':' );
806 if ( parts.count() == 2 )
808 int role = parts.at( 0 ).trimmed().toInt();
810 pal.setColor( static_cast< QPalette::ColorRole >( role ), color );
814 qApp->setPalette( pal );
823 QHash<QString, QString> mapping;
824 mapping.insert( QStringLiteral(
"default" ), QString() );
825 Q_FOREACH (
const QString &path, paths )
828 QFileInfoList styleFiles = folder.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
829 Q_FOREACH (
const QFileInfo &info, styleFiles )
831 QFileInfo styleFile( info.absoluteFilePath() +
"/style.qss" );
832 if ( !styleFile.exists() )
835 QString name = info.baseName();
836 QString path = info.absoluteFilePath();
837 mapping.insert( name, path );
845 return pkgDataPath() + QStringLiteral(
"/doc/AUTHORS" );
850 return pkgDataPath() + QStringLiteral(
"/doc/CONTRIBUTORS" );
854 return pkgDataPath() + QStringLiteral(
"/doc/developersmap.html" );
859 return pkgDataPath() + QStringLiteral(
"/doc/SPONSORS" );
864 return pkgDataPath() + QStringLiteral(
"/doc/DONORS" );
869 return pkgDataPath() + QStringLiteral(
"/doc/TRANSLATORS" );
874 return pkgDataPath() + QStringLiteral(
"/doc/LICENSE" );
879 if ( ABISYM( mRunningFromBuildDir ) )
880 return ABISYM( mBuildOutputPath ) + QStringLiteral(
"/i18n/" );
887 return pkgDataPath() + QStringLiteral(
"/resources/metadata-ISO/" );
892 return pkgDataPath() + QStringLiteral(
"/resources/qgis.db" );
897 return ABISYM( mConfigPath );
907 return ABISYM( mAuthDbDirPath ) + QStringLiteral(
"qgis-auth.db" );
912 return QStringLiteral(
":/images/splash/" );
917 return pkgDataPath() + QStringLiteral(
"/images/icons/" );
922 if ( ABISYM( mRunningFromBuildDir ) )
924 QString tempCopy = QDir::tempPath() +
"/srs.db";
926 if ( !QFile( tempCopy ).exists() )
929 if ( !f.copy( tempCopy ) )
931 qFatal(
"Could not create temporary copy" );
939 return pkgDataPath() + QStringLiteral(
"/resources/srs.db" );
948 QStringList pathList = settings.
value( QStringLiteral(
"svg/searchPathsForSVG" ) ).toStringList();
952 Q_FOREACH (
const QString &path, pathList )
954 if ( !paths.contains( path ) )
955 paths.append( path );
957 Q_FOREACH (
const QString &path, ABISYM( mDefaultSvgPaths ) )
959 if ( !paths.contains( path ) )
960 paths.append( path );
971 QStringList pathList = settings.
value( QStringLiteral(
"Layout/searchPathsForTemplates" ), QVariant(),
QgsSettings::Core ).toStringList();
983 return QRegExp(
"^[A-Za-z][A-Za-z0-9\\._-]*" );
988 if ( !sUserName.isEmpty() )
992 TCHAR name [ UNLEN + 1 ];
993 DWORD size = UNLEN + 1;
995 if ( GetUserName( ( TCHAR * )name, &size ) )
997 sUserName = QString::fromLocal8Bit( name );
1003 process.start( QStringLiteral(
"whoami" ) );
1004 process.waitForFinished();
1005 sUserName = process.readAllStandardOutput().trimmed();
1008 if ( !sUserName.isEmpty() )
1012 sUserName = qgetenv(
"USER" );
1013 if ( !sUserName.isEmpty() )
1017 sUserName = qgetenv(
"USERNAME" );
1023 if ( !sUserFullName.isEmpty() )
1024 return sUserFullName;
1027 TCHAR name [ UNLEN + 1 ];
1028 DWORD size = UNLEN + 1;
1031 if ( GetUserNameEx( NameDisplay, ( TCHAR * )name, &size ) )
1033 sUserFullName = QString::fromLocal8Bit( name );
1037 if ( sUserFullName.isEmpty() )
1039 #elif defined(Q_OS_ANDROID) || defined(__MINGW32__) 1040 sUserFullName =
"Not available";
1042 struct passwd *p = getpwuid( getuid() );
1046 QString gecosName = QString( p->pw_gecos );
1047 sUserFullName = gecosName.left( gecosName.indexOf(
',', 0 ) );
1052 return sUserFullName;
1057 #if defined(Q_OS_ANDROID) 1058 return QLatin1String(
"android" );
1059 #elif defined(Q_OS_MAC) 1060 return QLatin1String(
"osx" );
1061 #elif defined(Q_OS_WIN) 1062 return QLatin1String(
"windows" );
1063 #elif defined(Q_OS_LINUX) 1064 return QStringLiteral(
"linux" );
1065 #elif defined(Q_OS_FREEBSD) 1066 return QStringLiteral(
"freebsd" );
1067 #elif defined(Q_OS_OPENBSD) 1068 return QStringLiteral(
"openbsd" );
1069 #elif defined(Q_OS_NETBSD) 1070 return QStringLiteral(
"netbsd" );
1071 #elif defined(Q_OS_UNIX) 1072 return QLatin1String(
"unix" );
1074 return QLatin1String(
"unknown" );
1080 return sPlatformName;
1086 bool overrideLocale = settings.
value( QStringLiteral(
"locale/overrideFlag" ),
false ).toBool();
1087 if ( overrideLocale )
1089 QString
locale = settings.
value( QStringLiteral(
"locale/userLocale" ), QString() ).toString();
1091 if ( locale.startsWith( QLatin1String(
"en" ), Qt::CaseInsensitive ) )
1093 return locale.left( 2 );
1100 return QLocale().name().left( 2 );
1111 return pkgDataPath() + QStringLiteral(
"/resources/symbology-style.xml" );
1116 return pkgDataPath() + QStringLiteral(
"/resources/themes" );
1121 return pkgDataPath() + QStringLiteral(
"/resources/server/" );
1126 return ABISYM( mLibraryPath );
1131 return ABISYM( mLibexecPath );
1136 return ABISYM( mQmlImportPath );
1141 return ( htonl( 1 ) == 1 ) ?
XDR :
NDR;
1185 if ( !sAuthManager )
1187 return sAuthManager;
1198 delete sAuthManager;
1203 QgsApplication::sendPostedEvents(
nullptr, QEvent::DeferredDelete );
1218 GDALDestroyDriverManager();
1223 QString myEnvironmentVar( getenv(
"QGIS_PREFIX_PATH" ) );
1224 QString myState = tr(
"Application state:\n" 1225 "QGIS_PREFIX_PATH env var:\t\t%1\n" 1227 "Plugin Path:\t\t%3\n" 1228 "Package Data Path:\t%4\n" 1229 "Active Theme Name:\t%5\n" 1230 "Active Theme Path:\t%6\n" 1231 "Default Theme Path:\t%7\n" 1232 "SVG Search Paths:\t%8\n" 1233 "User DB Path:\t%9\n" 1234 "Auth DB Path:\t%10\n" )
1235 .arg( myEnvironmentVar,
1242 svgPaths().join( tr(
"\n\t\t",
"match indentation of application state" ) ),
1255 QColor myColor1( Qt::lightGray );
1256 QColor myColor2 = myColor1;
1257 myColor2 = myColor2.lighter( 110 );
1259 myStyle =
".overview{" 1261 " font-weight: bold;" 1264 " background: white;" 1266 " font-family: 'Lato', 'Ubuntu', 'Lucida Grande', 'Segoe UI', 'Arial', sans-serif;" 1269 "h1{ background-color: #F6F6F6;" 1271 " font-size: x-large; " 1272 " font-weight: normal;" 1273 " background: none;" 1274 " padding: 0.75em 0 0;" 1276 " line-height: 3em;" 1278 "h2{ background-color: #F6F6F6;" 1280 " font-size: medium; " 1281 " font-weight: normal;" 1282 " background: none;" 1283 " padding: 0.75em 0 0;" 1285 " line-height: 1.1em;" 1287 "h3{ background-color: #F6F6F6;" 1289 " font-weight: bold;" 1290 " font-size: large;" 1291 " text-align: right;" 1292 " border-bottom: 5px solid #DCEB5C;" 1294 "h4{ background-color: #F6F6F6;" 1296 " font-weight: bold;" 1297 " font-size: medium;" 1298 " text-align: right;" 1300 "h5{ background-color: #F6F6F6;" 1302 " font-weight: bold;" 1303 " font-size: small;" 1304 " text-align: right;" 1306 "a{ color: #729FCF;" 1307 " font-family: arial,sans-serif;" 1309 "label{ background-color: #FFFFCC;" 1310 " border: 1px solid black;" 1312 " padding: 0px 3px; " 1313 " font-size: small;" 1316 " font-weight: bold;" 1317 " padding-top:25px;" 1319 ".list-view .highlight {" 1320 " text-align: right;" 1323 " padding-right: 15px;" 1324 " padding-left: 20px;" 1325 " font-weight: bold;" 1328 " font-weight: bold;" 1331 " border-collapse: collapse;" 1334 ".tabular-view th, .tabular-view td { " 1335 " border:10px solid black;" 1337 ".tabular-view .odd-row{" 1338 " background-color: #f9f9f9;" 1343 " border-top: 1px solid black;" 1350 if ( 0 >= OGRGetDriverCount() )
1358 QString aPathUrl = aPath;
1359 QString tPathUrl = targetPath;
1360 #if defined( Q_OS_WIN ) 1361 const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
1363 aPathUrl.replace(
'\\',
'/' );
1364 if ( aPathUrl.startsWith(
"//" ) )
1367 aPathUrl =
"\\\\" + aPathUrl.mid( 2 );
1370 tPathUrl.replace(
'\\',
'/' );
1371 if ( tPathUrl.startsWith(
"//" ) )
1374 tPathUrl =
"\\\\" + tPathUrl.mid( 2 );
1377 const Qt::CaseSensitivity cs = Qt::CaseSensitive;
1380 QStringList targetElems = tPathUrl.split(
'/', QString::SkipEmptyParts );
1381 QStringList aPathElems = aPathUrl.split(
'/', QString::SkipEmptyParts );
1383 targetElems.removeAll( QStringLiteral(
"." ) );
1384 aPathElems.removeAll( QStringLiteral(
"." ) );
1388 while ( !aPathElems.isEmpty() &&
1389 !targetElems.isEmpty() &&
1390 aPathElems[0].compare( targetElems[0], cs ) == 0 )
1392 aPathElems.removeFirst();
1393 targetElems.removeFirst();
1403 if ( !targetElems.isEmpty() )
1406 for (
int i = 0; i < targetElems.size(); i++ )
1408 aPathElems.insert( 0, QStringLiteral(
".." ) );
1415 aPathElems.insert( 0, QStringLiteral(
"." ) );
1418 return aPathElems.join( QStringLiteral(
"/" ) );
1424 if ( !rpath.startsWith( QLatin1String(
"./" ) ) && !rpath.startsWith( QLatin1String(
"../" ) ) )
1429 QString rPathUrl = rpath;
1430 QString targetPathUrl = targetPath;
1432 #if defined(Q_OS_WIN) 1433 rPathUrl.replace(
'\\',
'/' );
1434 targetPathUrl.replace(
'\\',
'/' );
1436 bool uncPath = targetPathUrl.startsWith(
"//" );
1439 QStringList srcElems = rPathUrl.split(
'/', QString::SkipEmptyParts );
1440 QStringList targetElems = targetPathUrl.split(
'/', QString::SkipEmptyParts );
1442 #if defined(Q_OS_WIN) 1445 targetElems.insert( 0,
"" );
1446 targetElems.insert( 0,
"" );
1451 targetElems << srcElems;
1452 targetElems.removeAll( QStringLiteral(
"." ) );
1456 while ( ( pos = targetElems.indexOf( QStringLiteral(
".." ) ) ) > 0 )
1459 targetElems.removeAt( pos - 1 );
1460 targetElems.removeAt( pos - 1 );
1463 #if !defined(Q_OS_WIN) 1465 targetElems.prepend( QString() );
1468 return targetElems.join( QStringLiteral(
"/" ) );
1473 if (
ABISYM( mGdalSkipList ).contains( driver ) || driver.isEmpty() )
1477 ABISYM( mGdalSkipList ) << driver;
1483 if ( !
ABISYM( mGdalSkipList ).contains( driver ) )
1487 int myPos =
ABISYM( mGdalSkipList ).indexOf( driver );
1490 ABISYM( mGdalSkipList ).removeAt( myPos );
1497 ABISYM( mGdalSkipList ).removeDuplicates();
1498 QString myDriverList =
ABISYM( mGdalSkipList ).join( QStringLiteral(
" " ) );
1499 QgsDebugMsg( QStringLiteral(
"Gdal Skipped driver list set to:" ) );
1501 CPLSetConfigOption(
"GDAL_SKIP", myDriverList.toUtf8() );
1508 QDir myDir( folder );
1509 if ( !myDir.exists() )
1511 myDir.mkpath( folder );
1517 void QgsApplication::copyPath(
const QString &src,
const QString &dst )
1520 if ( ! dir.exists() )
1523 Q_FOREACH (
const QString &d, dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
1525 QString dst_path = dst + QDir::separator() + d;
1526 dir.mkpath( dst_path );
1527 copyPath( src + QDir::separator() + d, dst_path );
1530 Q_FOREACH (
const QString &f, dir.entryList( QDir::Files ) )
1532 QFile::copy( src + QDir::separator() + f, dst + QDir::separator() + f );
1541 QVariantMap variables;
1545 QStringList childKeys = settings.
childKeys();
1546 for ( QStringList::const_iterator it = childKeys.constBegin(); it != childKeys.constEnd(); ++it )
1549 variables.insert( name, settings.
value( name ) );
1559 QVariantMap::const_iterator it = variables.constBegin();
1562 for ( ; it != variables.constEnd(); ++it )
1564 settings.
setValue( it.key(), it.value() );
1575 settings.
setValue( QStringLiteral(
"variables/" ) + name, value );
1592 ApplicationMembers *appMembers = members();
1593 if ( appMembers->mNullRepresentation.isNull() )
1595 appMembers->mNullRepresentation =
QgsSettings().
value( QStringLiteral(
"qgis/nullValue" ), QStringLiteral(
"NULL" ) ).toString();
1597 return appMembers->mNullRepresentation;
1602 ApplicationMembers *appMembers = members();
1603 if ( !appMembers || appMembers->mNullRepresentation == nullRepresentation )
1616 return members()->mActionScopeRegistry;
1625 QDir myDir( myPamPath );
1626 if ( !myDir.exists() )
1628 myDir.mkpath( myPamPath );
1631 #if defined(Q_OS_WIN) 1632 CPLSetConfigOption(
"GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
1636 int myChangeFlag = 0;
1637 setenv(
"GDAL_PAM_PROXY_DIR", myPamPath.toUtf8(), myChangeFlag );
1644 if ( !qgisPrivateDbFile.exists() )
1648 QFile masterFile( qgisMasterDbFileName );
1654 bool isDbFileCopied = masterFile.copy( qgisPrivateDbFile.fileName() );
1656 if ( !isDbFileCopied )
1660 *errorMessage = tr(
"[ERROR] Can not make qgis.db private copy" );
1665 QFile::Permissions perms = QFile( qgisPrivateDbFile.fileName() ).permissions();
1666 if ( !( perms & QFile::WriteOwner ) )
1668 if ( !qgisPrivateDbFile.setPermissions( perms | QFile::WriteOwner ) )
1672 *errorMessage = tr(
"Can not make '%1' user writable" ).arg( qgisPrivateDbFile.fileName() );
1686 *errorMessage = tr(
"Could not open qgis.db" );
1691 char *errmsg =
nullptr;
1692 int res = sqlite3_exec( database.get(),
"SELECT srs_id FROM tbl_srs LIMIT 0",
nullptr,
nullptr, &errmsg );
1693 if ( res != SQLITE_OK )
1695 sqlite3_free( errmsg );
1698 if ( sqlite3_exec( database.get(),
1699 "CREATE TABLE tbl_srs (" 1700 "srs_id INTEGER PRIMARY KEY," 1701 "description text NOT NULL," 1702 "projection_acronym text NOT NULL," 1703 "ellipsoid_acronym NOT NULL," 1704 "parameters text NOT NULL," 1706 "auth_name varchar," 1708 "is_geo integer NOT NULL," 1709 "deprecated boolean);" 1710 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
1714 *errorMessage = tr(
"Creation of missing tbl_srs in the private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
1716 sqlite3_free( errmsg );
1721 res = sqlite3_exec( database.get(),
"SELECT acronym FROM tbl_projection LIMIT 0",
nullptr,
nullptr, &errmsg );
1722 if ( res != SQLITE_OK )
1724 sqlite3_free( errmsg );
1727 if ( sqlite3_exec( database.get(),
1728 "CREATE TABLE tbl_projection (" 1729 "acronym varchar(20) NOT NULL PRIMARY KEY," 1730 "name varchar(255) NOT NULL default ''," 1731 "notes varchar(255) NOT NULL default ''," 1732 "parameters varchar(255) NOT NULL default ''" 1733 ")",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
1737 *errorMessage = tr(
"Creation of missing tbl_projection in the private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
1739 sqlite3_free( errmsg );
1744 res = sqlite3_exec( database.get(),
"SELECT epsg FROM tbl_srs LIMIT 0",
nullptr,
nullptr, &errmsg );
1745 if ( res == SQLITE_OK )
1748 if ( sqlite3_exec( database.get(),
1749 "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;" 1750 "CREATE TABLE tbl_srs (" 1751 "srs_id INTEGER PRIMARY KEY," 1752 "description text NOT NULL," 1753 "projection_acronym text NOT NULL," 1754 "ellipsoid_acronym NOT NULL," 1755 "parameters text NOT NULL," 1757 "auth_name varchar," 1759 "is_geo integer NOT NULL," 1760 "deprecated boolean);" 1761 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);" 1762 "INSERT INTO tbl_srs(srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) SELECT srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,'','',is_geo,0 FROM tbl_srs_bak;" 1763 "DROP TABLE tbl_srs_bak",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
1767 *errorMessage = tr(
"Migration of private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
1769 sqlite3_free( errmsg );
1775 sqlite3_free( errmsg );
1778 if ( sqlite3_exec( database.get(),
"DROP VIEW vw_srs",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
1780 QgsDebugMsg( QStringLiteral(
"vw_srs didn't exists in private qgis.db: %1" ).arg( errmsg ) );
1783 if ( sqlite3_exec( database.get(),
1784 "CREATE VIEW vw_srs AS" 1786 " a.description AS description" 1787 ",a.srs_id AS srs_id" 1788 ",a.is_geo AS is_geo" 1789 ",coalesce(b.name,a.projection_acronym) AS name" 1790 ",a.parameters AS parameters" 1791 ",a.auth_name AS auth_name" 1792 ",a.auth_id AS auth_id" 1793 ",a.deprecated AS deprecated" 1795 " LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym" 1796 " ORDER BY coalesce(b.name,a.projection_acronym),a.description",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
1800 *errorMessage = tr(
"Update of view in private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
1802 sqlite3_free( errmsg );
1811 QgsDebugMsg( QStringLiteral(
"maxThreads: %1" ).arg( maxThreads ) );
1815 if ( maxThreads < 1 || maxThreads > QThread::idealThreadCount() )
1822 if ( maxThreads == -1 )
1823 maxThreads = QThread::idealThreadCount();
1826 QThreadPool::globalInstance()->setMaxThreadCount( maxThreads );
1827 QgsDebugMsg( QStringLiteral(
"set QThreadPool max thread count to %1" ).arg( QThreadPool::globalInstance()->maxThreadCount() ) );
1832 return members()->mTaskManager;
1837 return members()->mColorSchemeRegistry;
1842 return members()->mPaintEffectRegistry;
1847 return members()->mRendererRegistry;
1852 return members()->mRasterRendererRegistry;
1859 if ( !
instance()->mDataItemProviderRegistry )
1863 return instance()->mDataItemProviderRegistry;
1869 if ( !sDataItemProviderRegistry )
1871 return sDataItemProviderRegistry;
1877 return members()->mSvgCache;
1882 return members()->mNetworkContentFetcherRegistry;
1887 return members()->mSymbolLayerRegistry;
1892 return members()->mLayoutItemRegistry;
1897 return members()->mGpsConnectionRegistry;
1902 return members()->mPluginLayerRegistry;
1907 return members()->mMessageLog;
1912 return members()->mProcessingRegistry;
1917 return members()->mPageSizeRegistry;
1922 return members()->mAnnotationRegistry;
1927 return members()->mFieldFormatterRegistry;
1932 return members()->m3DRendererRegistry;
1937 return members()->mProjectStorageRegistry;
1940 QgsApplication::ApplicationMembers::ApplicationMembers()
1960 mLayoutItemRegistry->populate();
1961 mAnnotationRegistry =
new QgsAnnotationRegistry();
1967 QgsApplication::ApplicationMembers::~ApplicationMembers()
1969 delete mActionScopeRegistry;
1970 delete m3DRendererRegistry;
1971 delete mAnnotationRegistry;
1972 delete mColorSchemeRegistry;
1973 delete mFieldFormatterRegistry;
1974 delete mGpsConnectionRegistry;
1976 delete mPaintEffectRegistry;
1977 delete mPluginLayerRegistry;
1978 delete mProcessingRegistry;
1979 delete mProjectStorageRegistry;
1980 delete mPageSizeRegistry;
1981 delete mLayoutItemRegistry;
1983 delete mRasterRendererRegistry;
1984 delete mRendererRegistry;
1986 delete mSymbolLayerRegistry;
1987 delete mTaskManager;
1988 delete mNetworkContentFetcherRegistry;
1991 QgsApplication::ApplicationMembers *QgsApplication::members()
1995 return instance()->mApplicationMembers;
1999 static QMutex sMemberMutex( QMutex::Recursive );
2000 QMutexLocker lock( &sMemberMutex );
2001 if ( !sApplicationMembers )
2002 sApplicationMembers =
new ApplicationMembers();
2003 return sApplicationMembers;
static QStringList layoutTemplatePaths()
Returns the paths to layout template directories.
Singleton offering an interface to manage the authentication configuration database and to utilize co...
QgsApplication(int &argc, char **argv, bool GUIenabled, const QString &profileFolder=QString(), const QString &platformName="desktop")
static QString locale()
Returns the QGIS locale.
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers. ...
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
This class keeps a list of data item providers that may add items to the browser tree.
static void setThemeName(const QString &themeName)
Set the active theme to the specified theme.
void addDefaultSchemes()
Adds all default color schemes to this color scheme.
static Qgs3DRendererRegistry * renderer3DRegistry()
Returns registry of available 3D renderers.
static QString resolveProfilesFolder(const QString &basePath=QString())
Resolves the profiles folder for the given path.
static QgsAnnotationRegistry * annotationRegistry()
Returns the application's annotation registry, used for managing annotation types.
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
static void invalidateCache(bool disableCache=false)
Clears the internal cache used.
static QgsFieldFormatterRegistry * fieldFormatterRegistry()
Gets the registry of available field formatters.
Cursor
The Cursor enum defines constants for QGIS custom cursors.
static QString userStylePath()
Returns the path to user's style.
Registry of color schemes.
static QgsAuthManager * instance()
Enforce singleton pattern.
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
static QString authorsFilePath()
Returns the path to the authors file.
static void setPrefixPath(const QString &prefixPath, bool useDefaultPaths=false)
Alters prefix path - used by 3rd party apps.
A registry of plugin layers types.
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
static void invalidateCache(bool disableCache=false)
Clears the internal cache used to initialize QgsCoordinateReferenceSystem objects.
static void setCustomVariables(const QVariantMap &customVariables)
Custom expression variables for this application.
static QString libraryPath()
Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries.
static QgsRuntimeProfiler * profiler()
Returns the application runtime profiler.
static QString defaultThemePath()
Returns the path to the default theme directory.
static const double UI_SCALE_FACTOR
UI scaling factor.
This class is a composition of two QSettings instances:
static QString qgisMasterDatabaseFilePath()
Returns the path to the master qgis.db file.
void customVariablesChanged()
Emitted whenever a custom global variable changes.
static QString qgisUserDatabaseFilePath()
Returns the path to the user qgis.db file.
bool event(QEvent *event) override
Watch for QFileOpenEvent.
void requestForTranslatableObjects(QgsTranslationContext *translationContext)
Emitted when project strings which require translation are being collected for inclusion in a ...
static QString donorsFilePath()
Returns the path to the donors file.
static QString relativePathToAbsolutePath(const QString &rpath, const QString &targetPath)
Converts path relative to target to an absolute path.
void nullRepresentationChanged()
This string is used to represent the value NULL throughout QGIS.
static QString themeName()
Set the active theme to the specified theme.
static QString defaultThemesFolder()
Returns the path to default themes folder from install (works as a starting point).
void initStyleScheme()
Initializes the default random style color scheme for the user.
static void restoreGdalDriver(const QString &driver)
Sets the GDAL_SKIP environment variable to exclude the specified driver and then calls GDALDriverMana...
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
A cache for images / pictures derived from svg files.
void remove(const QString &key, QgsSettings::Section section=QgsSettings::NoSection)
Removes the setting key and any sub-settings of key in a section.
static QString resolvePkgPath()
Calculate the application pkg path.
Registry for raster renderers.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
static void registerOgrDrivers()
Register OGR drivers ensuring this only happens once.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
User profile contains information about the user profile folders on the machine.
Precisely identify a point on the canvas.
static QgsPluginLayerRegistry * pluginLayerRegistry()
Returns the application's plugin layer registry, used for managing plugin layer types.
static QVariantMap customVariables()
Custom expression variables for this application.
static void setFileOpenEventReceiver(QObject *receiver)
Sets the FileOpen event receiver.
static QString reportStyleSheet()
Returns a standard css style sheet for reports.
static int maxThreads()
Gets maximum concurrent thread count.
static endian_t endian()
Returns whether this machine uses big or little endian.
static QPixmap getThemePixmap(const QString &name)
Helper to get a theme icon as a pixmap.
static QString userFullName()
Returns the user's operating system login account full display name.
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects. ...
static QString developersMapFilePath()
Returns the path to the developers map file.
static QString absolutePathToRelativePath(const QString &apath, const QString &targetPath)
Converts absolute path to path relative to target.
static QString defaultStylePath()
Returns the path to default style (works as a starting point).
static QgsTaskManager * taskManager()
Returns the application's task manager, used for managing application wide background task handling...
static QgsMessageLog * messageLog()
Returns the application's message log.
static void applyGdalSkippedDrivers()
Apply the skipped drivers list to gdal.
#define CONN_POOL_MAX_CONCURRENT_CONNS
endian_t
Constants for endian-ness.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
static QgsLayoutItemRegistry * layoutItemRegistry()
Returns the application's layout item registry, used for layout item types.
static void setNullRepresentation(const QString &nullRepresentation)
This string is used to represent the value NULL throughout QGIS.
static QString pluginPath()
Returns the path to the application plugin directory.
Keeps track of available 3D renderers.
#define QgsDebugMsgLevel(str, level)
Registry of available symbol layer classes.
Registry for temporary fetched files.
static bool createThemeFolder()
Create the users theme folder.
static bool createDatabase(QString *errorMessage=nullptr)
initialize qgis.db
static void cleanRegisteredFunctions()
Deletes all registered functions whose ownership have been transferred to the expression engine...
static QString i18nPath()
Returns the path to the translation directory.
static void cleanDefaultStyle()
Deletes the default style. Only to be used by QgsApplication::exitQgis()
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
static QString splashPath()
Returns the path to the splash screen image directory.
static void setCustomVariable(const QString &name, const QVariant &value)
Set a single custom expression variable.
static QgsGpsConnectionRegistry * gpsConnectionRegistry()
Returns the application's GPS connection registry, used for managing GPS connections.
A registry for known page sizes.
static const char * QGIS_ORGANIZATION_NAME
int open(const QString &path)
Opens the database at the specified file path.
static QgsProjectStorageRegistry * projectStorageRegistry()
Returns registry of available project storage implementations.
Task manager for managing a set of long-running QgsTask tasks.
Used for the collecting of strings from projects for translation and creation of ts files...
const QString folder() const
The base folder for the user profile.
static QString userLoginName()
Returns the user's operating system login account name.
static QString pkgDataPath()
Returns the common root path of all application data directories.
static QString osName()
Returns a string name of the operating system QGIS is running on.
static void initQgis()
loads providers
static void setDefaultSvgPaths(const QStringList &pathList)
Alters default svg paths - used by 3rd party apps.
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
static void skipGdalDriver(const QString &driver)
Sets the GDAL_SKIP environment variable to include the specified driver and then calls GDALDriverMana...
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
static QRegExp shortNameRegExp()
Returns the short name regular expression for line edit validator.
static QgsNetworkAccessManager * instance(Qt::ConnectionType connectionType=Qt::BlockingQueuedConnection)
Returns a pointer to the active QgsNetworkAccessManager for the current thread.
Identify: obtain information about the object.
Registry for various processing components, including providers, algorithms and various parameters an...
int maxConcurrentConnectionsPerPool() const
The maximum number of concurrent connections per connections pool.
static QString showSettings()
Convenience function to get a summary of the paths used in this application instance useful for debug...
static QString appIconPath()
Gets application icon.
static QgsColorSchemeRegistry * colorSchemeRegistry()
Returns the application's color scheme registry, used for managing color schemes. ...
static const char * QGIS_ORGANIZATION_DOMAIN
bool notify(QObject *receiver, QEvent *event) override
Catch exceptions when sending event to receiver.
Registry of available layout item types.
static void setPkgDataPath(const QString &pkgDataPath)
Alters pkg data path - used by 3rd party apps.
static QgsPageSizeRegistry * pageSizeRegistry()
Returns the application's page size registry, used for managing layout page sizes.
static QString contributorsFilePath()
Returns the path to the contributors file.
static QString activeThemePath()
Returns the path to the currently active theme directory.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
static void init(QString profileFolder=QString())
This method initializes paths etc for QGIS.
static void setPluginPath(const QString &pluginPath)
Alters plugin path - used by 3rd party apps.
QgsUserProfile * getProfile(const QString &defaultProfile="default", bool createNew=true, bool initSettings=true)
Returns the profile from the given root profile location.
static QgsProject * instance()
Returns the QgsProject singleton instance.
A class to register / unregister existing GPS connections such that the information is available to a...
static QgsNetworkContentFetcherRegistry * networkContentFetcherRegistry()
Returns the application's network content registry used for fetching temporary files during QGIS sess...
bool init(const QString &pluginPath=QString(), const QString &authDatabasePath=QString())
init initialize QCA, prioritize qca-ossl plugin and optionally set up the authentication database ...
static QString platform()
Returns the QGIS platform name, e.g., "desktop" or "server".
static QString srsDatabaseFilePath()
Returns the path to the srs.db file.
QObject * ABISYM(QgsApplication::mFileOpenEventReceiver)
static void exitQgis()
deletes provider registry and map layer registry
Temporarily blocks the application QgsMessageLog (see QgsApplication::messageLog()) from emitting the...
static QStringList svgPaths()
Returns the paths to svg directories.
static QString sponsorsFilePath()
Returns the path to the sponsors file.
Registry of storage backends that QgsProject may use.
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
static QString qgisAuthDatabaseFilePath()
Returns the path to the user authentication database file: qgis-auth.db.
The action scope registry is an application wide registry that contains a list of available action sc...
static QHash< QString, QString > uiThemes()
All themes found in ~/.qgis3/themes folder.
static QString libexecPath()
Returns the path with utility executables (help viewer, crssync, ...)
static QString prefixPath()
Returns the path to the application prefix directory.
static QString iconsPath()
Returns the path to the icons image directory.
static QString translatorsFilePath()
Returns the path to the sponsors file.
static const char * QGIS_APPLICATION_NAME
QStringList childKeys() const
Returns a list of all top-level keys that can be read using the QSettings object. ...
void collectTranslatableObjects(QgsTranslationContext *translationContext)
Emits the signal to collect all the strings of .qgs to be included in ts file.
~QgsApplication() override
static QString serverResourcesPath()
Returns the path to the server resources directory.
static QgsActionScopeRegistry * actionScopeRegistry()
Returns the action scope registry.
User profile manager is used to manager list, and manage user profiles on the users machine...
static QString metadataPath()
Returns the path to the metadata directory.
Defines a QGIS exception class.
static QgsRasterRendererRegistry * rasterRendererRegistry()
Returns the application's raster renderer registry, used for managing raster layer renderers...
static QgsDataItemProviderRegistry * dataItemProviderRegistry()
Returns the application's data item provider registry, which keeps a list of data item providers that...
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
Interface for logging messages from QGIS in GUI independent way.
static QString qmlImportPath()
Returns the path where QML components are installed for QGIS Quick library.
static void setMaxThreads(int maxThreads)
Set maximum concurrent thread count.
Select and capture a point or a feature.
static void setUITheme(const QString &themeName)
Set the current UI theme used to style the interface.
static QColor decodeColor(const QString &str)
static QString licenceFilePath()
Returns the path to the licence file.
Registry of available paint effects.
static QgsProcessingRegistry * processingRegistry()
Returns the application's processing registry, used for managing processing providers, algorithms, and various parameters and outputs.
static QString userThemesFolder()
Returns the path to user's themes folder.
void preNotify(QObject *receiver, QEvent *event, bool *done)
static void setAuthDatabaseDirPath(const QString &authDbDirPath)
Alters authentication data base directory path - used by 3rd party apps.