107#include <QAuthenticator>
111#include <QFileOpenEvent>
113#include <QImageReader>
114#include <QLibraryInfo>
116#include <QMessageBox>
120#include <QProcessEnvironment>
121#include <QRecursiveMutex>
122#include <QRegularExpression>
124#include <QStandardPaths>
127#include <QTextStream>
128#include <QThreadPool>
130#include "moc_qgsapplication.cpp"
132using namespace Qt::StringLiterals;
150#include <netinet/in.h>
156#define SECURITY_WIN32
159#pragma comment( lib, "Secur32.lib" )
163#include "qgsconfig.h"
173#if defined( Q_OS_LINUX )
174#include <sys/sysinfo.h>
177#define CONN_POOL_MAX_CONCURRENT_CONNS 4
240QObject *
ABISYM( QgsApplication::mFileOpenEventReceiver ) =
nullptr;
241bool ABISYM( QgsApplication::mInitialized ) =
false;
242bool ABISYM( QgsApplication::mRunningFromBuildDir ) =
false;
248int ABISYM( QgsApplication::sMaxThreads ) = -1;
265#if defined( _MSC_VER ) && !defined( USING_NMAKE ) && !defined( USING_NINJA )
283 : QApplication( argc, argv, GUIenabled )
285 *sPlatformName() = platformName;
290 if ( platformName !=
"desktop"_L1 )
292 mApplicationMembers = std::make_unique<ApplicationMembers>();
295 mApplicationMembers->mSettingsRegistryCore->migrateOldSettings();
304 *sProfilePath() = profileFolder;
310 qRegisterMetaType<QgsGeometry::Error>(
"QgsGeometry::Error" );
311 qRegisterMetaType<QgsDatabaseQueryLogEntry>(
"QgsDatabaseQueryLogEntry" );
312 qRegisterMetaType<QgsProcessingFeatureSourceDefinition>(
"QgsProcessingFeatureSourceDefinition" );
313 qRegisterMetaType<QgsProcessingOutputLayerDefinition>(
"QgsProcessingOutputLayerDefinition" );
314 qRegisterMetaType<Qgis::LayoutUnit>(
"Qgis::LayoutUnit" );
315 qRegisterMetaType<QgsUnsetAttributeValue>(
"QgsUnsetAttributeValue" );
316 qRegisterMetaType<QgsFeatureId>(
"QgsFeatureId" );
317 qRegisterMetaType<QgsFields>(
"QgsFields" );
318 qRegisterMetaType<QgsFeatureIds>(
"QgsFeatureIds" );
319 qRegisterMetaType<QgsProperty>(
"QgsProperty" );
320 qRegisterMetaType<QgsFeatureStoreList>(
"QgsFeatureStoreList" );
321 qRegisterMetaType<Qgis::MessageLevel>(
"Qgis::MessageLevel" );
322 qRegisterMetaType<Qgis::BrowserItemState>(
"Qgis::BrowserItemState" );
323 qRegisterMetaType<Qgis::GpsFixStatus>(
"Qgis::GpsFixStatus" );
324 qRegisterMetaType<QgsReferencedRectangle>(
"QgsReferencedRectangle" );
325 qRegisterMetaType<QgsReferencedPointXY>(
"QgsReferencedPointXY" );
326 qRegisterMetaType<QgsReferencedGeometry>(
"QgsReferencedGeometry" );
327 qRegisterMetaType<Qgis::LayoutRenderFlags>(
"Qgis::LayoutRenderFlags" );
328 qRegisterMetaType<QgsStyle::StyleEntity>(
"QgsStyle::StyleEntity" );
329 qRegisterMetaType<QgsCoordinateReferenceSystem>(
"QgsCoordinateReferenceSystem" );
330 qRegisterMetaType<QgsAuthManager::MessageLevel>(
"QgsAuthManager::MessageLevel" );
331 qRegisterMetaType<QgsNetworkRequestParameters>(
"QgsNetworkRequestParameters" );
332 qRegisterMetaType<QgsNetworkReplyContent>(
"QgsNetworkReplyContent" );
333 qRegisterMetaType<QgsFeature>(
"QgsFeature" );
334 qRegisterMetaType<QgsGeometry>(
"QgsGeometry" );
335 qRegisterMetaType<QgsInterval>(
"QgsInterval" );
336 qRegisterMetaType<QgsRectangle>(
"QgsRectangle" );
337 qRegisterMetaType<QgsPointXY>(
"QgsPointXY" );
338 qRegisterMetaType<QgsPoint>(
"QgsPoint" );
339 qRegisterMetaType<QgsDatumTransform::GridDetails>(
"QgsDatumTransform::GridDetails" );
340 qRegisterMetaType<QgsDatumTransform::TransformDetails>(
"QgsDatumTransform::TransformDetails" );
341 qRegisterMetaType<QgsNewsFeedParser::Entry>(
"QgsNewsFeedParser::Entry" );
342 qRegisterMetaType<QgsRectangle>(
"QgsRectangle" );
343 qRegisterMetaType<QgsLocatorResult>(
"QgsLocatorResult" );
344 qRegisterMetaType<QgsGradientColorRamp>(
"QgsGradientColorRamp" );
345 qRegisterMetaType<QgsProcessingModelChildParameterSource>(
"QgsProcessingModelChildParameterSource" );
346 qRegisterMetaType<QgsRemappingSinkDefinition>(
"QgsRemappingSinkDefinition" );
347 qRegisterMetaType<QgsProcessingModelChildDependency>(
"QgsProcessingModelChildDependency" );
348 qRegisterMetaType<QgsTextFormat>(
"QgsTextFormat" );
349 qRegisterMetaType<QPainter::CompositionMode>(
"QPainter::CompositionMode" );
350 qRegisterMetaType<QgsDateTimeRange>(
"QgsDateTimeRange" );
351 qRegisterMetaType<QgsDoubleRange>(
"QgsDoubleRange" );
352 qRegisterMetaType<QgsIntRange>(
"QgsIntRange" );
353 qRegisterMetaType<QList<QgsMapLayer *>>(
"QList<QgsMapLayer*>" );
354 qRegisterMetaType<QMap<QNetworkRequest::Attribute, QVariant>>(
"QMap<QNetworkRequest::Attribute,QVariant>" );
355 qRegisterMetaType<QMap<QNetworkRequest::KnownHeaders, QVariant>>(
"QMap<QNetworkRequest::KnownHeaders,QVariant>" );
356 qRegisterMetaType<QList<QNetworkReply::RawHeaderPair>>(
"QList<QNetworkReply::RawHeaderPair>" );
357 qRegisterMetaType<QNetworkReply::NetworkError>(
"QNetworkReply::NetworkError" );
358 qRegisterMetaType< QAuthenticator * >(
"QAuthenticator*" );
359 qRegisterMetaType< QgsGpsInformation >(
"QgsGpsInformation" );
360 qRegisterMetaType< QgsSensorThingsExpansionDefinition >(
"QgsSensorThingsExpansionDefinition" );
361 qRegisterMetaType< QTimeZone >(
"QTimeZone" );
362 qRegisterMetaType< QgsSelectiveMaskingSourceSet >(
"QgsSelectiveMaskingSourceSet" );
370 instance()->mApplicationMembers = std::make_unique<ApplicationMembers>();
373 instance()->mApplicationMembers->mSettingsRegistryCore->migrateOldSettings();
381 if ( profileFolder.isEmpty() )
383 if ( getenv(
"QGIS_CUSTOM_CONFIG_PATH" ) )
385 profileFolder = getenv(
"QGIS_CUSTOM_CONFIG_PATH" );
389 profileFolder = QStandardPaths::standardLocations( QStandardPaths::AppDataLocation ).value( 0 );
395 std::unique_ptr< QgsUserProfile > profile = manager.
getProfile();
396 profileFolder = profile->folder();
399 *sProfilePath() = profileFolder;
401 static std::once_flag sMetaTypesRegistered;
406 if ( ABISYM( mRunningFromBuildDir ) )
409 *sPrefixPath() = QString();
410#if defined( _MSC_VER ) && !defined( USING_NMAKE ) && !defined( USING_NINJA )
411 setPluginPath( *sBuildOutputPath() +
'/' + QString( QGIS_PLUGIN_SUBDIR ) +
'/' + *sCfgIntDir() );
413 setPluginPath( *sBuildOutputPath() +
'/' + QStringLiteral( QGIS_PLUGIN_SUBDIR ) );
416 *sLibraryPath() = *sBuildOutputPath() +
'/' + QGIS_LIB_SUBDIR +
'/';
417#if defined( _MSC_VER ) && !defined( USING_NMAKE ) && !defined( USING_NINJA )
418 *sLibexecPath() = *sBuildOutputPath() +
'/' + QGIS_LIBEXEC_SUBDIR +
'/' + *sCfgIntDir() +
'/';
420 *sLibexecPath() = *sBuildOutputPath() +
'/' + QGIS_LIBEXEC_SUBDIR +
'/';
422#if defined( HAVE_QUICK )
423 *sQmlImportPath() = *sBuildOutputPath() +
'/' + QGIS_QML_SUBDIR +
'/';
428 char *
prefixPath = getenv(
"QGIS_PREFIX_PATH" );
431 if ( sPrefixPath()->isNull() )
433#if defined( Q_OS_WIN ) || defined( Q_OS_MACOS ) && !defined( QGIS_MAC_BUNDLE )
435#elif defined( QGIS_MAC_BUNDLE )
436 QDir myDir( applicationDirPath() +
"/../.."_L1 );
438#elif defined( ANDROID )
440 QDir myDir( QDir::homePath() );
442 QString myPrefix = myDir.absolutePath();
445 QDir myDir( applicationDirPath() );
447 if ( applicationDirPath().contains( u
"cgi-bin"_s ) )
452 QString myPrefix = myDir.absolutePath();
463 *sConfigPath() = profileFolder +
'/';
472 if ( getenv(
"QGIS_AUTH_DB_DIR_PATH" ) )
475 sAuthDbUri()->clear();
478 if ( getenv(
"QGIS_AUTH_DB_URI" ) )
480 *sAuthDbUri() = getenv(
"QGIS_AUTH_DB_URI" );
484 if ( sAuthDbUri->isEmpty() )
486 *sAuthDbUri() = u
"QSQLITE://"_s + *sAuthDbDirPath() + u
"qgis-auth.db"_s;
490 qputenv(
"QT3D_RENDERER",
"opengl" );
493 QMap<QString, QString> systemEnvVarMap;
494 QString passfile( u
"QGIS_AUTH_PASSWORD_FILE"_s );
496 const auto systemEnvironment = QProcessEnvironment::systemEnvironment().toStringList();
497 for (
const QString &varStr : systemEnvironment )
499 int pos = varStr.indexOf(
'='_L1 );
502 QString varStrName = varStr.left( pos );
503 QString varStrValue = varStr.mid( pos + 1 );
504 if ( varStrName != passfile )
506 systemEnvVarMap.insert( varStrName, varStrValue );
509 *sSystemEnvVars() = systemEnvVarMap;
516 const QString projData( QDir::cleanPath(
pkgDataPath().append(
"/proj" ) ) );
517 if ( QFile::exists( projData ) )
519 qputenv(
"PROJ_DATA", projData.toUtf8() );
520 currentProjSearchPaths.append( projData );
524 char **newPaths =
new char *[currentProjSearchPaths.length()];
525 for (
int i = 0; i < currentProjSearchPaths.count(); ++i )
527 newPaths[i] = CPLStrdup( currentProjSearchPaths.at( i ).toUtf8().constData() );
529 proj_context_set_search_paths(
nullptr, currentProjSearchPaths.count(), newPaths );
530 for (
int i = 0; i < currentProjSearchPaths.count(); ++i )
532 CPLFree( newPaths[i] );
537 QCoreApplication::addLibraryPath(
pluginPath() );
540 QImageReader::setAllocationLimit( 512 );
550 ABISYM( sMaxThreads ) = -1;
566 if ( !members()->mStyleModel )
567 members()->mStyleModel = std::make_unique<QgsStyleModel>( defaultStyle );
569 ABISYM( mInitialized ) =
true;
573void QgsApplication::installTranslators()
576 if ( mQgisTranslator )
578 removeTranslator( mQgisTranslator.get() );
579 mQgisTranslator.reset();
583 removeTranslator( mQtTranslator.get() );
584 mQtTranslator.reset();
586 if ( mQtBaseTranslator )
588 removeTranslator( mQtBaseTranslator.get() );
589 mQtBaseTranslator.reset();
592 if ( *sTranslation() !=
"C"_L1 )
594 mQgisTranslator = std::make_unique<QTranslator>(
this );
595 if ( mQgisTranslator->load( u
"qgis_"_s + *sTranslation(),
i18nPath() ) )
597 installTranslator( mQgisTranslator.get() );
609 QString qtTranslationsPath = QLibraryInfo::location( QLibraryInfo::TranslationsPath );
611 QString prefix = QDir( QString(
"%1/../" ).arg( QApplication::applicationDirPath() ) ).absolutePath();
612 qtTranslationsPath = prefix + qtTranslationsPath.mid( QLibraryInfo::location( QLibraryInfo::PrefixPath ).length() );
615 mQtTranslator = std::make_unique<QTranslator>(
this );
616 if ( mQtTranslator->load( u
"qt_"_s + *sTranslation(), qtTranslationsPath ) )
618 installTranslator( mQtTranslator.get() );
622 QgsDebugMsgLevel( u
"loading of qt translation failed %1/qt_%2"_s.arg( qtTranslationsPath, *sTranslation() ), 2 );
625 mQtBaseTranslator = std::make_unique<QTranslator>(
this );
626 if ( mQtBaseTranslator->load( u
"qtbase_"_s + *sTranslation(), qtTranslationsPath ) )
628 installTranslator( mQtBaseTranslator.get() );
632 QgsDebugMsgLevel( u
"loading of qtbase translation failed %1/qt_%2"_s.arg( qtTranslationsPath, *sTranslation() ), 2 );
639 if ( mApplicationMembers )
643 mApplicationMembers->mSettingsRegistryCore->backwardCompatibility();
647 QgsDebugError( u
"An error occurred while performing backwards compatibility for settings: %1"_s.arg( e.
what() ) );
657void QgsApplication::invalidateCaches()
669 return qobject_cast<QgsApplication *>( QCoreApplication::instance() );
675 if (
event->type() == QEvent::FileOpen )
678 if ( ABISYM( mFileOpenEventReceiver ) )
681 done =
notify( ABISYM( mFileOpenEventReceiver ),
event );
688 sFileOpenEventList()->append(
static_cast<QFileOpenEvent *
>(
event )->file() );
695 done = QApplication::event(
event );
704 if ( thread() == receiver->thread() )
714 done = QApplication::notify( receiver,
event );
718 qCritical() <<
"Caught unhandled QgsException: " << e.
what();
719 if ( qApp->thread() == QThread::currentThread() )
720 QMessageBox::critical( activeWindow(), tr(
"Exception" ), e.
what() );
722 catch ( std::exception &e )
724 qCritical() <<
"Caught unhandled std::exception: " << e.
what();
725 if ( qApp->thread() == QThread::currentThread() )
726 QMessageBox::critical( activeWindow(), tr(
"Exception" ), e.
what() );
730 qCritical() <<
"Caught unhandled unknown exception";
731 if ( qApp->thread() == QThread::currentThread() )
732 QMessageBox::critical( activeWindow(), tr(
"Exception" ), tr(
"unknown exception" ) );
740 return QgsRuntimeProfiler::threadLocalInstance();
746 ABISYM( mFileOpenEventReceiver ) = receiver;
748 if ( sFileOpenEventList()->count() > 0 )
750 const QStringList fileOpenEventList = *sFileOpenEventList();
751 for (
const QString &file : fileOpenEventList )
753 QFileOpenEvent foe( file );
754 QgsApplication::sendEvent( ABISYM( mFileOpenEventReceiver ), &foe );
756 sFileOpenEventList()->clear();
763#if defined( Q_OS_WIN )
764 if ( sPrefixPath()->endsWith(
"/bin" ) )
766 sPrefixPath()->chop( 4 );
769 if ( useDefaultPaths && !ABISYM( mRunningFromBuildDir ) )
771 setPluginPath( *sPrefixPath() +
'/' + QStringLiteral( QGIS_PLUGIN_SUBDIR ) );
772 setPkgDataPath( *sPrefixPath() +
'/' + QStringLiteral( QGIS_DATA_SUBDIR ) );
774 *sLibraryPath() = *sPrefixPath() +
'/' + QGIS_LIB_SUBDIR +
'/';
775 *sLibexecPath() = *sPrefixPath() +
'/' + QGIS_LIBEXEC_SUBDIR +
'/';
776#if defined( HAVE_QUICK )
777 *sQmlImportPath() = *sPrefixPath() +
'/' + QGIS_QML_SUBDIR +
'/';
793 if ( !sDefaultSvgPaths()->contains( mySvgPath ) )
794 *sDefaultSvgPaths() << mySvgPath;
799 *sDefaultSvgPaths() = pathList;
804 QFileInfo fi( authDbDirPath );
805 if ( fi.exists() && fi.isDir() && fi.isWritable() )
807 *sAuthDbDirPath() = fi.canonicalFilePath() + QDir::separator();
814 if ( ABISYM( mRunningFromBuildDir ) )
816 static bool sOnce =
true;
820 ( void ) blockNotifications;
821 qWarning(
"!!! prefix path was requested, but it is not valid - we do not run from installed path !!!" );
827 return *sPrefixPath();
831 return *sPluginPath();
836 if ( sPkgDataPath()->isNull() )
839 return *sPkgDataPath();
844 return u
":/images/themes/default/"_s;
849 QDir dir( usersThemes );
857 return defaultThemes;
863 return iconsPath() + u
"qgis-icon-60x60.png"_s;
868 return ABISYM( sMaxThreads );
875 if ( QFile::exists( path + iconFile ) )
876 return path + iconFile;
884 const QString
cacheKey = ( name.startsWith(
'/' ) ? name.mid( 1 ) : name )
885 + ( fillColor.isValid() ? u
"_%1"_s.arg( fillColor.name( QColor::HexArgb ).mid( 1 ) ) : QString() )
886 + ( strokeColor.isValid() ? u
"_%1"_s.arg( strokeColor.name( QColor::HexArgb ).mid( 1 ) ) : QString() );
888 if ( app && app->mIconCache.contains(
cacheKey ) )
889 return app->mIconCache.value(
cacheKey );
892 const bool colorBased = fillColor.isValid() || strokeColor.isValid();
894 auto iconFromColoredSvg = [fillColor, strokeColor,
cacheKey](
const QString &path ) -> QIcon {
899 if (
const QDir dir = QFileInfo(
iconPath ).dir(); !dir.exists() )
905 if ( f.open( QFile::WriteOnly | QFile::Truncate ) )
907 f.write( svgContent );
916 return QIcon( f.fileName() );
921 if ( QFile::exists( preferredPath ) )
925 icon = iconFromColoredSvg( preferredPath );
929 icon = QIcon( preferredPath );
932 else if ( QFile::exists( defaultPath ) )
938 icon = iconFromColoredSvg( defaultPath );
942 icon = QIcon( defaultPath );
951 app->mIconCache.insert(
cacheKey, icon );
958 if ( app && app->mCursorCache.contains( cursor ) )
959 return app->mCursorCache.value( cursor );
970 name = u
"mZoomIn.svg"_s;
975 name = u
"mZoomOut.svg"_s;
982 name = u
"mIdentify.svg"_s;
985 name = u
"mCrossHair.svg"_s;
988 name = u
"mCapturePoint.svg"_s;
991 name = u
"mSelect.svg"_s;
998 name = u
"mSampler.svg"_s;
1003 Q_ASSERT( !name.isEmpty() );
1005 QIcon icon =
getThemeIcon( u
"cursors"_s + QDir::separator() + name );
1008 if ( !icon.isNull() )
1012 cursorIcon = QCursor( icon.pixmap( std::ceil( scale * 32 ), std::ceil( scale * 32 ) ), std::ceil( scale * activeX ), std::ceil( scale * activeY ) );
1015 app->mCursorCache.insert( cursor, cursorIcon );
1022 const QString preferredPath =
activeThemePath() + QDir::separator() + name;
1024 const QString path = QFile::exists( preferredPath ) ? preferredPath : defaultPath;
1025 if ( foreColor.isValid() || backColor.isValid() )
1027 bool fitsInCache =
false;
1028 const QImage image =
svgCache()->
svgAsImage( path, size, backColor, foreColor, 1, 1, fitsInCache );
1029 return QPixmap::fromImage( image );
1032 return QPixmap( path );
1042 static QString appPath;
1043 if ( appPath.isNull() )
1045 if ( QCoreApplication::instance() )
1047 appPath = applicationDirPath();
1051 qWarning(
"Application path not initialized" );
1055 if ( !appPath.isNull() || getenv(
"QGIS_PREFIX_PATH" ) )
1057 QString prefix = getenv(
"QGIS_PREFIX_PATH" ) ? getenv(
"QGIS_PREFIX_PATH" ) : appPath;
1062 static const QStringList paths { QStringList() << QString() << u
"/.."_s << u
"/bin"_s << u
"/../../.."_s };
1063 for (
const QString &path : paths )
1065 f.setFileName( prefix + path +
"/qgisbuildpath.txt" );
1069 if ( f.exists() && f.open( QIODevice::ReadOnly ) )
1071 ABISYM( mRunningFromBuildDir ) =
true;
1072 *sBuildSourcePath() = f.readLine().trimmed();
1073 *sBuildOutputPath() = f.readLine().trimmed();
1075 QgsDebugMsgLevel( u
"- source directory: %1"_s.arg( sBuildSourcePath()->toUtf8().constData() ), 4 );
1076 QgsDebugMsgLevel( u
"- output directory of the build: %1"_s.arg( sBuildOutputPath()->toUtf8().constData() ), 4 );
1077#if defined( _MSC_VER ) && !defined( USING_NMAKE ) && !defined( USING_NINJA )
1078 *sCfgIntDir() = prefix.split(
'/', Qt::SkipEmptyParts ).last();
1079 qDebug(
"- cfg: %s", sCfgIntDir()->toUtf8().constData() );
1085 if ( getenv(
"QGIS_PREFIX_PATH" ) )
1089#if defined( ANDROID )
1091 QDir dir( QDir::homePath() );
1096#if defined( Q_OS_MACOS )
1098#elif defined( Q_OS_WIN )
1103 QDir dir( appPath );
1105 if ( appPath.contains( u
"cgi-bin"_s ) )
1115 if ( ABISYM( mRunningFromBuildDir ) )
1116 return *sBuildOutputPath() + u
"/data"_s;
1118 return prefixPath +
'/' + QStringLiteral( QGIS_DATA_SUBDIR );
1123 return *sThemeName();
1130 if (
themeName ==
"default"_L1 || path.isEmpty() )
1133 qApp->setStyleSheet( QString() );
1138 QFile file( path +
"/style.qss" );
1139 QFile variablesfile( path +
"/variables.qss" );
1140 QFileInfo variableInfo( variablesfile );
1142 if ( !file.open( QIODevice::ReadOnly ) || ( variableInfo.exists() && !variablesfile.open( QIODevice::ReadOnly ) ) )
1144 qApp->setStyleSheet( QString() );
1149 QFile palettefile( path +
"/palette.txt" );
1150 QFileInfo paletteInfo( palettefile );
1151 if ( paletteInfo.exists() && palettefile.open( QIODevice::ReadOnly ) )
1153 QPalette
pal = qApp->palette();
1154 QTextStream in( &palettefile );
1155 while ( !in.atEnd() )
1157 QString line = in.readLine();
1158 QStringList parts = line.split(
':' );
1159 if ( parts.count() == 2 )
1161 int role = parts.at( 0 ).trimmed().toInt();
1163 pal.setColor(
static_cast< QPalette::ColorRole
>( role ), color );
1166 palettefile.close();
1167 qApp->setPalette(
pal );
1170 QString styledata = file.readAll();
1171 styledata.replace(
"@theme_path"_L1, path );
1173 if ( variableInfo.exists() )
1175 QTextStream in( &variablesfile );
1176 while ( !in.atEnd() )
1178 QString line = in.readLine();
1180 if ( line.startsWith(
'@' ) )
1182 int index = line.indexOf(
':' );
1183 QString name = line.mid( 0, index );
1184 QString value = line.mid( index + 1, line.length() );
1185 styledata.replace( name, value );
1188 variablesfile.close();
1196 const static QRegularExpression regex( u
"(?<=[\\s:])([0-9\\.]+)(?=em)"_s );
1197 QRegularExpressionMatch match = regex.match( styledata, index );
1198 while ( match.hasMatch() )
1200 index = match.capturedStart();
1201 styledata.remove( index, match.captured( 0 ).length() );
1203 styledata.insert( index, number );
1204 index += number.length();
1205 match = regex.match( styledata, index );
1209 qApp->setStyleSheet( styledata );
1218 mapping.insert( u
"default"_s, QString() );
1254 if ( ABISYM( mRunningFromBuildDir ) )
1255 return *sBuildOutputPath() + u
"/i18n/"_s;
1262 return pkgDataPath() + u
"/resources/metadata-ISO/"_s;
1272 return *sConfigPath();
1282 return *sAuthDbDirPath() + u
"qgis-auth.db"_s;
1287 return *sAuthDbUri();
1292 return u
":/images/splash/"_s;
1302 if ( ABISYM( mRunningFromBuildDir ) )
1304 QString tempCopy = QDir::tempPath() +
"/srs6.db";
1306 if ( !QFile( tempCopy ).exists() )
1309 if ( !f.copy( tempCopy ) )
1311 qFatal(
"Could not create temporary copy" );
1326 members()->mSvgPathCacheValid =
false;
1331 static QReadWriteLock lock;
1335 if ( members()->mSvgPathCacheValid )
1337 return members()->mSvgPathCache;
1348 for (
const QString &path : pathList )
1350 if ( !paths.contains( path ) )
1351 paths.append( path );
1353 for (
const QString &path : std::as_const( *sDefaultSvgPaths() ) )
1355 if ( !paths.contains( path ) )
1356 paths.append( path );
1358 members()->mSvgPathCache = paths;
1373 return *sSystemEnvVars();
1383 const thread_local QRegularExpression regexp( QRegularExpression::anchoredPattern( u
"^[A-Za-z][A-Za-z0-9\\._-]*"_s ) );
1389 if ( !sUserName()->isEmpty() )
1390 return *sUserName();
1393 TCHAR name[UNLEN + 1];
1394 DWORD size = UNLEN + 1;
1396 if ( GetUserName( ( TCHAR * ) name, &size ) )
1398 *sUserName() = QString::fromWCharArray( name );
1402#elif QT_CONFIG( process )
1405 process.start( u
"whoami"_s, QStringList() );
1406 process.waitForFinished();
1407 *sUserName() = process.readAllStandardOutput().trimmed();
1410 if ( !sUserName()->isEmpty() )
1411 return *sUserName();
1414 *sUserName() = qgetenv(
"USER" );
1415 if ( !sUserName()->isEmpty() )
1416 return *sUserName();
1419 *sUserName() = qgetenv(
"USERNAME" );
1420 return *sUserName();
1425 if ( !sUserFullName()->isEmpty() )
1426 return *sUserFullName();
1429 TCHAR name[UNLEN + 1];
1430 DWORD size = UNLEN + 1;
1433 if ( GetUserNameEx( NameDisplay, ( TCHAR * ) name, &size ) )
1435 *sUserFullName() = QString::fromWCharArray( name );
1439 if ( sUserFullName()->isEmpty() )
1441#elif defined( Q_OS_ANDROID ) || defined( __MINGW32__ )
1442 *sUserFullName() = u
"Not available"_s;
1444 struct passwd *p = getpwuid( getuid() );
1448 QString gecosName = QString( p->pw_gecos );
1449 *sUserFullName() = gecosName.left( gecosName.indexOf(
',', 0 ) );
1454 return *sUserFullName();
1459#if defined( Q_OS_ANDROID )
1460 return "android"_L1;
1461#elif defined( Q_OS_MAC )
1463#elif defined( Q_OS_WIN )
1464 return "windows"_L1;
1465#elif defined( Q_OS_LINUX )
1467#elif defined( Q_OS_FREEBSD )
1468 return u
"freebsd"_s;
1469#elif defined( Q_OS_OPENBSD )
1470 return u
"openbsd"_s;
1471#elif defined( Q_OS_NETBSD )
1473#elif defined( Q_OS_UNIX )
1476 return "unknown"_L1;
1483 return static_cast<int>( CPLGetUsablePhysicalRAM() / 1048576 );
1488 return *sPlatformName();
1493 if ( !sApplicationFullName()->isEmpty() )
1494 return *sApplicationFullName();
1497 *sApplicationFullName() = qgetenv(
"QGIS_APPLICATION_FULL_NAME" );
1498 if ( !sApplicationFullName()->isEmpty() )
1499 return *sApplicationFullName();
1503 *sApplicationFullName() = settings.
value( u
"/qgis/application_full_name"_s, u
"%1 %2"_s.arg( applicationName(),
platform() ) ).toString();
1504 return *sApplicationFullName();
1513 if (
locale.startsWith(
"en"_L1, Qt::CaseInsensitive ) )
1522 return QLocale().name().left( 2 );
1528 QLocale::setDefault(
locale );
1539 return pkgDataPath() + u
"/resources/symbology-style.xml"_s;
1554 return *sLibraryPath();
1559 return *sLibexecPath();
1564 return *sQmlImportPath();
1569 return ( htonl( 1 ) == 1 ) ?
XDR :
NDR;
1576 init( *sProfilePath() );
1600 if (
auto *lInstance =
instance() )
1602 if ( !lInstance->mAuthManager )
1606 return lInstance->mAuthManager;
1611 if ( !sAuthManager )
1613 return sAuthManager;
1626 QThreadPool::globalInstance()->waitForDone();
1629 if (
auto *lInstance =
instance() )
1630 delete lInstance->mAuthManager;
1632 delete sAuthManager;
1635 QgsApplication::sendPostedEvents(
nullptr, QEvent::DeferredDelete );
1641 if ( QgsProject::sProject )
1649 QgsApplication::sendPostedEvents(
nullptr, QEvent::DeferredDelete );
1652 if ( QgsProviderRegistry::exists() )
1663 if ( GDALDumpOpenDatasets( stdin ) == 0 )
1666 GDALDestroyDriverManager();
1669 QgsDebugMsgLevel( u
"Skipping call to GDALDestroyDriverManager() due to still opened datasets"_s, 5 );
1674 QString myEnvironmentVar( getenv(
"QGIS_PREFIX_PATH" ) );
1677 "QgsApplication state:\n"
1678 " - QGIS_PREFIX_PATH env var: %1\n"
1680 " - Plugin Path: %3\n"
1681 " - Package Data Path: %4\n"
1682 " - Active Theme Name: %5\n"
1683 " - Active Theme Path: %6\n"
1684 " - Default Theme Path: %7\n"
1685 " - SVG Search Paths: %8\n"
1686 " - User DB Path: %9\n"
1687 " - Auth DB Path: %10\n"
1701 QColor myColor1( Qt::lightGray );
1702 QColor myColor2 = myColor1;
1703 myColor2 = myColor2.lighter( 110 );
1705 myStyle = QStringLiteral(
1708 " font-weight: bold;"
1711 " background: white;"
1713 " font-family: 'Lato', 'Open Sans', 'Lucida Grande', 'Segoe UI', 'Arial', sans-serif;"
1716 "h1{ background-color: #F6F6F6;"
1718 " font-size: x-large; "
1719 " font-weight: normal;"
1720 " background: none;"
1721 " padding: 0.75em 0 0;"
1723 " line-height: 3em;"
1725 "h2{ background-color: #F6F6F6;"
1727 " font-size: medium; "
1728 " font-weight: normal;"
1729 " background: none;"
1730 " padding: 0.75em 0 0;"
1732 " line-height: 1.1em;"
1734 "h3{ background-color: #F6F6F6;"
1736 " font-weight: bold;"
1737 " font-size: large;"
1738 " text-align: left;"
1739 " border-bottom: 5px solid #DCEB5C;"
1741 "h4{ background-color: #F6F6F6;"
1743 " font-weight: bold;"
1744 " font-size: medium;"
1745 " text-align: left;"
1747 "h5{ background-color: #F6F6F6;"
1749 " font-weight: bold;"
1750 " font-size: small;"
1751 " text-align: left;"
1753 "a{ color: #729FCF;"
1754 " font-family: arial,sans-serif;"
1756 "label{ background-color: #FFFFCC;"
1757 " border: 1px solid black;"
1759 " padding: 0px 3px; "
1760 " font-size: small;"
1763 " font-weight: bold;"
1768 " border-top: 1px solid black;"
1770 ".list-view .highlight {"
1771 " text-align: left;"
1774 " padding-right: 15px;"
1775 " padding-left: 20px;"
1776 " font-weight: bold;"
1778 ".tabular-view .odd-row {"
1779 " background-color: #f9f9f9;"
1782 " font-weight: bold;"
1783 " padding-top:25px;"
1788 switch ( styleSheetType )
1791 myStyle += QStringLiteral(
1793 " border-collapse: collapse;"
1796 ".tabular-view th, .tabular-view td { "
1797 " border:1px solid black;"
1803 myStyle += QStringLiteral(
1808 "table.tabular-view, table.list-view { "
1809 " border-collapse: collapse;"
1810 " table-layout:fixed;"
1811 " width: 100% !important;"
1816 " line-height: inherit;"
1819 " word-wrap: break-word; "
1820 " vertical-align: top;"
1823 ".list-view th:first-child, .list-view td:first-child {"
1826 ".list-view.highlight { "
1827 " padding-left: inherit; "
1830 ".tabular-view th:first-child, .tabular-view td:first-child { "
1834 ".tabular-view th.strong { "
1835 " background-color: #eee; "
1838 ".tabular-view th, .tabular-view td { "
1839 " border: 1px solid #eee;"
1850 if ( 0 >= OGRGetDriverCount() )
1858 QString aPathUrl = aPath;
1859 QString tPathUrl = targetPath;
1860#if defined( Q_OS_WIN )
1861 const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
1863 aPathUrl.replace(
'\\',
'/' );
1864 if ( aPathUrl.startsWith(
"//" ) )
1867 aPathUrl =
"\\\\" + aPathUrl.mid( 2 );
1870 tPathUrl.replace(
'\\',
'/' );
1871 if ( tPathUrl.startsWith(
"//" ) )
1874 tPathUrl =
"\\\\" + tPathUrl.mid( 2 );
1877 const Qt::CaseSensitivity cs = Qt::CaseSensitive;
1880 QStringList targetElems = tPathUrl.split(
'/', Qt::SkipEmptyParts );
1881 QStringList aPathElems = aPathUrl.split(
'/', Qt::SkipEmptyParts );
1883 targetElems.removeAll( u
"."_s );
1884 aPathElems.removeAll( u
"."_s );
1888 while ( !aPathElems.isEmpty() && !targetElems.isEmpty() && aPathElems[0].compare( targetElems[0], cs ) == 0 )
1890 aPathElems.removeFirst();
1891 targetElems.removeFirst();
1901 if ( !targetElems.isEmpty() )
1904 for (
int i = 0; i < targetElems.size(); i++ )
1906 aPathElems.insert( 0, u
".."_s );
1913 aPathElems.insert( 0, u
"."_s );
1916 return aPathElems.join(
'/'_L1 );
1922 if ( !rpath.startsWith(
"./"_L1 ) && !rpath.startsWith(
"../"_L1 ) )
1927 QString rPathUrl = rpath;
1928 QString targetPathUrl = targetPath;
1930#if defined( Q_OS_WIN )
1931 rPathUrl.replace(
'\\',
'/' );
1932 targetPathUrl.replace(
'\\',
'/' );
1934 bool uncPath = targetPathUrl.startsWith(
"//" );
1937 QStringList srcElems = rPathUrl.split(
'/', Qt::SkipEmptyParts );
1938 QStringList targetElems = targetPathUrl.split(
'/', Qt::SkipEmptyParts );
1940#if defined( Q_OS_WIN )
1943 targetElems.insert( 0,
"" );
1944 targetElems.insert( 0,
"" );
1949 targetElems << srcElems;
1950 targetElems.removeAll( u
"."_s );
1954 while ( ( pos = targetElems.indexOf(
".."_L1 ) ) > 0 )
1957 targetElems.removeAt( pos - 1 );
1958 targetElems.removeAt( pos - 1 );
1961#if !defined( Q_OS_WIN )
1963 targetElems.prepend( QString() );
1966 return targetElems.join(
'/'_L1 );
1971 return *sBuildSourcePath();
1976 return *sBuildOutputPath();
1979#if defined( _MSC_VER ) && !defined( USING_NMAKE ) && !defined( USING_NINJA )
1980QString QgsApplication::cfgIntDir()
1982 return *sCfgIntDir();
1988 if ( sGdalSkipList()->contains( driver ) || driver.isEmpty() )
1992 *sGdalSkipList() << driver;
1998 if ( !sGdalSkipList()->contains( driver ) )
2002 int myPos = sGdalSkipList()->indexOf( driver );
2005 sGdalSkipList()->removeAt( myPos );
2012 return *sGdalSkipList();
2029 QString joinedList, delimiter;
2030 if ( settings.
contains( u
"gdal/skipDrivers"_s ) )
2032 joinedList = settings.
value( u
"gdal/skipDrivers"_s, QString() ).toString();
2037 joinedList = settings.
value( u
"gdal/skipList"_s, QString() ).toString();
2041 if ( !joinedList.isEmpty() )
2043 myList = joinedList.split( delimiter );
2045 *sGdalSkipList() = myList;
2051 return *sDeferredSkippedGdalDrivers();
2056 sGdalSkipList()->removeDuplicates();
2057 QStringList realDisabledDriverList;
2058 for (
const auto &driverName : *sGdalSkipList() )
2060 if ( !sDeferredSkippedGdalDrivers()->contains( driverName ) )
2061 realDisabledDriverList << driverName;
2063 QString myDriverList = realDisabledDriverList.join(
',' );
2066 CPLSetConfigOption(
"GDAL_SKIP", myDriverList.toUtf8() );
2073 QDir myDir( folder );
2074 if ( !myDir.exists() )
2076 myDir.mkpath( folder );
2082void QgsApplication::copyPath(
const QString &src,
const QString &dst )
2085 if ( !dir.exists() )
2088 const auto subDirectories = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot );
2089 for (
const QString &d : subDirectories )
2091 QString dst_path = dst + QDir::separator() + d;
2092 dir.mkpath( dst_path );
2093 copyPath( src + QDir::separator() + d, dst_path );
2096 const auto files = dir.entryList( QDir::Files );
2097 for (
const QString &f : files )
2099 QFile::copy( src + QDir::separator() + f, dst + QDir::separator() + f );
2108 QVariantMap variables;
2112 QStringList childKeys = settings.
childKeys();
2113 for ( QStringList::const_iterator it = childKeys.constBegin(); it != childKeys.constEnd(); ++it )
2116 variables.insert( name, settings.
value( name ) );
2126 QVariantMap::const_iterator it = variables.constBegin();
2129 for ( ; it != variables.constEnd(); ++it )
2131 settings.
setValue( it.key(), it.value() );
2142 settings.
setValue( u
"variables/"_s + name, value );
2149 return instance()->mTemporarilyTrustedProjectFolders;
2154 instance()->mTemporarilyTrustedProjectFolders = trustedProjectsFolders;
2159 return instance()->mTemporarilyUntrustedProjectFolders;
2164 instance()->mTemporarilyUntrustedProjectFolders = untrustedProjectsFolders;
2169 QFontMetrics fm( ( QFont() ) );
2170 const double scale = 1.1 * standardSize / 24;
2171 int scaledIconSize =
static_cast< int >( std::floor( std::max(
Qgis::UI_SCALE_FACTOR * fm.height() * scale,
static_cast< double >( standardSize ) ) ) );
2172 if ( applyDevicePixelRatio )
2174 if ( QWidget *activeWindow = QApplication::activeWindow() )
2175 scaledIconSize *= ( activeWindow->screen() ? QApplication::activeWindow()->screen()->devicePixelRatio() : 1 );
2177 return scaledIconSize;
2190 app->installTranslators();
2196 return *sTranslation();
2230 return members()->mActionScopeRegistry.get();
2239 QDir myDir( myPamPath );
2240 if ( !myDir.exists() )
2242 myDir.mkpath( myPamPath );
2245#if defined( Q_OS_WIN )
2246 CPLSetConfigOption(
"GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
2250 int myChangeFlag = 0;
2251 setenv(
"GDAL_PAM_PROXY_DIR", myPamPath.toUtf8(), myChangeFlag );
2258 if ( !qgisPrivateDbFile.exists() )
2262 QFile masterFile( qgisMasterDbFileName );
2268 bool isDbFileCopied = masterFile.copy( qgisPrivateDbFile.fileName() );
2270 if ( !isDbFileCopied )
2274 *errorMessage = tr(
"[ERROR] Can not make qgis.db private copy" );
2279 QFile::Permissions perms = QFile( qgisPrivateDbFile.fileName() ).permissions();
2280 if ( !( perms & QFile::WriteOwner ) )
2282 if ( !qgisPrivateDbFile.setPermissions( perms | QFile::WriteOwner ) )
2286 *errorMessage = tr(
"Can not make '%1' user writable" ).arg( qgisPrivateDbFile.fileName() );
2300 *errorMessage = tr(
"Could not open qgis.db" );
2305 char *errmsg =
nullptr;
2306 int res = sqlite3_exec( database.get(),
"SELECT srs_id FROM tbl_srs LIMIT 0",
nullptr,
nullptr, &errmsg );
2307 if ( res != SQLITE_OK )
2309 sqlite3_free( errmsg );
2314 "DROP INDEX IF EXISTS idx_srsauthid;"
2315 "CREATE TABLE tbl_srs ("
2316 "srs_id INTEGER PRIMARY KEY,"
2317 "description text NOT NULL,"
2318 "projection_acronym text NOT NULL,"
2319 "ellipsoid_acronym NOT NULL,"
2320 "parameters text NOT NULL,"
2322 "auth_name varchar,"
2324 "is_geo integer NOT NULL,"
2325 "deprecated boolean,"
2327 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);",
2336 *errorMessage = tr(
"Creation of missing tbl_srs in the private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
2338 sqlite3_free( errmsg );
2345 res = sqlite3_exec( database.get(),
"SELECT wkt FROM tbl_srs LIMIT 0",
nullptr,
nullptr, &errmsg );
2346 if ( res != SQLITE_OK )
2349 sqlite3_free( errmsg );
2352 "DROP INDEX IF EXISTS idx_srsauthid;"
2353 "DROP TABLE IF EXISTS tbl_srs_bak;"
2354 "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;"
2355 "CREATE TABLE tbl_srs ("
2356 "srs_id INTEGER PRIMARY KEY,"
2357 "description text NOT NULL,"
2358 "projection_acronym text NOT NULL,"
2359 "ellipsoid_acronym NOT NULL,"
2360 "parameters text NOT NULL,"
2362 "auth_name varchar,"
2364 "is_geo integer NOT NULL,"
2365 "deprecated boolean,"
2367 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);"
2368 "INSERT INTO tbl_srs(srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) SELECT "
2369 "srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,'','',is_geo,0 FROM tbl_srs_bak;"
2370 "DROP TABLE tbl_srs_bak",
2379 *errorMessage = tr(
"Migration of private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
2381 sqlite3_free( errmsg );
2387 res = sqlite3_exec( database.get(),
"SELECT acronym FROM tbl_projection LIMIT 0",
nullptr,
nullptr, &errmsg );
2388 if ( res != SQLITE_OK )
2390 sqlite3_free( errmsg );
2395 "CREATE TABLE tbl_projection ("
2396 "acronym varchar(20) NOT NULL PRIMARY KEY,"
2397 "name varchar(255) NOT NULL default '',"
2398 "notes varchar(255) NOT NULL default '',"
2399 "parameters varchar(255) NOT NULL default ''"
2409 *errorMessage = tr(
"Creation of missing tbl_projection in the private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
2411 sqlite3_free( errmsg );
2416 res = sqlite3_exec( database.get(),
"SELECT epsg FROM tbl_srs LIMIT 0",
nullptr,
nullptr, &errmsg );
2417 if ( res == SQLITE_OK )
2422 "DROP INDEX IF EXISTS idx_srsauthid;"
2423 "DROP TABLE IF EXISTS tbl_srs_bak;"
2424 "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;"
2425 "CREATE TABLE tbl_srs ("
2426 "srs_id INTEGER PRIMARY KEY,"
2427 "description text NOT NULL,"
2428 "projection_acronym text NOT NULL,"
2429 "ellipsoid_acronym NOT NULL,"
2430 "parameters text NOT NULL,"
2432 "auth_name varchar,"
2434 "is_geo integer NOT NULL,"
2435 "deprecated boolean,"
2437 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);"
2438 "INSERT INTO tbl_srs(srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) SELECT "
2439 "srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,'','',is_geo,0 FROM tbl_srs_bak;"
2440 "DROP TABLE tbl_srs_bak",
2449 *errorMessage = tr(
"Migration of private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
2451 sqlite3_free( errmsg );
2457 sqlite3_free( errmsg );
2460 if ( sqlite3_exec( database.get(),
"DROP VIEW vw_srs",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
2462 QgsDebugError( u
"vw_srs didn't exists in private qgis.db: %1"_s.arg( errmsg ) );
2467 "CREATE VIEW vw_srs AS"
2469 " a.description AS description"
2470 ",a.srs_id AS srs_id"
2471 ",a.is_geo AS is_geo"
2472 ",coalesce(b.name,a.projection_acronym) AS name"
2473 ",a.parameters AS parameters"
2474 ",a.auth_name AS auth_name"
2475 ",a.auth_id AS auth_id"
2476 ",a.deprecated AS deprecated"
2478 " LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym"
2479 " ORDER BY coalesce(b.name,a.projection_acronym),a.description",
2488 *errorMessage = tr(
"Update of view in private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
2490 sqlite3_free( errmsg );
2517 QThreadPool::globalInstance()->setMaxThreadCount(
maxThreads );
2518 QgsDebugMsgLevel( u
"set QThreadPool max thread count to %1"_s.arg( QThreadPool::globalInstance()->maxThreadCount() ), 2 );
2523 return members()->mTaskManager.get();
2528 return members()->mSettingsRegistryCore.get();
2533 return members()->mColorSchemeRegistry.get();
2538 return members()->mPaintEffectRegistry.get();
2543 return members()->mRendererRegistry.get();
2548 return members()->mRasterRendererRegistry.get();
2553 return members()->mPointCloudRendererRegistry.get();
2558 return members()->mTiledSceneRendererRegistry.get();
2563 if (
auto *lInstance =
instance() )
2565 if ( !
instance()->mDataItemProviderRegistry )
2567 lInstance->mDataItemProviderRegistry = std::make_unique<QgsDataItemProviderRegistry>();
2569 return lInstance->mDataItemProviderRegistry.get();
2575 if ( !sDataItemProviderRegistry )
2577 return sDataItemProviderRegistry;
2583 return members()->mCrsRegistry.get();
2588 return members()->mSvgCache.get();
2593 return members()->mImageCache.get();
2598 return members()->mSourceCache.get();
2603 return members()->mNetworkContentFetcherRegistry.get();
2608 return members()->mValidityCheckRegistry.get();
2613 return members()->mSymbolLayerRegistry.get();
2618 return members()->mCalloutRegistry.get();
2623 return members()->mLayoutItemRegistry.get();
2628 return members()->mAnnotationItemRegistry.get();
2633 return members()->mSensorRegistry.get();
2638 return members()->mPlotRegistry.get();
2643 return members()->mGpsConnectionRegistry.get();
2648 return members()->mGpsBabelFormatRegistry.get();
2653 return members()->mPluginLayerRegistry.get();
2658 return members()->mClassificationMethodRegistry.get();
2663 return members()->mBookmarkManager.get();
2668 return members()->mTileDownloadManager.
get();
2673 return members()->mRecentStyleHandler.get();
2678 return members()->mQueryLogger.get();
2683 return members()->mStyleModel.get();
2688 return members()->mFontManager.get();
2693 return members()->mMessageLog.get();
2698 return members()->mProcessingRegistry.get();
2703 return members()->mConnectionRegistry.get();
2708 return members()->mLayerMetadataProviderRegistry.get();
2713 return members()->mPageSizeRegistry.get();
2718 return members()->mAnnotationRegistry.get();
2723 return members()->mApplicationThemeRegistry.get();
2728 return members()->mNumericFormatRegistry.get();
2733 return members()->mFieldFormatterRegistry.get();
2738 return members()->m3DRendererRegistry.get();
2743 return members()->m3DSymbolRegistry.get();
2748 return members()->mMaterialRegistry.get();
2753 return members()->mScaleBarRendererRegistry.get();
2758 return members()->mLabelingEngineRuleRegistry.get();
2763 return members()->mSymbolConverterRegistry.get();
2768 return members()->mProjectStorageRegistry.get();
2773 return members()->mExternalStorageRegistry.get();
2778 return members()->mProfileSourceRegistry.get();
2783 return members()->mLocalizedDataPathRegistry.get();
2796 profiler->start( tr(
"Create query logger" ) );
2797 mQueryLogger = std::make_unique<QgsDatabaseQueryLog>();
2801 profiler->start( tr(
"Setup coordinate reference system registry" ) );
2802 mCrsRegistry = std::make_unique<QgsCoordinateReferenceSystemRegistry>();
2806 profiler->start( tr(
"Create connection registry" ) );
2811 profiler->start( tr(
"Create project storage registry" ) );
2816 profiler->start( tr(
"Create layer metadata provider registry" ) );
2821 profiler->start( tr(
"Create font manager" ) );
2826 profiler->start( tr(
"Setup task manager" ) );
2831 profiler->start( tr(
"Setup action scope registry" ) );
2836 profiler->start( tr(
"Setup numeric formats" ) );
2841 profiler->start( tr(
"Setup field formats" ) );
2846 profiler->start( tr(
"Setup SVG cache" ) );
2847 mSvgCache = std::make_unique<QgsSvgCache>();
2851 profiler->start( tr(
"Setup image cache" ) );
2856 profiler->start( tr(
"Setup source cache" ) );
2861 profiler->start( tr(
"Setup color scheme registry" ) );
2866 profiler->start( tr(
"Setup paint effect" ) );
2871 profiler->start( tr(
"Setup symbol layer registry" ) );
2876 profiler->start( tr(
"Recent style handler" ) );
2881 profiler->start( tr(
"Setup callout registry" ) );
2886 profiler->start( tr(
"Setup renderer registry" ) );
2891 profiler->start( tr(
"Setup raster renderer registry" ) );
2896 profiler->start( tr(
"Setup point cloud renderer registry" ) );
2901 profiler->start( tr(
"Setup tiled scene renderer registry" ) );
2906 profiler->start( tr(
"Setup GPS registry" ) );
2911 profiler->start( tr(
"Setup GPSBabel format registry" ) );
2916 profiler->start( tr(
"Setup plugin layer registry" ) );
2921 profiler->start( tr(
"Setup Processing registry" ) );
2927 profiler->start( tr(
"Setup layout item registry" ) );
2933 profiler->start( tr(
"Setup annotation registry" ) );
2938 profiler->start( tr(
"Setup application theme registry" ) );
2943 profiler->start( tr(
"Setup annotation item registry" ) );
2949 profiler->start( tr(
"Setup labeling engine rule registry" ) );
2954 profiler->start( tr(
"Setup symbol converter registry" ) );
2960 profiler->start( tr(
"Setup sensor registry" ) );
2966 profiler->start( tr(
"Setup plot registry" ) );
2972 profiler->start( tr(
"Setup 3D material registry" ) );
2978 profiler->start( tr(
"Setup 3D symbol registry" ) );
2983 profiler->start( tr(
"Setup 3D renderer registry" ) );
2988 profiler->start( tr(
"Setup external storage registry" ) );
2993 profiler->start( tr(
"Setup profile source registry" ) );
2998 profiler->start( tr(
"Setup network content cache" ) );
3003 profiler->start( tr(
"Setup layout check registry" ) );
3008 profiler->start( tr(
"Setup classification registry" ) );
3013 profiler->start( tr(
"Setup bookmark manager" ) );
3018 profiler->start( tr(
"Setup tile download manager" ) );
3023 profiler->start( tr(
"Setup scalebar registry" ) );
3085 if (
auto *lInstance =
instance() )
3087 return lInstance->mApplicationMembers.get();
3091 static QRecursiveMutex sMemberMutex;
3092 QMutexLocker lock( &sMemberMutex );
3093 if ( !sApplicationMembers )
3094 sApplicationMembers =
new ApplicationMembers();
3095 return sApplicationMembers;
QFlags< SettingsOption > SettingsOptions
static const double UI_SCALE_FACTOR
UI scaling factor.
A registry for 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.
Registry of user interface themes.
QHash< QString, QString > themeFolders() const
Returns a map of user interface theme names and folders.
QString themeFolder(const QString &name) const
Returns the user interface theme folder for a matching name.
static QString resolvePkgPath()
Calculate the application pkg path.
static int scaleIconSize(int standardSize, bool applyDevicePixelRatio=false)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
static void restoreGdalDriver(const QString &driver)
Sets the GDAL_SKIP environment variable to exclude the specified driver and then calls GDALDriverMana...
static QgsLabelingEngineRuleRegistry * labelingEngineRuleRegistry()
Gets the registry of available labeling engine rules.
static void setCustomVariables(const QVariantMap &customVariables)
Custom expression variables for this application.
QString translation() const
Returns the current application translation locale code.
static QString i18nPath()
Returns the path to the translation directory.
static QgsAnnotationItemRegistry * annotationItemRegistry()
Returns the application's annotation item registry, used for annotation item types.
static QString osName()
Returns a string name of the operating system QGIS is running on.
static void registerOgrDrivers()
Register OGR drivers ensuring this only happens once.
static QString sponsorsFilePath()
Returns the path to the sponsors file.
static QgsRecentStyleHandler * recentStyleHandler()
Returns the handler for recently used style items.
endian_t
Constants for endian-ness.
static QString qgisMasterDatabaseFilePath()
Returns the path to the master qgis.db file.
static void skipGdalDriver(const QString &driver)
Sets the GDAL_SKIP environment variable to include the specified driver and then calls GDALDriverMana...
static QString defaultThemePath()
Returns the path to the default theme directory.
static QgsPageSizeRegistry * pageSizeRegistry()
Returns the application's page size registry, used for managing layout page sizes.
static QgsValidityCheckRegistry * validityCheckRegistry()
Returns the application's validity check registry, used for managing validity checks.
static QgsDataItemProviderRegistry * dataItemProviderRegistry()
Returns the application's data item provider registry, which keeps a list of data item providers that...
static QString userStylePath()
Returns the path to user's style.
static QString platform()
Returns the QGIS platform name, e.g., "desktop", "server", "qgis_process" or "external" (for external...
static QgsProcessingRegistry * processingRegistry()
Returns the application's processing registry, used for managing processing providers,...
static QgsLayerMetadataProviderRegistry * layerMetadataProviderRegistry()
Returns registry of available layer metadata provider implementations.
static QgsSymbolConverterRegistry * symbolConverterRegistry()
Gets the registry of available symbol converters.
static QgsConnectionRegistry * connectionRegistry()
Returns the application's connection registry, used for managing saved data provider connections.
static void exitQgis()
deletes provider registry and map layer registry
static void setPluginPath(const QString &pluginPath)
Alters plugin path - used by 3rd party apps.
static const QgsSettingsEntryStringList * settingsSearchPathsForSVG
Settings entry search path for SVG.
void themeChanged()
Emitted when the application theme has changed.
static QPixmap getThemePixmap(const QString &name, const QColor &foreColor=QColor(), const QColor &backColor=QColor(), int size=16)
Helper to get a theme icon as a pixmap.
static QString nullRepresentation()
Returns the string used to represent the value NULL throughout QGIS.
static QVariantMap customVariables()
Custom expression variables for this application.
static QgsPointCloudRendererRegistry * pointCloudRendererRegistry()
Returns the application's point cloud renderer registry, used for managing point cloud layer 2D rende...
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects.
static QgsSensorRegistry * sensorRegistry()
Returns the application's sensor registry, used for sensor types.
static QString pluginPath()
Returns the path to the application plugin directory.
static void setUITheme(const QString &themeName)
Set the current UI theme used to style the interface.
static bool createDatabase(QString *errorMessage=nullptr)
initialize qgis.db
static const QgsSettingsEntryBool * settingsLocaleOverrideFlag
Settings entry locale override flag.
static void setTemporarilyUntrustedProjectsFolders(const QStringList &untrustedProjectsFolders)
Sets the list of projects and folders that have been temporarily determined as untrusted by the user.
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
static int systemMemorySizeMb()
Returns the size of the system memory (RAM) in megabytes.
static void setLocale(const QLocale &locale)
Sets the QGIS locale - used mainly by 3rd party apps and tests.
static void init(QString profileFolder=QString())
This method initializes paths etc for QGIS.
static const QgsSettingsEntryString * settingsNullRepresentation
static void setThemeName(const QString &themeName)
Set the active theme to the specified theme.
void customVariablesChanged()
Emitted whenever a custom global variable changes.
static QString buildSourcePath()
Returns path to the source directory.
static QString buildOutputPath()
Returns path to the build output directory.
bool notify(QObject *receiver, QEvent *event) override
Catch exceptions when sending event to receiver.
static int maxThreads()
Gets maximum concurrent thread count.
static QgsColorSchemeRegistry * colorSchemeRegistry()
Returns the application's color scheme registry, used for managing color schemes.
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
static QString reportStyleSheet(QgsApplication::StyleSheetType styleSheetType=QgsApplication::StyleSheetType::Qt)
Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet...
static QString pkgDataPath()
Returns the common root path of all application data directories.
static QgsScaleBarRendererRegistry * scaleBarRendererRegistry()
Gets the registry of available scalebar renderers.
static QgsLayoutItemRegistry * layoutItemRegistry()
Returns the application's layout item registry, used for layout item types.
static void setFileOpenEventReceiver(QObject *receiver)
Sets the FileOpen event receiver.
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers.
static QgsRasterRendererRegistry * rasterRendererRegistry()
Returns the application's raster renderer registry, used for managing raster layer renderers.
static void applyGdalSkippedDrivers()
Apply the skipped drivers list to gdal.
static void setMaxThreads(int maxThreads)
Set maximum concurrent thread count.
static QgsNumericFormatRegistry * numericFormatRegistry()
Gets the registry of available numeric formats.
static QgsNetworkContentFetcherRegistry * networkContentFetcherRegistry()
Returns the application's network content registry used for fetching temporary files during QGIS sess...
static QgsProjectStorageRegistry * projectStorageRegistry()
Returns registry of available project storage implementations.
static QString licenceFilePath()
Returns the path to the licence file.
static QString libexecPath()
Returns the path with utility executables (help viewer, crssync, ...).
static QStringList skippedGdalDrivers()
Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable).
StyleSheetType
The StyleSheetType enum represents the stylesheet type that a widget supports.
@ Qt
StyleSheet for Qt GUI widgets (based on QLabel or QTextBrowser), supports basic CSS and Qt extensions...
@ WebBrowser
StyleSheet for embedded browsers (QtWebKit), supports full standard CSS.
static QString translatorsFilePath()
Returns the path to the sponsors file.
static const QgsSettingsEntryString * settingsLocaleGlobalLocale
Settings entry locale global locale.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static void setNullRepresentation(const QString &nullRepresentation)
Sets the string used to represent the value NULL throughout QGIS.
static QStringList temporarilyTrustedProjectsFolders()
Returns the list of projects and folders that have been temporarily determined as trusted by the user...
static QString applicationFullName()
Returns the QGIS application full name.
static QgsGpsConnectionRegistry * gpsConnectionRegistry()
Returns the application's GPS connection registry, used for managing GPS connections.
static QString locale()
Returns the QGIS locale.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
static QStringList svgPaths()
Returns the paths to svg directories.
static void initQgis()
loads providers
static QString showSettings()
Convenience function to get a summary of the paths used in this application instance useful for debug...
bool event(QEvent *event) override
Watch for QFileOpenEvent.
static void setPkgDataPath(const QString &pkgDataPath)
Alters pkg data path - used by 3rd party apps.
static QString absolutePathToRelativePath(const QString &apath, const QString &targetPath)
Converts absolute path to path relative to target.
static const QgsSettingsEntryString * settingsLocaleUserLocale
Settings entry locale user locale.
static QgsRuntimeProfiler * profiler()
Returns the application runtime profiler.
~QgsApplication() override
static QgsLocalizedDataPathRegistry * localizedDataPathRegistry()
Returns the registry of data repositories These are used as paths for basemaps, logos,...
static const char * QGIS_APPLICATION_NAME
static QgsTileDownloadManager * tileDownloadManager()
Returns the application's tile download manager, used for download of map tiles when rendering.
static const char * QGIS_ORGANIZATION_DOMAIN
static QMap< QString, QString > systemEnvVars()
Returns the system environment variables passed to application.
static void setAuthDatabaseDirPath(const QString &authDbDirPath)
Alters authentication data base directory path - used by 3rd party apps.
static QgsAuthConfigurationStorageRegistry * authConfigurationStorageRegistry()
Returns the application's authentication configuration storage registry.
static QString prefixPath()
Returns the path to the application prefix directory.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
static QgsFontManager * fontManager()
Returns the application font manager, which manages available fonts and font installation for the QGI...
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
static QgsDatabaseQueryLog * databaseQueryLog()
Returns the database query log.
static QgsMessageLog * messageLog()
Returns the application's message log.
void preNotify(QObject *receiver, QEvent *event, bool *done)
static bool createThemeFolder()
Create the users theme folder.
static QString metadataPath()
Returns the path to the metadata directory.
void localeChanged()
Emitted when project locale has been changed.
static QgsActionScopeRegistry * actionScopeRegistry()
Returns the action scope registry.
static QgsCoordinateReferenceSystemRegistry * coordinateReferenceSystemRegistry()
Returns the application's coordinate reference system (CRS) registry, which handles known CRS definit...
static const char * QGIS_ORGANIZATION_NAME
static QString contributorsFilePath()
Returns the path to the contributors file.
void collectTranslatableObjects(QgsTranslationContext *translationContext)
Emits the signal to collect all the strings of .qgs to be included in ts file.
static QgsSourceCache * sourceCache()
Returns the application's source cache, used for caching embedded and remote source strings as local ...
static QStringList temporarilyUntrustedProjectsFolders()
Returns the list of projects and folders that have been temporarily determined as untrusted by the us...
static QRegularExpression shortNameRegularExpression()
Returns the short name regular expression for line edit validator.
static QgsTaskManager * taskManager()
Returns the application's task manager, used for managing application wide background task handling.
static QgsProfileSourceRegistry * profileSourceRegistry()
Returns registry of available profile source implementations.
static QgsAnnotationRegistry * annotationRegistry()
Returns the application's annotation registry, used for managing annotation types.
static QgsPluginLayerRegistry * pluginLayerRegistry()
Returns the application's plugin layer registry, used for managing plugin layer types.
static QgsClassificationMethodRegistry * classificationMethodRegistry()
Returns the application's classification methods registry, used in graduated renderer.
static QStringList deferredSkippedGdalDrivers()
Returns the list of gdal drivers that have been disabled in the current session, and thus,...
static QString qgisAuthDatabaseUri()
Returns the URI to the user authentication database.
static QString defaultStylePath()
Returns the path to default style (works as a starting point).
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
static QString qmlImportPath()
Returns the path where QML components are installed for QGIS Quick library.
static QgsApplicationThemeRegistry * applicationThemeRegistry()
Returns the application's theme registry, used for styling the user interface.
QgsApplication(int &argc, char **argv, bool GUIenabled, const QString &profileFolder=QString(), const QString &platformName="external")
Constructor for QgsApplication.
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.
static const QgsSettingsEntryInteger * settingsConnectionPoolMaximumConcurrentConnections
Settings entry to configure the maximum number of concurrent connections within connection pools.
static Q_DECL_DEPRECATED QString qgisAuthDatabaseFilePath()
Returns the path to the user authentication database file: qgis-auth.db.
static QString authorsFilePath()
Returns the path to the authors file.
static QgsBookmarkManager * bookmarkManager()
Returns the application's bookmark manager, used for storing installation-wide bookmarks.
static QString qgisUserDatabaseFilePath()
Returns the path to the user qgis.db file.
static QgsFieldFormatterRegistry * fieldFormatterRegistry()
Gets the registry of available field formatters.
static QString activeThemePath()
Returns the path to the currently active theme directory.
static QString defaultThemesFolder()
Returns the path to default themes folder from install (works as a starting point).
static void setTemporarilyTrustedProjectsFolders(const QStringList &trustedProjectsFolders)
Sets the list of projects and folders that have been temporarily determined as trusted by the user.
static void setSkippedGdalDrivers(const QStringList &skippedGdalDrivers, const QStringList &deferredSkippedGdalDrivers)
Sets the list of gdal drivers that should be disabled (skippedGdalDrivers), but excludes for now the ...
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
static QgsMaterialRegistry * materialRegistry()
Returns registry of available 3D materials.
static void setTranslation(const QString &translation)
Set translation locale code.
static QgsCalloutRegistry * calloutRegistry()
Returns the application's callout registry, used for managing callout types.
static void setPrefixPath(const QString &prefixPath, bool useDefaultPaths=false)
Alters prefix path - used by 3rd party apps.
static QgsStyleModel * defaultStyleModel()
Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).
static QString relativePathToAbsolutePath(const QString &rpath, const QString &targetPath)
Converts path relative to target to an absolute path.
static void setSvgPaths(const QStringList &svgPaths)
Sets the paths to svg directories and invalidates the svg path list cache.
static QgsBabelFormatRegistry * gpsBabelFormatRegistry()
Returns the application's GPSBabel format registry, used for managing GPSBabel formats.
static endian_t endian()
Returns whether this machine uses big or little endian.
int maxConcurrentConnectionsPerPool() const
The maximum number of concurrent connections per connections pool.
static void setCustomVariable(const QString &name, const QVariant &value)
Set a single custom expression variable.
void requestForTranslatableObjects(QgsTranslationContext *translationContext)
Emitted when project strings which require translation are being collected for inclusion in a ....
static QString iconsPath()
Returns the path to the icons image directory.
static Qgs3DSymbolRegistry * symbol3DRegistry()
Returns registry of available 3D symbols.
static QgsExternalStorageRegistry * externalStorageRegistry()
Returns registry of available external storage implementations.
static QHash< QString, QString > uiThemes()
All themes found in ~/.qgis3/themes folder.
static QString splashPath()
Returns the path to the splash screen image directory.
static QString donorsFilePath()
Returns the path to the donors file.
static QString themeName()
Set the active theme to the specified theme.
void nullRepresentationChanged()
Emitted when the string representing the NULL value is changed.
static QString srsDatabaseFilePath()
Returns the path to the srs.db file.
static QString userThemesFolder()
Returns the path to user's themes folder.
static void registerGdalDriversFromSettings()
Register gdal drivers, excluding the ones mentioned in "gdal/skipList" setting.
static QgsPlotRegistry * plotRegistry()
Returns the application's plot registry, used for plot types.
static Qgs3DRendererRegistry * renderer3DRegistry()
Returns registry of available 3D renderers.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
static QgsTiledSceneRendererRegistry * tiledSceneRendererRegistry()
Returns the application's tiled scene renderer registry, used for managing tiled scene layer 2D rende...
static void setDefaultSvgPaths(const QStringList &pathList)
Alters default svg paths - used by 3rd party apps.
static QString libraryPath()
Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries.
static QStringList layoutTemplatePaths()
Returns the paths to layout template directories.
static const QgsSettingsEntryBool * settingsLocaleShowGroupSeparator
Settings entry locale show group separator.
static QString userFullName()
Returns the user's operating system login account full display name.
static Q_DECL_DEPRECATED QgsSettingsRegistryCore * settingsRegistryCore()
Returns the application's settings registry, used for managing application settings.
static QString serverResourcesPath()
Returns the path to the server resources directory.
static QString appIconPath()
Gets application icon.
static QString userLoginName()
Returns the user's operating system login account name.
Registry for authentication configuration storages.
Singleton which offers an interface to manage the authentication configuration database and to utiliz...
QgsAuthConfigurationStorageRegistry * authConfigurationStorageRegistry() const
Returns the authentication configuration storage registry.
void setup(const QString &pluginPath=QString(), const QString &authDatabasePath=QString())
Sets up the authentication manager configuration.
static QgsAuthManager * instance()
Enforce singleton pattern.
Manages storage of a set of bookmarks.
void initialize(const QString &filePath)
Initializes the bookmark manager.
Registry of available callout classes.
Manages all known classification methods.
Registry of color schemes.
void addDefaultSchemes()
Adds all default color schemes to this color scheme.
void initStyleScheme()
Initializes the default random style color scheme for the user.
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.
static void invalidateCache(bool disableCache=false)
Clears the internal cache used to initialize QgsCoordinateReferenceSystem objects.
A registry for data item providers that may add items to the browser tree.
Handles logging of database queries.
static void invalidateCache(bool disableCache=false)
Clears the internal cache used.
Defines a QGIS exception class.
static void cleanRegisteredFunctions()
Deletes all registered functions whose ownership have been transferred to the expression engine.
Registry of external storage backends used by QgsExternalResourceWidget.
Manages available fonts and font installation for a QGIS instance.
void installUserFonts()
Installs user fonts from the profile/fonts directory as application fonts.
Registers existing GPS connections such that the information is available to all classes and plugins.
A cache for images derived from raster files.
A registry for labeling engine rules.
Registry of available layout item types.
static const QgsSettingsEntryStringList * settingsSearchPathForTemplates
Settings entry search path for templates.
A registry class to hold localized data paths which can be used for basemaps, logos,...
Registry of available 3d material settings classes.
Temporarily blocks the application QgsMessageLog (see QgsApplication::messageLog()) from emitting the...
Interface for logging messages from QGIS in GUI independent way.
static QgsNetworkAccessManager * instance(Qt::ConnectionType connectionType=Qt::BlockingQueuedConnection)
Returns a pointer to the active QgsNetworkAccessManager for the current thread.
Registry for temporary fetched files.
A registry for known page sizes.
Registry of available paint effects.
Registry of available plot types.
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 profile sources used by QgsProfilePlotRenderer.
static QStringList searchPaths()
Returns the current list of Proj file search paths.
Registry of storage backends that QgsProject may use.
static QgsProject * instance()
Returns the QgsProject singleton instance.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
Registry for raster renderers.
A convenience class that simplifies locking and unlocking QReadWriteLocks.
void changeMode(Mode mode)
Change the mode of the lock to mode.
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...
A registry which manages registered scalebar renderers.
Scoped object for logging of the runtime for a single operation or group of operations.
Registry of available sensor types.
A boolean settings entry.
An integer settings entry.
A string list settings entry.
Custom exception class for settings related exceptions.
Used for settings introspection and collects all QgsSettingsEntry instances of core.
static QgsSettingsTreeNode * sTreeLocale
static QgsSettingsTreeNode * sTreeSvg
static QgsSettingsTreeNode * sTreeQgis
static QgsSettingsTreeNode * sTreeCore
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
QStringList childKeys() const
Returns a list of all top-level keys that can be read using the QSettings object.
void remove(const QString &key, QgsSettings::Section section=QgsSettings::NoSection)
Removes the setting key and any sub-settings of key in a section.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
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 database of saved style entities, including symbols, color ramps, text formats and others.
static void cleanDefaultStyle()
Deletes the default style. Only to be used by QgsApplication::exitQgis().
static QgsStyle * defaultStyle(bool initialize=true)
Returns the default application-wide style.
A cache for images / pictures derived from SVG files.
QImage svgAsImage(const QString &path, double size, const QColor &fill, const QColor &stroke, double strokeWidth, double widthScaleFactor, bool &fitsInCache, double fixedAspectRatio=0, bool blocking=false, const QMap< QString, QString > ¶meters=QMap< QString, QString >())
Returns an SVG drawing as a QImage.
QByteArray svgContent(const QString &path, double size, const QColor &fill, const QColor &stroke, double strokeWidth, double widthScaleFactor, double fixedAspectRatio=0, bool blocking=false, const QMap< QString, QString > ¶meters=QMap< QString, QString >(), bool *isMissingImage=nullptr)
Gets the SVG content corresponding to the given path.
A registry of known symbol converters.
Registry of available symbol layer classes.
static QColor decodeColor(const QString &str)
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.
QgsTileDownloadManagerReply * get(const QNetworkRequest &request)
Starts a request.
Registry of 2D renderers for tiled scenes.
Used for the collecting of strings from projects for translation and creation of ts files.
A manager for QGIS user profiles.
std::unique_ptr< QgsUserProfile > getProfile(const QString &defaultProfile="default", bool createNew=true, bool initSettings=true)
Returns the profile from the given root profile location.
static QString resolveProfilesFolder(const QString &basePath=QString())
Resolves the profiles folder for the given path.
A registry that keeps a list of QgsAbstractValidityCheck checks which can be used when performing val...
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
int open(const QString &path)
Opens the database at the specified file path.
QMap< QString, QString > QgsStringMap
QObject * ABISYM(QgsApplication::mFileOpenEventReceiver)
Q_GLOBAL_STATIC_WITH_ARGS(PalPropertyList, palHiddenProperties,({ static_cast< int >(QgsPalLayerSettings::Property::PositionX), static_cast< int >(QgsPalLayerSettings::Property::PositionY), static_cast< int >(QgsPalLayerSettings::Property::Show), static_cast< int >(QgsPalLayerSettings::Property::LabelRotation), static_cast< int >(QgsPalLayerSettings::Property::Family), static_cast< int >(QgsPalLayerSettings::Property::FontStyle), static_cast< int >(QgsPalLayerSettings::Property::Size), static_cast< int >(QgsPalLayerSettings::Property::Bold), static_cast< int >(QgsPalLayerSettings::Property::Italic), static_cast< int >(QgsPalLayerSettings::Property::Underline), static_cast< int >(QgsPalLayerSettings::Property::Color), static_cast< int >(QgsPalLayerSettings::Property::Strikeout), static_cast< int >(QgsPalLayerSettings::Property::MultiLineAlignment), static_cast< int >(QgsPalLayerSettings::Property::BufferSize), static_cast< int >(QgsPalLayerSettings::Property::BufferDraw), static_cast< int >(QgsPalLayerSettings::Property::BufferColor), static_cast< int >(QgsPalLayerSettings::Property::LabelDistance), static_cast< int >(QgsPalLayerSettings::Property::Hali), static_cast< int >(QgsPalLayerSettings::Property::Vali), static_cast< int >(QgsPalLayerSettings::Property::ScaleVisibility), static_cast< int >(QgsPalLayerSettings::Property::MinScale), static_cast< int >(QgsPalLayerSettings::Property::MaxScale), static_cast< int >(QgsPalLayerSettings::Property::AlwaysShow), static_cast< int >(QgsPalLayerSettings::Property::CalloutDraw), static_cast< int >(QgsPalLayerSettings::Property::LabelAllParts) })) Q_GLOBAL_STATIC_WITH_ARGS(SymbolPropertyList
const QString cacheKey(const QString &pathIn)
Q_GLOBAL_STATIC(QReadWriteLock, sDefinitionCacheLock)
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)
std::unique_ptr< QgsBookmarkManager > mBookmarkManager
std::unique_ptr< QgsRasterRendererRegistry > mRasterRendererRegistry
std::unique_ptr< QgsProcessingRegistry > mProcessingRegistry
std::unique_ptr< QgsTaskManager > mTaskManager
std::unique_ptr< QgsAnnotationRegistry > mAnnotationRegistry
std::unique_ptr< QgsCoordinateReferenceSystemRegistry > mCrsRegistry
std::unique_ptr< QgsGpsConnectionRegistry > mGpsConnectionRegistry
std::unique_ptr< QgsLabelingEngineRuleRegistry > mLabelingEngineRuleRegistry
std::unique_ptr< QgsPointCloudRendererRegistry > mPointCloudRendererRegistry
std::unique_ptr< QgsRendererRegistry > mRendererRegistry
std::unique_ptr< Qgs3DSymbolRegistry > m3DSymbolRegistry
std::unique_ptr< QgsPlotRegistry > mPlotRegistry
std::unique_ptr< QgsApplicationThemeRegistry > mApplicationThemeRegistry
QString mNullRepresentation
std::unique_ptr< QgsRecentStyleHandler > mRecentStyleHandler
std::unique_ptr< QgsClassificationMethodRegistry > mClassificationMethodRegistry
std::unique_ptr< QgsSensorRegistry > mSensorRegistry
std::unique_ptr< QgsPluginLayerRegistry > mPluginLayerRegistry
std::unique_ptr< QgsDatabaseQueryLog > mQueryLogger
std::unique_ptr< QgsScaleBarRendererRegistry > mScaleBarRendererRegistry
std::unique_ptr< QgsNumericFormatRegistry > mNumericFormatRegistry
std::unique_ptr< QgsLayoutItemRegistry > mLayoutItemRegistry
std::unique_ptr< QgsTiledSceneRendererRegistry > mTiledSceneRendererRegistry
std::unique_ptr< QgsStyleModel > mStyleModel
std::unique_ptr< QgsAnnotationItemRegistry > mAnnotationItemRegistry
std::unique_ptr< QgsImageCache > mImageCache
std::unique_ptr< Qgs3DRendererRegistry > m3DRendererRegistry
std::unique_ptr< QgsCalloutRegistry > mCalloutRegistry
std::unique_ptr< QgsSourceCache > mSourceCache
std::unique_ptr< QgsFontManager > mFontManager
std::unique_ptr< QgsSettingsRegistryCore > mSettingsRegistryCore
std::unique_ptr< QgsSymbolConverterRegistry > mSymbolConverterRegistry
std::unique_ptr< QgsPageSizeRegistry > mPageSizeRegistry
std::unique_ptr< QgsExternalStorageRegistry > mExternalStorageRegistry
std::unique_ptr< QgsProfileSourceRegistry > mProfileSourceRegistry
std::unique_ptr< QgsSvgCache > mSvgCache
std::unique_ptr< QgsPaintEffectRegistry > mPaintEffectRegistry
std::unique_ptr< QgsColorSchemeRegistry > mColorSchemeRegistry
std::unique_ptr< QgsActionScopeRegistry > mActionScopeRegistry
std::unique_ptr< QgsBabelFormatRegistry > mGpsBabelFormatRegistry
std::unique_ptr< QgsMaterialRegistry > mMaterialRegistry
std::unique_ptr< QgsTileDownloadManager > mTileDownloadManager
std::unique_ptr< QgsValidityCheckRegistry > mValidityCheckRegistry
std::unique_ptr< QgsNetworkContentFetcherRegistry > mNetworkContentFetcherRegistry
std::unique_ptr< QgsConnectionRegistry > mConnectionRegistry
std::unique_ptr< QgsFieldFormatterRegistry > mFieldFormatterRegistry
std::unique_ptr< QgsProjectStorageRegistry > mProjectStorageRegistry
std::unique_ptr< QgsMessageLog > mMessageLog
QStringList mSvgPathCache
std::unique_ptr< QgsLocalizedDataPathRegistry > mLocalizedDataPathRegistry
std::unique_ptr< QgsLayerMetadataProviderRegistry > mLayerMetadataProviderRegistry
std::unique_ptr< QgsSymbolLayerRegistry > mSymbolLayerRegistry