90 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 
   91 #include <QDesktopWidget> 
   96 #include <QFileOpenEvent> 
   97 #include <QMessageBox> 
  100 #include <QProcessEnvironment> 
  103 #include <QThreadPool> 
  106 #include <QLibraryInfo> 
  107 #include <QStandardPaths> 
  108 #include <QRegularExpression> 
  109 #include <QTextStream> 
  111 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) 
  112 #include <QRecursiveMutex> 
  116 #include <netinet/in.h> 
  122 #define SECURITY_WIN32 
  123 #include <security.h> 
  125 #pragma comment( lib, "Secur32.lib" )
 
  129 #include "qgsconfig.h" 
  133 #include <cpl_conv.h>  
  140 #define CONN_POOL_MAX_CONCURRENT_CONNS      4 
  142 QObject *
ABISYM( QgsApplication::mFileOpenEventReceiver ) = 
nullptr;
 
  143 bool ABISYM( QgsApplication::mInitialized ) = 
false;
 
  144 bool ABISYM( QgsApplication::mRunningFromBuildDir ) = 
false;
 
  148 QgsApplication::ApplicationMembers *QgsApplication::sApplicationMembers = 
nullptr;
 
  150 int ABISYM( QgsApplication::sMaxThreads ) = -1;
 
  167 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 
  183   : QApplication( argc, argv, GUIenabled )
 
  185   *sPlatformName() = platformName;
 
  187   if ( *sTranslation() != QLatin1String( 
"C" ) )
 
  189     mQgisTranslator = 
new QTranslator();
 
  190     if ( mQgisTranslator->load( QStringLiteral( 
"qgis_" ) + *sTranslation(), i18nPath() ) )
 
  192       installTranslator( mQgisTranslator );
 
  196       QgsDebugMsgLevel( QStringLiteral( 
"loading of qgis translation failed %1/qgis_%2" ).arg( i18nPath(), *sTranslation() ), 2 );
 
  204     QString qtTranslationsPath = QLibraryInfo::location( QLibraryInfo::TranslationsPath );
 
  206     QString prefix = QDir( QString( 
"%1/../" ).arg( QApplication::applicationDirPath() ) ).absolutePath();
 
  207     qtTranslationsPath = prefix + qtTranslationsPath.mid( QLibraryInfo::location( QLibraryInfo::PrefixPath ).length() );
 
  210     mQtTranslator = 
new QTranslator();
 
  211     if ( mQtTranslator->load( QStringLiteral( 
"qt_" ) + *sTranslation(), qtTranslationsPath ) )
 
  213       installTranslator( mQtTranslator );
 
  217       QgsDebugMsgLevel( QStringLiteral( 
"loading of qt translation failed %1/qt_%2" ).arg( qtTranslationsPath, *sTranslation() ), 2 );
 
  220     mQtBaseTranslator = 
new QTranslator();
 
  221     if ( mQtBaseTranslator->load( QStringLiteral( 
"qtbase_" ) + *sTranslation(), qtTranslationsPath ) )
 
  223       installTranslator( mQtBaseTranslator );
 
  227       QgsDebugMsgLevel( QStringLiteral( 
"loading of qtbase translation failed %1/qt_%2" ).arg( qtTranslationsPath, *sTranslation() ), 2 );
 
  231   mApplicationMembers = 
new ApplicationMembers();
 
  233   *sProfilePath() = profileFolder;
 
  240   if ( profileFolder.isEmpty() )
 
  242     if ( getenv( 
"QGIS_CUSTOM_CONFIG_PATH" ) )
 
  244       profileFolder = getenv( 
"QGIS_CUSTOM_CONFIG_PATH" );
 
  248       profileFolder = QStandardPaths::standardLocations( QStandardPaths::AppDataLocation ).value( 0 );
 
  255     profileFolder = profile->
folder();
 
  259   *sProfilePath() = profileFolder;
 
  261   static std::once_flag sMetaTypesRegistered;
 
  262   std::call_once( sMetaTypesRegistered, []
 
  264     qRegisterMetaType<QgsGeometry::Error>( 
"QgsGeometry::Error" );
 
  265     qRegisterMetaType<QgsProcessingFeatureSourceDefinition>( 
"QgsProcessingFeatureSourceDefinition" );
 
  266     qRegisterMetaType<QgsProcessingOutputLayerDefinition>( 
"QgsProcessingOutputLayerDefinition" );
 
  267     qRegisterMetaType<QgsUnitTypes::LayoutUnit>( 
"QgsUnitTypes::LayoutUnit" );
 
  268     qRegisterMetaType<QgsFeatureId>( 
"QgsFeatureId" );
 
  269     qRegisterMetaType<QgsFields>( 
"QgsFields" );
 
  270     qRegisterMetaType<QgsFeatureIds>( 
"QgsFeatureIds" );
 
  271     qRegisterMetaType<QgsProperty>( 
"QgsProperty" );
 
  272     qRegisterMetaType<QgsFeatureStoreList>( 
"QgsFeatureStoreList" );
 
  273     qRegisterMetaType<Qgis::MessageLevel>( 
"Qgis::MessageLevel" );
 
  274     qRegisterMetaType<Qgis::BrowserItemState>( 
"Qgis::BrowserItemState" );
 
  275     qRegisterMetaType<QgsReferencedRectangle>( 
"QgsReferencedRectangle" );
 
  276     qRegisterMetaType<QgsReferencedPointXY>( 
"QgsReferencedPointXY" );
 
  277     qRegisterMetaType<QgsReferencedGeometry>( 
"QgsReferencedGeometry" );
 
  278     qRegisterMetaType<QgsLayoutRenderContext::Flags>( 
"QgsLayoutRenderContext::Flags" );
 
  279     qRegisterMetaType<QgsStyle::StyleEntity>( 
"QgsStyle::StyleEntity" );
 
  280     qRegisterMetaType<QgsCoordinateReferenceSystem>( 
"QgsCoordinateReferenceSystem" );
 
  281     qRegisterMetaType<QgsAuthManager::MessageLevel>( 
"QgsAuthManager::MessageLevel" );
 
  282     qRegisterMetaType<QgsNetworkRequestParameters>( 
"QgsNetworkRequestParameters" );
 
  283     qRegisterMetaType<QgsNetworkReplyContent>( 
"QgsNetworkReplyContent" );
 
  284     qRegisterMetaType<QgsGeometry>( 
"QgsGeometry" );
 
  285     qRegisterMetaType<QgsDatumTransform::GridDetails>( 
"QgsDatumTransform::GridDetails" );
 
  286     qRegisterMetaType<QgsDatumTransform::TransformDetails>( 
"QgsDatumTransform::TransformDetails" );
 
  287     qRegisterMetaType<QgsNewsFeedParser::Entry>( 
"QgsNewsFeedParser::Entry" );
 
  288     qRegisterMetaType<QgsRectangle>( 
"QgsRectangle" );
 
  289     qRegisterMetaType<QgsLocatorResult>( 
"QgsLocatorResult" );
 
  290     qRegisterMetaType<QgsProcessingModelChildParameterSource>( 
"QgsProcessingModelChildParameterSource" );
 
  291 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 
  294     qRegisterMetaTypeStreamOperators<QgsProcessingModelChildParameterSource>( 
"QgsProcessingModelChildParameterSource" );
 
  296     qRegisterMetaType<QgsRemappingSinkDefinition>( 
"QgsRemappingSinkDefinition" );
 
  297     qRegisterMetaType<QgsProcessingModelChildDependency>( 
"QgsProcessingModelChildDependency" );
 
  298     qRegisterMetaType<QgsTextFormat>( 
"QgsTextFormat" );
 
  299 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 
  300     QMetaType::registerComparators<QgsProcessingModelChildDependency>();
 
  301     QMetaType::registerEqualsComparator<QgsProcessingFeatureSourceDefinition>();
 
  302     QMetaType::registerEqualsComparator<QgsProperty>();
 
  303     QMetaType::registerEqualsComparator<QgsDateTimeRange>();
 
  304     QMetaType::registerEqualsComparator<QgsDateRange>();
 
  306     qRegisterMetaType<QPainter::CompositionMode>( 
"QPainter::CompositionMode" );
 
  307     qRegisterMetaType<QgsDateTimeRange>( 
"QgsDateTimeRange" );
 
  308     qRegisterMetaType<QList<QgsMapLayer *>>( 
"QList<QgsMapLayer*>" );
 
  313   if ( ABISYM( mRunningFromBuildDir ) )
 
  316     *sPrefixPath() = QString(); 
 
  317 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 
  318     setPluginPath( *sBuildOutputPath() + 
'/' + QString( QGIS_PLUGIN_SUBDIR ) + 
'/' + *sCfgIntDir() );
 
  320     setPluginPath( *sBuildOutputPath() + 
'/' + QStringLiteral( QGIS_PLUGIN_SUBDIR ) );
 
  322     setPkgDataPath( *sBuildOutputPath() + QStringLiteral( 
"/data" ) ); 
 
  323     *sLibraryPath() = *sBuildOutputPath() + 
'/' + QGIS_LIB_SUBDIR + 
'/';
 
  324 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 
  325     *sLibexecPath() = *sBuildOutputPath() + 
'/' + QGIS_LIBEXEC_SUBDIR + 
'/' + *sCfgIntDir() + 
'/';
 
  327     *sLibexecPath() = *sBuildOutputPath() + 
'/' + QGIS_LIBEXEC_SUBDIR + 
'/';
 
  329 #if defined( HAVE_QUICK ) 
  330     *sQmlImportPath() = *sBuildOutputPath() + 
'/' + QGIS_QML_SUBDIR + 
'/';
 
  335     char *
prefixPath = getenv( 
"QGIS_PREFIX_PATH" );
 
  338       if ( sPrefixPath()->isNull() )
 
  340 #if defined(Q_OS_MACX) || defined(Q_OS_WIN) 
  342 #elif defined(ANDROID) 
  344         QDir myDir( QDir::homePath() );
 
  346         QString myPrefix = myDir.absolutePath();
 
  349         QDir myDir( applicationDirPath() );
 
  351         if ( applicationDirPath().contains( QStringLiteral( 
"cgi-bin" ) ) )
 
  356         QString myPrefix = myDir.absolutePath();
 
  367   *sConfigPath() = profileFolder + 
'/'; 
 
  371   if ( getenv( 
"QGIS_AUTH_DB_DIR_PATH" ) )
 
  377   QMap<QString, QString> systemEnvVarMap;
 
  378   QString passfile( QStringLiteral( 
"QGIS_AUTH_PASSWORD_FILE" ) ); 
 
  380   const auto systemEnvironment = QProcessEnvironment::systemEnvironment().toStringList();
 
  381   for ( 
const QString &varStr : systemEnvironment )
 
  383     int pos = varStr.indexOf( QLatin1Char( 
'=' ) );
 
  386     QString varStrName = varStr.left( pos );
 
  387     QString varStrValue = varStr.mid( pos + 1 );
 
  388     if ( varStrName != passfile )
 
  390       systemEnvVarMap.insert( varStrName, varStrValue );
 
  393   *sSystemEnvVars() = systemEnvVarMap;
 
  400   QString projLib( QDir::cleanPath( 
pkgDataPath().append( 
"/proj" ) ) );
 
  401   if ( QFile::exists( projLib ) )
 
  403     currentProjSearchPaths.append( projLib );
 
  407   char **newPaths = 
new char *[currentProjSearchPaths.length()];
 
  408   for ( 
int i = 0; i < currentProjSearchPaths.count(); ++i )
 
  410     newPaths[i] = CPLStrdup( currentProjSearchPaths.at( i ).toUtf8().constData() );
 
  412   proj_context_set_search_paths( 
nullptr, currentProjSearchPaths.count(), newPaths );
 
  413   for ( 
int i = 0; i < currentProjSearchPaths.count(); ++i )
 
  415     CPLFree( newPaths[i] );
 
  420   QCoreApplication::addLibraryPath( 
pluginPath() );
 
  425   ABISYM( sMaxThreads ) = -1;
 
  438   if ( !members()->mStyleModel )
 
  441   ABISYM( mInitialized ) = 
true;
 
  446   delete mDataItemProviderRegistry;
 
  447   delete mApplicationMembers;
 
  448   delete mQgisTranslator;
 
  449   delete mQtTranslator;
 
  450   delete mQtBaseTranslator;
 
  458 void QgsApplication::invalidateCaches()
 
  470   return qobject_cast<QgsApplication *>( QCoreApplication::instance() );
 
  476   if ( 
event->type() == QEvent::FileOpen )
 
  479     if ( ABISYM( mFileOpenEventReceiver ) )
 
  482       done = 
notify( ABISYM( mFileOpenEventReceiver ), 
event );
 
  489       sFileOpenEventList()->append( 
static_cast<QFileOpenEvent *
>( 
event )->file() );
 
  496     done = QApplication::event( 
event );
 
  505   if ( thread() == receiver->thread() )
 
  515     done = QApplication::notify( receiver, 
event );
 
  519     qCritical() << 
"Caught unhandled QgsException: " << e.
what();
 
  520     if ( qApp->thread() == QThread::currentThread() )
 
  521       QMessageBox::critical( activeWindow(), tr( 
"Exception" ), e.
what() );
 
  523   catch ( std::exception &e )
 
  525     qCritical() << 
"Caught unhandled std::exception: " << e.
what();
 
  526     if ( qApp->thread() == QThread::currentThread() )
 
  527       QMessageBox::critical( activeWindow(), tr( 
"Exception" ), e.
what() );
 
  531     qCritical() << 
"Caught unhandled unknown exception";
 
  532     if ( qApp->thread() == QThread::currentThread() )
 
  533       QMessageBox::critical( activeWindow(), tr( 
"Exception" ), tr( 
"unknown exception" ) );
 
  541   return QgsRuntimeProfiler::threadLocalInstance();
 
  547   ABISYM( mFileOpenEventReceiver ) = receiver;
 
  549   if ( sFileOpenEventList()->count() > 0 )
 
  551     const QStringList fileOpenEventList = *sFileOpenEventList();
 
  552     for ( 
const QString &file : fileOpenEventList )
 
  554       QFileOpenEvent foe( file );
 
  555       QgsApplication::sendEvent( ABISYM( mFileOpenEventReceiver ), &foe );
 
  557     sFileOpenEventList()->clear();
 
  564 #if defined(Q_OS_WIN) 
  565   if ( sPrefixPath()->endsWith( 
"/bin" ) )
 
  567     sPrefixPath()->chop( 4 );
 
  570   if ( useDefaultPaths && !ABISYM( mRunningFromBuildDir ) )
 
  572     setPluginPath( *sPrefixPath() + 
'/' + QStringLiteral( QGIS_PLUGIN_SUBDIR ) );
 
  573     setPkgDataPath( *sPrefixPath() + 
'/' + QStringLiteral( QGIS_DATA_SUBDIR ) );
 
  575   *sLibraryPath() = *sPrefixPath() + 
'/' + QGIS_LIB_SUBDIR + 
'/';
 
  576   *sLibexecPath() = *sPrefixPath() + 
'/' + QGIS_LIBEXEC_SUBDIR + 
'/';
 
  577 #if defined( HAVE_QUICK ) 
  578   *sQmlImportPath() = *sPrefixPath() + 
'/' + QGIS_QML_SUBDIR + 
'/';
 
  591   QString mySvgPath = 
pkgDataPath + QStringLiteral( 
"/svg/" );
 
  594   if ( !sDefaultSvgPaths()->contains( mySvgPath ) )
 
  595     *sDefaultSvgPaths() << mySvgPath;
 
  600   *sDefaultSvgPaths() = pathList;
 
  605   QFileInfo fi( authDbDirPath );
 
  606   if ( fi.exists() && fi.isDir() && fi.isWritable() )
 
  608     *sAuthDbDirPath() = fi.canonicalFilePath() + QDir::separator();
 
  615   if ( ABISYM( mRunningFromBuildDir ) )
 
  617     static bool sOnce = 
true;
 
  621       ( void ) blockNotifications;
 
  622       qWarning( 
"!!! prefix path was requested, but it is not valid - we do not run from installed path !!!" );
 
  628   return *sPrefixPath();
 
  632   return *sPluginPath();
 
  637   if ( sPkgDataPath()->isNull() )
 
  640     return *sPkgDataPath();
 
  645   return QStringLiteral( 
":/images/themes/default/" );
 
  650   QDir dir( usersThemes );
 
  658     return defaultThemes;
 
  664   return iconsPath() + QStringLiteral( 
"qgis-icon-60x60.png" );
 
  669   return ABISYM( sMaxThreads );
 
  676   if ( QFile::exists( path + iconFile ) )
 
  677     return path + iconFile;
 
  685   const QString cacheKey = ( name.startsWith( 
'/' ) ? name.mid( 1 ) : name )
 
  686                            + ( fillColor.isValid() ? QStringLiteral( 
"_%1" ).arg( fillColor.name( QColor::HexArgb ).mid( 1 ) ) :  QString() )
 
  687                            + ( strokeColor.isValid() ? QStringLiteral( 
"_%1" ).arg( strokeColor.name( QColor::HexArgb ).mid( 1 ) ) : QString() );
 
  689   if ( app && app->mIconCache.contains( cacheKey ) )
 
  690     return app->mIconCache.value( cacheKey );
 
  693   const bool colorBased = fillColor.isValid() || strokeColor.isValid();
 
  695   auto iconFromColoredSvg = [ = ]( 
const QString & path ) -> QIcon
 
  700     const QString 
iconPath = sIconCacheDir()->filePath( cacheKey + QStringLiteral( 
".svg" ) );
 
  702     if ( f.open( QFile::WriteOnly | QFile::Truncate ) )
 
  704       f.write( svgContent );
 
  709       QgsDebugMsg( QStringLiteral( 
"Could not create colorized icon svg at %1" ).arg( 
iconPath ) );
 
  713     return QIcon( f.fileName() );
 
  718   if ( QFile::exists( preferredPath ) )
 
  722       icon = iconFromColoredSvg( preferredPath );
 
  726       icon = QIcon( preferredPath );
 
  729   else if ( QFile::exists( defaultPath ) )
 
  735       icon = iconFromColoredSvg( defaultPath );
 
  739       icon = QIcon( defaultPath );
 
  748     app->mIconCache.insert( cacheKey, icon );
 
  755   if ( app && app->mCursorCache.contains( cursor ) )
 
  756     return app->mCursorCache.value( cursor );
 
  767       name = QStringLiteral( 
"mZoomIn.svg" );
 
  772       name = QStringLiteral( 
"mZoomOut.svg" );
 
  779       name = QStringLiteral( 
"mIdentify.svg" );
 
  782       name = QStringLiteral( 
"mCrossHair.svg" );
 
  785       name = QStringLiteral( 
"mCapturePoint.svg" );
 
  788       name = QStringLiteral( 
"mSelect.svg" );
 
  795       name = QStringLiteral( 
"mSampler.svg" );
 
  800   Q_ASSERT( ! name.isEmpty( ) );
 
  802   QIcon icon = 
getThemeIcon( QStringLiteral( 
"cursors" ) + QDir::separator() + name );
 
  805   if ( ! icon.isNull( ) )
 
  809     cursorIcon = QCursor( icon.pixmap( std::ceil( scale * 32 ), std::ceil( scale * 32 ) ), std::ceil( scale * activeX ), std::ceil( scale * activeY ) );
 
  812     app->mCursorCache.insert( cursor, cursorIcon );
 
  819   const QString preferredPath = 
activeThemePath() + QDir::separator() + name;
 
  821   const QString path = QFile::exists( preferredPath ) ? preferredPath : defaultPath;
 
  822   if ( foreColor.isValid() || backColor.isValid() )
 
  824     bool fitsInCache = 
false;
 
  825     const QImage image = 
svgCache()->
svgAsImage( path, size, backColor, foreColor, 1, 1, fitsInCache );
 
  826     return QPixmap::fromImage( image );
 
  829   return QPixmap( path );
 
  839   static QString appPath;
 
  840   if ( appPath.isNull() )
 
  842     if ( QCoreApplication::instance() )
 
  844       appPath = applicationDirPath();
 
  848       qWarning( 
"Application path not initialized" );
 
  852   if ( !appPath.isNull() || getenv( 
"QGIS_PREFIX_PATH" ) )
 
  854     QString prefix = getenv( 
"QGIS_PREFIX_PATH" ) ? getenv( 
"QGIS_PREFIX_PATH" ) : appPath;
 
  859     static const QStringList paths { QStringList() << QString() << QStringLiteral( 
"/.." ) << QStringLiteral( 
"/bin" ) << QStringLiteral( 
"/../../.." ) };
 
  860     for ( 
const QString &path : paths )
 
  862       f.setFileName( prefix + path + 
"/qgisbuildpath.txt" );
 
  866     if ( f.exists() && f.open( QIODevice::ReadOnly ) )
 
  868       ABISYM( mRunningFromBuildDir ) = 
true;
 
  869       *sBuildSourcePath() = f.readLine().trimmed();
 
  870       *sBuildOutputPath() = f.readLine().trimmed();
 
  872       QgsDebugMsgLevel( QStringLiteral( 
"- source directory: %1" ).arg( sBuildSourcePath()->toUtf8().constData() ), 4 );
 
  873       QgsDebugMsgLevel( QStringLiteral( 
"- output directory of the build: %1" ).arg( sBuildOutputPath()->toUtf8().constData() ), 4 );
 
  874 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 
  875       *sCfgIntDir() = prefix.split( 
'/', QString::SkipEmptyParts ).last();
 
  876       qDebug( 
"- cfg: %s", sCfgIntDir()->toUtf8().constData() );
 
  882   if ( getenv( 
"QGIS_PREFIX_PATH" ) )
 
  888     QDir dir( QDir::homePath() );
 
  893 #if defined(Q_OS_MACX) 
  895 #elif defined(Q_OS_WIN) 
  902     if ( appPath.contains( QStringLiteral( 
"cgi-bin" ) ) )
 
  912   if ( ABISYM( mRunningFromBuildDir ) )
 
  913     return *sBuildOutputPath() + QStringLiteral( 
"/data" );
 
  915     return prefixPath + 
'/' + QStringLiteral( QGIS_DATA_SUBDIR );
 
  920   return *sThemeName();
 
  930     qApp->setStyleSheet( QString() );
 
  934   QString path = themes.value( 
themeName );
 
  935   QString stylesheetname = path + 
"/style.qss";
 
  937   QFile file( stylesheetname );
 
  938   QFile variablesfile( path + 
"/variables.qss" );
 
  940   QFileInfo variableInfo( variablesfile );
 
  942   if ( !file.open( QIODevice::ReadOnly ) || ( variableInfo.exists() && !variablesfile.open( QIODevice::ReadOnly ) ) )
 
  947   QString styledata = file.readAll();
 
  948   styledata.replace( QLatin1String( 
"@theme_path" ), path );
 
  950   if ( variableInfo.exists() )
 
  952     QTextStream in( &variablesfile );
 
  953     while ( !in.atEnd() )
 
  955       QString line = in.readLine();
 
  957       if ( line.startsWith( 
'@' ) )
 
  959         int index = line.indexOf( 
':' );
 
  960         QString name = line.mid( 0, index );
 
  961         QString value = line.mid( index + 1, line.length() );
 
  962         styledata.replace( name, value );
 
  965     variablesfile.close();
 
  973     const static QRegularExpression regex( QStringLiteral( 
"(?<=[\\s:])([0-9\\.]+)(?=em)" ) );
 
  974     QRegularExpressionMatch match = regex.match( styledata, index );
 
  975     while ( match.hasMatch() )
 
  977       index = match.capturedStart();
 
  978       styledata.remove( index, match.captured( 0 ).length() );
 
  980       styledata.insert( index, number );
 
  981       index += number.length();
 
  982       match = regex.match( styledata, index );
 
  986   qApp->setStyleSheet( styledata );
 
  988   QFile palettefile( path + 
"/palette.txt" );
 
  989   QFileInfo paletteInfo( palettefile );
 
  990   if ( paletteInfo.exists() && palettefile.open( QIODevice::ReadOnly ) )
 
  992     QPalette 
pal = qApp->palette();
 
  993     QTextStream in( &palettefile );
 
  994     while ( !in.atEnd() )
 
  996       QString line = in.readLine();
 
  997       QStringList parts = line.split( 
':' );
 
  998       if ( parts.count() == 2 )
 
 1000         int role = parts.at( 0 ).trimmed().toInt();
 
 1002         pal.setColor( 
static_cast< QPalette::ColorRole 
>( role ), color );
 
 1005     palettefile.close();
 
 1006     qApp->setPalette( 
pal );
 
 1015   QHash<QString, QString> mapping;
 
 1016   mapping.insert( QStringLiteral( 
"default" ), QString() );
 
 1017   const auto constPaths = paths;
 
 1018   for ( 
const QString &path : constPaths )
 
 1020     QDir folder( path );
 
 1021     QFileInfoList styleFiles = folder.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
 
 1022     const auto constStyleFiles = styleFiles;
 
 1023     for ( 
const QFileInfo &info : constStyleFiles )
 
 1025       QFileInfo styleFile( info.absoluteFilePath() + 
"/style.qss" );
 
 1026       if ( !styleFile.exists() )
 
 1029       QString name = info.baseName();
 
 1030       QString path = info.absoluteFilePath();
 
 1031       mapping.insert( name, path );
 
 1039   return pkgDataPath() + QStringLiteral( 
"/doc/AUTHORS" );
 
 1044   return pkgDataPath() + QStringLiteral( 
"/doc/CONTRIBUTORS" );
 
 1048   return pkgDataPath() + QStringLiteral( 
"/doc/developersmap.html" );
 
 1053   return pkgDataPath() + QStringLiteral( 
"/doc/SPONSORS" );
 
 1058   return pkgDataPath() + QStringLiteral( 
"/doc/DONORS" );
 
 1063   return pkgDataPath() + QStringLiteral( 
"/doc/TRANSLATORS" );
 
 1068   return pkgDataPath() + QStringLiteral( 
"/doc/LICENSE" );
 
 1073   if ( ABISYM( mRunningFromBuildDir ) )
 
 1074     return *sBuildOutputPath() + QStringLiteral( 
"/i18n/" );
 
 1076     return pkgDataPath() + QStringLiteral( 
"/i18n/" );
 
 1081   return pkgDataPath() + QStringLiteral( 
"/resources/metadata-ISO/" );
 
 1086   return pkgDataPath() + QStringLiteral( 
"/resources/qgis.db" );
 
 1091   return *sConfigPath();
 
 1101   return *sAuthDbDirPath() + QStringLiteral( 
"qgis-auth.db" );
 
 1106   return QStringLiteral( 
":/images/splash/" );
 
 1111   return pkgDataPath() + QStringLiteral( 
"/images/icons/" );
 
 1116   if ( ABISYM( mRunningFromBuildDir ) )
 
 1118     QString tempCopy = QDir::tempPath() + 
"/srs6.db";
 
 1120     if ( !QFile( tempCopy ).exists() )
 
 1123       if ( !f.copy( tempCopy ) )
 
 1125         qFatal( 
"Could not create temporary copy" );
 
 1133     return pkgDataPath() + QStringLiteral( 
"/resources/srs.db" );
 
 1140   members()->mSvgPathCacheValid = 
false;
 
 1145   static QReadWriteLock lock;
 
 1149   if ( members()->mSvgPathCacheValid )
 
 1151     return members()->mSvgPathCache;
 
 1162     for ( 
const QString &path : pathList )
 
 1164       if ( !paths.contains( path ) )
 
 1165         paths.append( path );
 
 1167     for ( 
const QString &path : std::as_const( *sDefaultSvgPaths() ) )
 
 1169       if ( !paths.contains( path ) )
 
 1170         paths.append( path );
 
 1172     members()->mSvgPathCache = paths;
 
 1187   return *sSystemEnvVars();
 
 1197   const thread_local QRegularExpression regexp( QRegularExpression::anchoredPattern( QStringLiteral( 
"^[A-Za-z][A-Za-z0-9\\._-]*" ) ) );
 
 1203   if ( !sUserName()->isEmpty() )
 
 1204     return *sUserName();
 
 1207   TCHAR name [ UNLEN + 1 ];
 
 1208   DWORD size = UNLEN + 1;
 
 1210   if ( GetUserName( ( TCHAR * )name, &size ) )
 
 1212     *sUserName() = QString::fromLocal8Bit( name );
 
 1215 #elif QT_CONFIG(process) 
 1218   process.start( QStringLiteral( 
"whoami" ), QStringList() );
 
 1219   process.waitForFinished();
 
 1220   *sUserName() = process.readAllStandardOutput().trimmed();
 
 1223   if ( !sUserName()->isEmpty() )
 
 1224     return *sUserName();
 
 1227   *sUserName() = qgetenv( 
"USER" );
 
 1228   if ( !sUserName()->isEmpty() )
 
 1229     return *sUserName();
 
 1232   *sUserName() = qgetenv( 
"USERNAME" );
 
 1233   return *sUserName();
 
 1238   if ( !sUserFullName()->isEmpty() )
 
 1239     return *sUserFullName();
 
 1242   TCHAR name [ UNLEN + 1 ];
 
 1243   DWORD size = UNLEN + 1;
 
 1246   if ( GetUserNameEx( NameDisplay, ( TCHAR * )name, &size ) )
 
 1248     *sUserFullName() = QString::fromLocal8Bit( name );
 
 1252   if ( sUserFullName()->isEmpty() )
 
 1254 #elif defined(Q_OS_ANDROID) || defined(__MINGW32__) 
 1255   *sUserFullName() = QStringLiteral( 
"Not available" );
 
 1257   struct passwd *p = getpwuid( getuid() );
 
 1261     QString gecosName = QString( p->pw_gecos );
 
 1262     *sUserFullName() = gecosName.left( gecosName.indexOf( 
',', 0 ) );
 
 1267   return *sUserFullName();
 
 1272 #if defined(Q_OS_ANDROID) 
 1273   return QLatin1String( 
"android" );
 
 1274 #elif defined(Q_OS_MAC) 
 1275   return QLatin1String( 
"osx" );
 
 1276 #elif defined(Q_OS_WIN) 
 1277   return QLatin1String( 
"windows" );
 
 1278 #elif defined(Q_OS_LINUX) 
 1279   return QStringLiteral( 
"linux" );
 
 1280 #elif defined(Q_OS_FREEBSD) 
 1281   return QStringLiteral( 
"freebsd" );
 
 1282 #elif defined(Q_OS_OPENBSD) 
 1283   return QStringLiteral( 
"openbsd" );
 
 1284 #elif defined(Q_OS_NETBSD) 
 1285   return QStringLiteral( 
"netbsd" );
 
 1286 #elif defined(Q_OS_UNIX) 
 1287   return QLatin1String( 
"unix" );
 
 1289   return QLatin1String( 
"unknown" );
 
 1295   return *sPlatformName();
 
 1304     if ( 
locale.startsWith( QLatin1String( 
"en" ), Qt::CaseInsensitive ) )
 
 1313     return QLocale().name().left( 2 );
 
 1319   QLocale::setDefault( 
locale );
 
 1330   return pkgDataPath() + QStringLiteral( 
"/resources/symbology-style.xml" );
 
 1335   return pkgDataPath() + QStringLiteral( 
"/resources/themes" );
 
 1340   return pkgDataPath() + QStringLiteral( 
"/resources/server/" );
 
 1345   return *sLibraryPath();
 
 1350   return *sLibexecPath();
 
 1355   return *sQmlImportPath();
 
 1360   return ( htonl( 1 ) == 1 ) ? 
XDR : 
NDR;
 
 1367     init( *sProfilePath() );
 
 1392   if ( 
auto *lInstance = 
instance() )
 
 1394     if ( !lInstance->mAuthManager )
 
 1398     return lInstance->mAuthManager;
 
 1403     if ( !sAuthManager )
 
 1405     return sAuthManager;
 
 1413   QThreadPool::globalInstance()->waitForDone();
 
 1416   if ( 
auto *lInstance = 
instance() )
 
 1417     delete lInstance->mAuthManager;
 
 1419     delete sAuthManager;
 
 1424   QgsApplication::sendPostedEvents( 
nullptr, QEvent::DeferredDelete );
 
 1432   if ( QgsProviderRegistry::exists() )
 
 1441   GDALDestroyDriverManager();
 
 1446   QString myEnvironmentVar( getenv( 
"QGIS_PREFIX_PATH" ) );
 
 1447   QString myState = tr( 
"Application state:\n" 
 1448                         "QGIS_PREFIX_PATH env var:\t\t%1\n" 
 1450                         "Plugin Path:\t\t%3\n" 
 1451                         "Package Data Path:\t%4\n" 
 1452                         "Active Theme Name:\t%5\n" 
 1453                         "Active Theme Path:\t%6\n" 
 1454                         "Default Theme Path:\t%7\n" 
 1455                         "SVG Search Paths:\t%8\n" 
 1456                         "User DB Path:\t%9\n" 
 1457                         "Auth DB Path:\t%10\n" )
 
 1458                     .arg( myEnvironmentVar,
 
 1465                           svgPaths().join( tr( 
"\n\t\t", 
"match indentation of application state" ) ),
 
 1478   QColor myColor1( Qt::lightGray );
 
 1479   QColor myColor2 = myColor1;
 
 1480   myColor2 = myColor2.lighter( 110 ); 
 
 1482   myStyle = QStringLiteral( 
".overview{" 
 1484                             "  font-weight: bold;" 
 1487                             "  background: white;" 
 1489                             "  font-family: 'Lato', 'Open Sans', 'Lucida Grande', 'Segoe UI', 'Arial', sans-serif;" 
 1492                             "h1{  background-color: #F6F6F6;" 
 1494                             "  font-size: x-large;  " 
 1495                             "  font-weight: normal;" 
 1496                             "  background: none;" 
 1497                             "  padding: 0.75em 0 0;" 
 1499                             "  line-height: 3em;" 
 1501                             "h2{  background-color: #F6F6F6;" 
 1503                             "  font-size: medium;  " 
 1504                             "  font-weight: normal;" 
 1505                             "  background: none;" 
 1506                             "  padding: 0.75em 0 0;" 
 1508                             "  line-height: 1.1em;" 
 1510                             "h3{  background-color: #F6F6F6;" 
 1512                             "  font-weight: bold;" 
 1513                             "  font-size: large;" 
 1514                             "  text-align: left;" 
 1515                             "  border-bottom: 5px solid #DCEB5C;" 
 1517                             "h4{  background-color: #F6F6F6;" 
 1519                             "  font-weight: bold;" 
 1520                             "  font-size: medium;" 
 1521                             "  text-align: left;" 
 1523                             "h5{    background-color: #F6F6F6;" 
 1525                             "   font-weight: bold;" 
 1526                             "   font-size: small;" 
 1527                             "   text-align: left;" 
 1529                             "a{  color: #729FCF;" 
 1530                             "  font-family: arial,sans-serif;" 
 1532                             "label{  background-color: #FFFFCC;" 
 1533                             "  border: 1px solid black;" 
 1535                             "  padding: 0px 3px; " 
 1536                             "  font-size: small;" 
 1539                             "  font-weight: bold;" 
 1544                             "  border-top: 1px solid black;" 
 1546                             ".list-view .highlight {" 
 1547                             "  text-align: left;" 
 1550                             "  padding-right: 15px;" 
 1551                             "  padding-left: 20px;" 
 1552                             "  font-weight: bold;" 
 1554                             ".tabular-view .odd-row {" 
 1555                             "  background-color: #f9f9f9;" 
 1558                             "  font-weight: bold;" 
 1559                             "  padding-top:25px;" 
 1563   switch ( styleSheetType )
 
 1565     case StyleSheetType::Qt:
 
 1566       myStyle += QStringLiteral(
 
 1568                    "  border-collapse: collapse;" 
 1571                    ".tabular-view th, .tabular-view td { " 
 1572                    "  border:1px solid black;" 
 1576     case StyleSheetType::WebBrowser:
 
 1577       myStyle += QStringLiteral(
 
 1582                    "table.tabular-view, table.list-view { " 
 1583                    "   border-collapse: collapse;" 
 1584                    "   table-layout:fixed;" 
 1585                    "   width: 100% !important;" 
 1590                    "   line-height: inherit;" 
 1593                    "   word-wrap: break-word; " 
 1594                    "   vertical-align: top;" 
 1597                    ".list-view th:first-child, .list-view td:first-child {" 
 1600                    ".list-view.highlight { " 
 1601                    "   padding-left: inherit; " 
 1604                    ".tabular-view th:first-child, .tabular-view td:first-child { " 
 1608                    ".tabular-view th.strong { " 
 1609                    "   background-color: #eee; " 
 1612                    ".tabular-view th, .tabular-view td { " 
 1613                    "   border: 1px solid #eee;" 
 1624   if ( 0 >= OGRGetDriverCount() )
 
 1632   QString aPathUrl = aPath;
 
 1633   QString tPathUrl = targetPath;
 
 1634 #if defined( Q_OS_WIN ) 
 1635   const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
 
 1637   aPathUrl.replace( 
'\\', 
'/' );
 
 1638   if ( aPathUrl.startsWith( 
"//" ) )
 
 1641     aPathUrl = 
"\\\\" + aPathUrl.mid( 2 );
 
 1644   tPathUrl.replace( 
'\\', 
'/' );
 
 1645   if ( tPathUrl.startsWith( 
"//" ) )
 
 1648     tPathUrl = 
"\\\\" + tPathUrl.mid( 2 );
 
 1651   const Qt::CaseSensitivity cs = Qt::CaseSensitive;
 
 1654 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) 
 1655   QStringList targetElems = tPathUrl.split( 
'/', QString::SkipEmptyParts );
 
 1656   QStringList aPathElems = aPathUrl.split( 
'/', QString::SkipEmptyParts );
 
 1658   QStringList targetElems = tPathUrl.split( 
'/', Qt::SkipEmptyParts );
 
 1659   QStringList aPathElems = aPathUrl.split( 
'/', Qt::SkipEmptyParts );
 
 1662   targetElems.removeAll( QStringLiteral( 
"." ) );
 
 1663   aPathElems.removeAll( QStringLiteral( 
"." ) );
 
 1667   while ( !aPathElems.isEmpty() &&
 
 1668           !targetElems.isEmpty() &&
 
 1669           aPathElems[0].compare( targetElems[0], cs ) == 0 )
 
 1671     aPathElems.removeFirst();
 
 1672     targetElems.removeFirst();
 
 1682   if ( !targetElems.isEmpty() )
 
 1685     for ( 
int i = 0; i < targetElems.size(); i++ )
 
 1687       aPathElems.insert( 0, QStringLiteral( 
".." ) );
 
 1694     aPathElems.insert( 0, QStringLiteral( 
"." ) );
 
 1697   return aPathElems.join( QLatin1Char( 
'/' ) );
 
 1703   if ( !rpath.startsWith( QLatin1String( 
"./" ) ) && !rpath.startsWith( QLatin1String( 
"../" ) ) )
 
 1708   QString rPathUrl = rpath;
 
 1709   QString targetPathUrl = targetPath;
 
 1711 #if defined(Q_OS_WIN) 
 1712   rPathUrl.replace( 
'\\', 
'/' );
 
 1713   targetPathUrl.replace( 
'\\', 
'/' );
 
 1715   bool uncPath = targetPathUrl.startsWith( 
"//" );
 
 1718 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) 
 1719   QStringList srcElems = rPathUrl.split( 
'/', QString::SkipEmptyParts );
 
 1720   QStringList targetElems = targetPathUrl.split( 
'/', QString::SkipEmptyParts );
 
 1722   QStringList srcElems = rPathUrl.split( 
'/', Qt::SkipEmptyParts );
 
 1723   QStringList targetElems = targetPathUrl.split( 
'/', Qt::SkipEmptyParts );
 
 1726 #if defined(Q_OS_WIN) 
 1729     targetElems.insert( 0, 
"" );
 
 1730     targetElems.insert( 0, 
"" );
 
 1735   targetElems << srcElems;
 
 1736   targetElems.removeAll( QStringLiteral( 
"." ) );
 
 1740   while ( ( pos = targetElems.indexOf( QLatin1String( 
".." ) ) ) > 0 )
 
 1743     targetElems.removeAt( pos - 1 );
 
 1744     targetElems.removeAt( pos - 1 );
 
 1747 #if !defined(Q_OS_WIN) 
 1749   targetElems.prepend( QString() );
 
 1752   return targetElems.join( QLatin1Char( 
'/' ) );
 
 1757   return *sBuildSourcePath();
 
 1762   return *sBuildOutputPath();
 
 1765 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 
 1766 QString QgsApplication::cfgIntDir()
 
 1768   return *sCfgIntDir();
 
 1774   if ( sGdalSkipList()->contains( driver ) || driver.isEmpty() )
 
 1778   *sGdalSkipList() << driver;
 
 1784   if ( !sGdalSkipList()->contains( driver ) )
 
 1788   int myPos = sGdalSkipList()->indexOf( driver );
 
 1791     sGdalSkipList()->removeAt( myPos );
 
 1798   return *sGdalSkipList();
 
 1802     const QStringList &deferredSkippedGdalDrivers )
 
 1816   QString joinedList, delimiter;
 
 1817   if ( settings.
contains( QStringLiteral( 
"gdal/skipDrivers" ) ) )
 
 1819     joinedList = settings.
value( QStringLiteral( 
"gdal/skipDrivers" ), QString() ).toString();
 
 1820     delimiter = QStringLiteral( 
"," );
 
 1824     joinedList = settings.
value( QStringLiteral( 
"gdal/skipList" ), QString() ).toString();
 
 1825     delimiter = QStringLiteral( 
" " );
 
 1828   if ( !joinedList.isEmpty() )
 
 1830     myList = joinedList.split( delimiter );
 
 1832   *sGdalSkipList() = myList;
 
 1838   return *sDeferredSkippedGdalDrivers();
 
 1843   sGdalSkipList()->removeDuplicates();
 
 1844   QStringList realDisabledDriverList;
 
 1845   for ( 
const auto &driverName : *sGdalSkipList() )
 
 1847     if ( !sDeferredSkippedGdalDrivers()->contains( driverName ) )
 
 1848       realDisabledDriverList << driverName;
 
 1850   QString myDriverList = realDisabledDriverList.join( 
',' );
 
 1851   QgsDebugMsgLevel( QStringLiteral( 
"Gdal Skipped driver list set to:" ), 2 );
 
 1853   CPLSetConfigOption( 
"GDAL_SKIP", myDriverList.toUtf8() );
 
 1860   QDir myDir( folder );
 
 1861   if ( !myDir.exists() )
 
 1863     myDir.mkpath( folder );
 
 1869 void QgsApplication::copyPath( 
const QString &src, 
const QString &dst )
 
 1872   if ( ! dir.exists() )
 
 1875   const auto subDirectories = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot );
 
 1876   for ( 
const QString &d : subDirectories )
 
 1878     QString dst_path = dst + QDir::separator() + d;
 
 1879     dir.mkpath( dst_path );
 
 1880     copyPath( src + QDir::separator() + d, dst_path );
 
 1883   const auto files = dir.entryList( QDir::Files );
 
 1884   for ( 
const QString &f : files )
 
 1886     QFile::copy( src + QDir::separator() + f, dst + QDir::separator() + f );
 
 1895   QVariantMap variables;
 
 1899   QStringList childKeys = settings.
childKeys();
 
 1900   for ( QStringList::const_iterator it = childKeys.constBegin(); it != childKeys.constEnd(); ++it )
 
 1903     variables.insert( name, settings.
value( name ) );
 
 1913   QVariantMap::const_iterator it = variables.constBegin();
 
 1916   for ( ; it != variables.constEnd(); ++it )
 
 1918     settings.
setValue( it.key(), it.value() );
 
 1929   settings.
setValue( QStringLiteral( 
"variables/" ) + name, value );
 
 1936   QFontMetrics fm( ( QFont() ) );
 
 1937   const double scale = 1.1 * standardSize / 24;
 
 1938   int scaledIconSize = 
static_cast< int >( std::floor( std::max( 
Qgis::UI_SCALE_FACTOR * fm.height() * scale, 
static_cast< double >( standardSize ) ) ) );
 
 1939 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 
 1940   if ( applyDevicePixelRatio && QApplication::desktop() )
 
 1941     scaledIconSize *= QApplication::desktop()->devicePixelRatio();
 
 1943   if ( applyDevicePixelRatio )
 
 1945     if ( QWidget *activeWindow = QApplication::activeWindow() )
 
 1946       scaledIconSize *= ( activeWindow->screen() ? QApplication::activeWindow()->screen()->devicePixelRatio() : 1 );
 
 1949   return scaledIconSize;
 
 1964   return *sTranslation();
 
 1974   ApplicationMembers *appMembers = members();
 
 1975   if ( appMembers->mNullRepresentation.isNull() )
 
 1977     appMembers->mNullRepresentation = 
QgsSettings().
value( QStringLiteral( 
"qgis/nullValue" ), QStringLiteral( 
"NULL" ) ).toString();
 
 1979   return appMembers->mNullRepresentation;
 
 1984   ApplicationMembers *appMembers = members();
 
 1998   return members()->mActionScopeRegistry;
 
 2007   QDir myDir( myPamPath );
 
 2008   if ( !myDir.exists() )
 
 2010     myDir.mkpath( myPamPath ); 
 
 2013 #if defined(Q_OS_WIN) 
 2014   CPLSetConfigOption( 
"GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
 
 2018   int myChangeFlag = 0; 
 
 2019   setenv( 
"GDAL_PAM_PROXY_DIR", myPamPath.toUtf8(), myChangeFlag );
 
 2026   if ( !qgisPrivateDbFile.exists() )
 
 2030     QFile masterFile( qgisMasterDbFileName );
 
 2036     bool isDbFileCopied = masterFile.copy( qgisPrivateDbFile.fileName() );
 
 2038     if ( !isDbFileCopied )
 
 2042         *errorMessage = tr( 
"[ERROR] Can not make qgis.db private copy" );
 
 2047     QFile::Permissions perms = QFile( qgisPrivateDbFile.fileName() ).permissions();
 
 2048     if ( !( perms & QFile::WriteOwner ) )
 
 2050       if ( !qgisPrivateDbFile.setPermissions( perms | QFile::WriteOwner ) )
 
 2054           *errorMessage = tr( 
"Can not make '%1' user writable" ).arg( qgisPrivateDbFile.fileName() );
 
 2068         *errorMessage = tr( 
"Could not open qgis.db" );
 
 2073     char *errmsg = 
nullptr;
 
 2074     int res = sqlite3_exec( database.get(), 
"SELECT srs_id FROM tbl_srs LIMIT 0", 
nullptr, 
nullptr, &errmsg );
 
 2075     if ( res != SQLITE_OK )
 
 2077       sqlite3_free( errmsg );
 
 2080       if ( sqlite3_exec( database.get(),
 
 2081                          "DROP INDEX IF EXISTS idx_srsauthid;" 
 2082                          "CREATE TABLE tbl_srs (" 
 2083                          "srs_id INTEGER PRIMARY KEY," 
 2084                          "description text NOT NULL," 
 2085                          "projection_acronym text NOT NULL," 
 2086                          "ellipsoid_acronym NOT NULL," 
 2087                          "parameters text NOT NULL," 
 2089                          "auth_name varchar," 
 2091                          "is_geo integer NOT NULL," 
 2092                          "deprecated boolean," 
 2094                          "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);", 
nullptr, 
nullptr, &errmsg ) != SQLITE_OK )
 
 2098           *errorMessage = tr( 
"Creation of missing tbl_srs in the private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
 
 2100         sqlite3_free( errmsg );
 
 2107       res = sqlite3_exec( database.get(), 
"SELECT wkt FROM tbl_srs LIMIT 0", 
nullptr, 
nullptr, &errmsg );
 
 2108       if ( res != SQLITE_OK )
 
 2111         sqlite3_free( errmsg );
 
 2112         if ( sqlite3_exec( database.get(),
 
 2113                            "DROP INDEX IF EXISTS idx_srsauthid;" 
 2114                            "DROP TABLE IF EXISTS tbl_srs_bak;" 
 2115                            "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;" 
 2116                            "CREATE TABLE tbl_srs (" 
 2117                            "srs_id INTEGER PRIMARY KEY," 
 2118                            "description text NOT NULL," 
 2119                            "projection_acronym text NOT NULL," 
 2120                            "ellipsoid_acronym NOT NULL," 
 2121                            "parameters text NOT NULL," 
 2123                            "auth_name varchar," 
 2125                            "is_geo integer NOT NULL," 
 2126                            "deprecated boolean," 
 2128                            "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);" 
 2129                            "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;" 
 2130                            "DROP TABLE tbl_srs_bak", 
nullptr, 
nullptr, &errmsg ) != SQLITE_OK )
 
 2134             *errorMessage = tr( 
"Migration of private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
 
 2136           sqlite3_free( errmsg );
 
 2142     res = sqlite3_exec( database.get(), 
"SELECT acronym FROM tbl_projection LIMIT 0", 
nullptr, 
nullptr, &errmsg );
 
 2143     if ( res != SQLITE_OK )
 
 2145       sqlite3_free( errmsg );
 
 2148       if ( sqlite3_exec( database.get(),
 
 2149                          "CREATE TABLE tbl_projection (" 
 2150                          "acronym varchar(20) NOT NULL PRIMARY KEY," 
 2151                          "name varchar(255) NOT NULL default ''," 
 2152                          "notes varchar(255) NOT NULL default ''," 
 2153                          "parameters varchar(255) NOT NULL default ''" 
 2154                          ")", 
nullptr, 
nullptr, &errmsg ) != SQLITE_OK )
 
 2158           *errorMessage = tr( 
"Creation of missing tbl_projection in the private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
 
 2160         sqlite3_free( errmsg );
 
 2165     res = sqlite3_exec( database.get(), 
"SELECT epsg FROM tbl_srs LIMIT 0", 
nullptr, 
nullptr, &errmsg );
 
 2166     if ( res == SQLITE_OK )
 
 2169       if ( sqlite3_exec( database.get(),
 
 2170                          "DROP INDEX IF EXISTS idx_srsauthid;" 
 2171                          "DROP TABLE IF EXISTS tbl_srs_bak;" 
 2172                          "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;" 
 2173                          "CREATE TABLE tbl_srs (" 
 2174                          "srs_id INTEGER PRIMARY KEY," 
 2175                          "description text NOT NULL," 
 2176                          "projection_acronym text NOT NULL," 
 2177                          "ellipsoid_acronym NOT NULL," 
 2178                          "parameters text NOT NULL," 
 2180                          "auth_name varchar," 
 2182                          "is_geo integer NOT NULL," 
 2183                          "deprecated boolean," 
 2185                          "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);" 
 2186                          "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;" 
 2187                          "DROP TABLE tbl_srs_bak", 
nullptr, 
nullptr, &errmsg ) != SQLITE_OK )
 
 2191           *errorMessage = tr( 
"Migration of private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
 
 2193         sqlite3_free( errmsg );
 
 2199       sqlite3_free( errmsg );
 
 2202     if ( sqlite3_exec( database.get(), 
"DROP VIEW vw_srs", 
nullptr, 
nullptr, &errmsg ) != SQLITE_OK )
 
 2204       QgsDebugMsg( QStringLiteral( 
"vw_srs didn't exists in private qgis.db: %1" ).arg( errmsg ) );
 
 2207     if ( sqlite3_exec( database.get(),
 
 2208                        "CREATE VIEW vw_srs AS" 
 2210                        " a.description AS description" 
 2211                        ",a.srs_id AS srs_id" 
 2212                        ",a.is_geo AS is_geo" 
 2213                        ",coalesce(b.name,a.projection_acronym) AS name" 
 2214                        ",a.parameters AS parameters" 
 2215                        ",a.auth_name AS auth_name" 
 2216                        ",a.auth_id AS auth_id" 
 2217                        ",a.deprecated AS deprecated" 
 2219                        " LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym" 
 2220                        " ORDER BY coalesce(b.name,a.projection_acronym),a.description", 
nullptr, 
nullptr, &errmsg ) != SQLITE_OK )
 
 2224         *errorMessage = tr( 
"Update of view in private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) );
 
 2226       sqlite3_free( errmsg );
 
 2239   if ( maxThreads < 1 || maxThreads > QThread::idealThreadCount() )
 
 2250   QThreadPool::globalInstance()->setMaxThreadCount( 
maxThreads );
 
 2251   QgsDebugMsgLevel( QStringLiteral( 
"set QThreadPool max thread count to %1" ).arg( QThreadPool::globalInstance()->maxThreadCount() ), 2 );
 
 2256   return members()->mTaskManager;
 
 2261   return members()->mSettingsRegistryCore;
 
 2266   return members()->mColorSchemeRegistry;
 
 2271   return members()->mPaintEffectRegistry;
 
 2276   return members()->mRendererRegistry;
 
 2281   return members()->mRasterRendererRegistry;
 
 2286   return members()->mPointCloudRendererRegistry;
 
 2291   if ( 
auto *lInstance = 
instance() )
 
 2293     if ( !
instance()->mDataItemProviderRegistry )
 
 2297     return lInstance->mDataItemProviderRegistry;
 
 2303     if ( !sDataItemProviderRegistry )
 
 2305     return sDataItemProviderRegistry;
 
 2311   return members()->mCrsRegistry;
 
 2316   return members()->mSvgCache;
 
 2321   return members()->mImageCache;
 
 2326   return members()->mSourceCache;
 
 2331   return members()->mNetworkContentFetcherRegistry;
 
 2336   return members()->mValidityCheckRegistry;
 
 2341   return members()->mSymbolLayerRegistry;
 
 2346   return members()->mCalloutRegistry;
 
 2351   return members()->mLayoutItemRegistry;
 
 2356   return members()->mAnnotationItemRegistry;
 
 2361   return members()->mGpsConnectionRegistry;
 
 2366   return members()->mGpsBabelFormatRegistry;
 
 2371   return members()->mPluginLayerRegistry;
 
 2376   return members()->mClassificationMethodRegistry;
 
 2381   return members()->mBookmarkManager;
 
 2386   return members()->mTileDownloadManager;
 
 2391   return members()->mRecentStyleHandler;
 
 2396   return members()->mStyleModel;
 
 2401   return members()->mMessageLog;
 
 2406   return members()->mProcessingRegistry;
 
 2411   return members()->mConnectionRegistry;
 
 2416   return members()->mPageSizeRegistry;
 
 2421   return members()->mAnnotationRegistry;
 
 2426   return members()->mNumericFormatRegistry;
 
 2431   return members()->mFieldFormatterRegistry;
 
 2436   return members()->m3DRendererRegistry;
 
 2441   return members()->m3DSymbolRegistry;
 
 2446   return members()->mScaleBarRendererRegistry;
 
 2451   return members()->mProjectStorageRegistry.get();
 
 2456   return members()->mExternalStorageRegistry;
 
 2461   return members()->mLocalizedDataPathRegistry;
 
 2464 QgsApplication::ApplicationMembers::ApplicationMembers()
 
 2474     profiler->
start( tr( 
"Setup coordinate reference system registry" ) );
 
 2479     profiler->
start( tr( 
"Create connection registry" ) );
 
 2484     profiler->
start( tr( 
"Setup task manager" ) );
 
 2489     profiler->
start( tr( 
"Setup action scope registry" ) );
 
 2494     profiler->
start( tr( 
"Setup numeric formats" ) );
 
 2499     profiler->
start( tr( 
"Setup field formats" ) );
 
 2504     profiler->
start( tr( 
"Setup SVG cache" ) );
 
 2509     profiler->
start( tr( 
"Setup image cache" ) );
 
 2514     profiler->
start( tr( 
"Setup source cache" ) );
 
 2519     profiler->
start( tr( 
"Setup color scheme registry" ) );
 
 2524     profiler->
start( tr( 
"Setup paint effect" ) );
 
 2529     profiler->
start( tr( 
"Setup symbol layer registry" ) );
 
 2534     profiler->
start( tr( 
"Recent style handler" ) );
 
 2539     profiler->
start( tr( 
"Setup callout registry" ) );
 
 2544     profiler->
start( tr( 
"Setup renderer registry" ) );
 
 2549     profiler->
start( tr( 
"Setup raster renderer registry" ) );
 
 2554     profiler->
start( tr( 
"Setup point cloud renderer registry" ) );
 
 2559     profiler->
start( tr( 
"Setup GPS registry" ) );
 
 2564     profiler->
start( tr( 
"Setup GPSBabel format registry" ) );
 
 2569     profiler->
start( tr( 
"Setup plugin layer registry" ) );
 
 2574     profiler->
start( tr( 
"Setup Processing registry" ) );
 
 2580     profiler->
start( tr( 
"Setup layout item registry" ) );
 
 2582     mLayoutItemRegistry->populate();
 
 2586     profiler->
start( tr( 
"Setup annotation registry" ) );
 
 2587     mAnnotationRegistry = 
new QgsAnnotationRegistry();
 
 2591     profiler->
start( tr( 
"Setup annotation item registry" ) );
 
 2593     mAnnotationItemRegistry->populate();
 
 2597     profiler->
start( tr( 
"Setup 3D symbol registry" ) );
 
 2602     profiler->
start( tr( 
"Setup 3D renderer registry" ) );
 
 2607     profiler->
start( tr( 
"Setup project storage registry" ) );
 
 2612     profiler->
start( tr( 
"Setup external storage registry" ) );
 
 2617     profiler->
start( tr( 
"Setup network content cache" ) );
 
 2622     profiler->
start( tr( 
"Setup layout check registry" ) );
 
 2627     profiler->
start( tr( 
"Setup classification registry" ) );
 
 2632     profiler->
start( tr( 
"Setup bookmark manager" ) );
 
 2637     profiler->
start( tr( 
"Setup tile download manager" ) );
 
 2642     profiler->
start( tr( 
"Setup scalebar registry" ) );
 
 2648 QgsApplication::ApplicationMembers::~ApplicationMembers()
 
 2651   delete mTileDownloadManager;
 
 2652   delete mScaleBarRendererRegistry;
 
 2653   delete mValidityCheckRegistry;
 
 2654   delete mActionScopeRegistry;
 
 2655   delete m3DRendererRegistry;
 
 2656   delete m3DSymbolRegistry;
 
 2657   delete mAnnotationRegistry;
 
 2658   delete mColorSchemeRegistry;
 
 2659   delete mFieldFormatterRegistry;
 
 2660   delete mGpsConnectionRegistry;
 
 2661   delete mGpsBabelFormatRegistry;
 
 2663   delete mPaintEffectRegistry;
 
 2664   delete mPluginLayerRegistry;
 
 2665   delete mProcessingRegistry;
 
 2666   delete mPageSizeRegistry;
 
 2667   delete mAnnotationItemRegistry;
 
 2668   delete mLayoutItemRegistry;
 
 2669   delete mPointCloudRendererRegistry;
 
 2670   delete mRasterRendererRegistry;
 
 2671   delete mRendererRegistry;
 
 2674   delete mSourceCache;
 
 2675   delete mCalloutRegistry;
 
 2676   delete mRecentStyleHandler;
 
 2677   delete mSymbolLayerRegistry;
 
 2678   delete mExternalStorageRegistry;
 
 2679   delete mTaskManager;
 
 2680   delete mNetworkContentFetcherRegistry;
 
 2681   delete mClassificationMethodRegistry;
 
 2682   delete mNumericFormatRegistry;
 
 2683   delete mBookmarkManager;
 
 2684   delete mConnectionRegistry;
 
 2685   delete mLocalizedDataPathRegistry;
 
 2686   delete mCrsRegistry;
 
 2687   delete mSettingsRegistryCore;
 
 2690 QgsApplication::ApplicationMembers *QgsApplication::members()
 
 2692   if ( 
auto *lInstance = 
instance() )
 
 2694     return lInstance->mApplicationMembers;
 
 2698 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 
 2699     static QMutex sMemberMutex( QMutex::Recursive );
 
 2701     static QRecursiveMutex sMemberMutex;
 
 2703     QMutexLocker lock( &sMemberMutex );
 
 2704     if ( !sApplicationMembers )
 
 2705       sApplicationMembers = 
new ApplicationMembers();
 
 2706     return sApplicationMembers;
 
static const double UI_SCALE_FACTOR
UI scaling factor.
 
Keeps track of available 3D renderers.
 
Registry of available 3D symbol classes.
 
The action scope registry is an application wide registry that contains a list of available action sc...
 
Registry of available annotation item types.
 
Extends QApplication to provide access to QGIS specific resources such as theme paths,...
 
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 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 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 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()
This string is 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 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 QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
 
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 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. Valid only when running from build directory.
 
static QString buildOutputPath()
Returns path to the build output directory. Valid only when running from build 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.
 
static QString translatorsFilePath()
Returns the path to the sponsors file.
 
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)
This string is used to represent the value NULL throughout QGIS.
 
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 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 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 QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
 
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 QgsSettingsEntryBool settingsLocaleOverrideFlag
Settings entry locale override flag.
 
static const char * QGIS_ORGANIZATION_NAME
 
static QString contributorsFilePath()
Returns the path to the contributors file.
 
static const QgsSettingsEntryStringList settingsSearchPathsForSVG
Settings entry search path for SVG.
 
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 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 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 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.
 
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 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 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 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 QString developersMapFilePath()
Returns the path to the developers map file.
 
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()
This string is used to represent the value NULL throughout QGIS.
 
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 Qgs3DRendererRegistry * renderer3DRegistry()
Returns registry of available 3D renderers.
 
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
 
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 QString userFullName()
Returns the user's operating system login account full display name.
 
static 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.
 
static const QgsSettingsEntryString settingsLocaleUserLocale
Settings entry locale user locale.
 
Singleton offering an interface to manage the authentication configuration database and to utilize co...
 
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 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.
 
This class 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.
 
This class keeps a list of data item providers that may add items to the browser tree.
 
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.
 
A class to register / unregister existing GPS connections such that the information is available to a...
 
A cache for images derived from raster files.
 
Registry of available layout item types.
 
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,...
 
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.
 
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...
 
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.
 
The QgsReadWriteLocker class is a convenience class that simplifies locking and unlocking QReadWriteL...
 
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...
 
void end(const QString &group="startup")
End the current profile event.
 
void start(const QString &name, const QString &group="startup")
Start a profile event with the given name.
 
The QgsScaleBarRendererRegistry manages registered scalebar renderers.
 
Scoped object for logging of the runtime for a single operation or group of operations.
 
bool value(const QString &dynamicKeyPart=QString(), bool useDefaultValueOverride=false, bool defaultValueOverride=false) const
Returns settings value.
 
bool setValue(const QStringList &value, const QString &dynamicKeyPart=QString()) const
Set settings value.
 
QStringList value(const QString &dynamicKeyPart=QString(), bool useDefaultValueOverride=false, const QStringList &defaultValueOverride=QStringList()) const
Returns settings value.
 
QString value(const QString &dynamicKeyPart=QString(), bool useDefaultValueOverride=false, const QString &defaultValueOverride=QString()) const
Returns settings value.
 
QgsSettingsRegistryCore is used for settings introspection and collects all QgsSettingsEntry instance...
 
This class is a composition of two QSettings instances:
 
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 ...
 
static void cleanDefaultStyle()
Deletes the default style. Only to be used by QgsApplication::exitQgis()
 
static QgsStyle * defaultStyle()
Returns 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.
 
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.
 
Used for the collecting of strings from projects for translation and creation of ts files.
 
User profile manager is used to manager list, and manage user profiles on the users machine.
 
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.
 
User profile contains information about the user profile folders on the machine.
 
const QString folder() const
The base folder for the user profile.
 
This class keeps a list of QgsAbstractValidityCheck checks which can be used when performing validity...
 
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
 
#define CONN_POOL_MAX_CONCURRENT_CONNS
 
QObject * ABISYM(QgsApplication::mFileOpenEventReceiver)
 
Q_GLOBAL_STATIC_WITH_ARGS(PalPropertyList, palHiddenProperties,({ QgsPalLayerSettings::PositionX, QgsPalLayerSettings::PositionY, QgsPalLayerSettings::Show, QgsPalLayerSettings::LabelRotation, QgsPalLayerSettings::Family, QgsPalLayerSettings::FontStyle, QgsPalLayerSettings::Size, QgsPalLayerSettings::Bold, QgsPalLayerSettings::Italic, QgsPalLayerSettings::Underline, QgsPalLayerSettings::Color, QgsPalLayerSettings::Strikeout, QgsPalLayerSettings::MultiLineAlignment, QgsPalLayerSettings::BufferSize, QgsPalLayerSettings::BufferDraw, QgsPalLayerSettings::BufferColor, QgsPalLayerSettings::LabelDistance, QgsPalLayerSettings::Hali, QgsPalLayerSettings::Vali, QgsPalLayerSettings::ScaleVisibility, QgsPalLayerSettings::MinScale, QgsPalLayerSettings::MaxScale, QgsPalLayerSettings::AlwaysShow, QgsPalLayerSettings::CalloutDraw, QgsPalLayerSettings::LabelAllParts })) QgsAuxiliaryLayer
 
Q_GLOBAL_STATIC(QReadWriteLock, sDefinitionCacheLock)
 
#define QgsDebugMsgLevel(str, level)