summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/mainwindow.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2022-11-24 10:57:55 +0100
committerEike Ziller <eike.ziller@qt.io>2022-11-24 15:10:05 +0000
commit2ff5f18bff8c5a5d7a18353148e1ed9e1e81310f (patch)
tree8e28da4a0d23710e73b5ffdfdab23f0543568de8 /src/plugins/coreplugin/mainwindow.cpp
parent7a2901d502ccf35ec8edcaf67f6ebff239e844f7 (diff)
downloadqt-creator-2ff5f18bff8c5a5d7a18353148e1ed9e1e81310f.tar.gz
Transform doc.qt.io/qt-creator links to internal qthelp links, for links
that are found locally in the documentation. That opens such links in Qt Creator, instead of in the web, if possible. Change-Id: I2270c6947db22f4aeb4968bf5b7245de57521c92 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/mainwindow.cpp')
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 9c63e36e70..4950eb909b 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -11,6 +11,7 @@
#include "externaltoolmanager.h"
#include "fancytabwidget.h"
#include "generalsettings.h"
+#include "helpmanager.h"
#include "icore.h"
#include "idocumentfactory.h"
#include "jsexpander.h"
@@ -1516,8 +1517,17 @@ void MainWindow::changeLog()
return;
const FilePath file = versionedFiles.at(index).second;
QString contents = QString::fromUtf8(file.fileContents().value_or(QByteArray()));
- contents.replace(QRegularExpression("(QT(CREATOR)?BUG-[0-9]+)"),
- "[\\1](https://bugreports.qt.io/browse/\\1)");
+ static const QRegularExpression bugexpr("(QT(CREATOR)?BUG-[0-9]+)");
+ contents.replace(bugexpr, "[\\1](https://bugreports.qt.io/browse/\\1)");
+ static const QRegularExpression docexpr("https://doc[.]qt[.]io/qtcreator/([.a-zA-Z/_-]*)");
+ QList<QRegularExpressionMatch> matches;
+ for (const QRegularExpressionMatch &m : docexpr.globalMatch(contents))
+ matches.append(m);
+ Utils::reverseForeach(matches, [&contents](const QRegularExpressionMatch &match) {
+ const QString qthelpUrl = "qthelp://org.qt-project.qtcreator/doc/" + match.captured(1);
+ if (!HelpManager::fileData(qthelpUrl).isEmpty())
+ contents.replace(match.capturedStart(), match.capturedLength(), qthelpUrl);
+ });
textEdit->setMarkdown(contents);
};
connect(versionCombo, &QComboBox::currentIndexChanged, textEdit, showLog);