48 const QStringList paths = settings.
value( QStringLiteral(
"help/helpSearchPath" ) ).toStringList();
49 if ( paths.isEmpty() )
58 QString helpPath, fullPath;
59 bool helpFound =
false;
61 const auto constPaths = paths;
62 for (
const QString &path : constPaths )
64 if ( path.endsWith( QLatin1String(
"\\" ) ) || path.endsWith( QLatin1Char(
'/' ) ) )
66 fullPath = path.left( path.size() - 1 );
73 const auto constVariableNames = scope->variableNames();
74 for (
const QString &var : constVariableNames )
76 const QRegularExpression rx( QStringLiteral(
"(<!\\$\\$)*(\\$%1)" ).arg( var ) );
77 fullPath.replace( rx, scope->variable( var ).toString() );
79 const thread_local QRegularExpression pathRx( QStringLiteral(
"(\\$\\$)" ) );
80 fullPath.replace( pathRx, QStringLiteral(
"$" ) );
82 helpPath = QStringLiteral(
"%1/%2" ).arg( fullPath, key );
86 if ( helpPath.startsWith( QLatin1String(
"http" ) ) )
88 if ( !QgsHelp::urlExists( helpPath ) )
96 const QString filePath = helpPath.mid( 0, helpPath.lastIndexOf( QLatin1Char(
'#' ) ) );
97 if ( !QFileInfo::exists( filePath ) )
101 helpUrl = QUrl::fromLocalFile( filePath );
102 const int pos = helpPath.lastIndexOf( QLatin1Char(
'#' ) );
105 helpUrl.setFragment( helpPath.mid( helpPath.lastIndexOf( QLatin1Char(
'#' ) ) + 1, -1 ) );
113 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.