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 fullPath.replace( QRegularExpression( QStringLiteral(
"(\\$\\$)" ) ), QStringLiteral(
"$" ) );
81 helpPath = QStringLiteral(
"%1/%2" ).arg( fullPath, key );
85 if ( helpPath.startsWith( QLatin1String(
"http" ) ) )
87 if ( !QgsHelp::urlExists( helpPath ) )
95 const QString filePath = helpPath.mid( 0, helpPath.lastIndexOf( QLatin1Char(
'#' ) ) );
96 if ( !QFileInfo::exists( filePath ) )
100 helpUrl = QUrl::fromLocalFile( filePath );
101 const int pos = helpPath.lastIndexOf( QLatin1Char(
'#' ) );
104 helpUrl.setFragment( helpPath.mid( helpPath.lastIndexOf( QLatin1Char(
'#' ) ) + 1, -1 ) );
112 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.