49 const QStringList paths = settings.
value( QStringLiteral(
"help/helpSearchPath" ) ).toStringList();
50 if ( paths.isEmpty() )
59 QString helpPath, fullPath;
60 bool helpFound =
false;
62 const auto constPaths = paths;
63 for (
const QString &path : constPaths )
65 if ( path.endsWith( QLatin1String(
"\\" ) ) || path.endsWith( QLatin1Char(
'/' ) ) )
67 fullPath = path.left( path.size() - 1 );
74 const auto constVariableNames = scope->variableNames();
75 for (
const QString &var : constVariableNames )
77 const QRegularExpression rx( QStringLiteral(
"(<!\\$\\$)*(\\$%1)" ).arg( var ) );
78 fullPath.replace( rx, scope->variable( var ).toString() );
80 const thread_local QRegularExpression pathRx( QStringLiteral(
"(\\$\\$)" ) );
81 fullPath.replace( pathRx, QStringLiteral(
"$" ) );
83 helpPath = QStringLiteral(
"%1/%2" ).arg( fullPath, key );
87 if ( helpPath.startsWith( QLatin1String(
"http" ) ) )
89 if ( !QgsHelp::urlExists( helpPath ) )
97 const QString filePath = helpPath.mid( 0, helpPath.lastIndexOf( QLatin1Char(
'#' ) ) );
98 if ( !QFileInfo::exists( filePath ) )
102 helpUrl = QUrl::fromLocalFile( filePath );
103 const int pos = helpPath.lastIndexOf( QLatin1Char(
'#' ) );
106 helpUrl.setFragment( helpPath.mid( helpPath.lastIndexOf( QLatin1Char(
'#' ) ) + 1, -1 ) );
114 return helpFound ?
helpUrl : helpNotFound;
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.