6# include "assistantclient.h"
8#include <QtGui/qdesktopservices.h>
10#include <QtCore/qcoreapplication.h>
11#include <QtCore/qstring.h>
12#include <QtCore/qtextstream.h>
13#include <QtCore/qurl.h>
17using namespace Qt::StringLiterals;
26 std::unique_ptr<HelpClient> result;
30 result = std::make_unique<AssistantClient>();
43static constexpr auto webPrefix =
"https://doc.qt.io/qt-6/"_L1;
44static constexpr auto pythonWebPrefix =
"https://doc.qt.io/qtforpython-6/PySide6/"_L1;
50 const bool result = QDesktopServices::openUrl(QUrl(path));
52 *errorMessage = QCoreApplication::translate(
"WebHelpClient",
53 "Unable to open url (%1).").arg(path);
61 const auto propPos = identifier.lastIndexOf(propertySeparator);
62 const QString widget = propPos != -1 ? identifier.sliced(0, propPos) : identifier;
63 QString result = widget.toLower() + htmlSuffix;
65 result += u'#' + identifier.sliced(propPos + propertySeparator.size()) +
"-prop"_L1;
72 const QString url = identifier.startsWith(
"http"_L1)
73 ? identifier : webPrefix + webPage(identifier);
85 const auto propPos = identifier.lastIndexOf(propertySeparator);
86 const QString widget = propPos != -1 ? identifier.sliced(0, propPos) : identifier;
87 return widget + htmlSuffix;
94 QString url = identifier;
95 if (!identifier.startsWith(
"http"_L1)) {
96 const auto module = identifier.startsWith(
"QAction"_L1) ?
"QtGui"_L1 :
"QtWidgets"_L1;
97 url = pythonWebPrefix + module + u'/'+ webPage(identifier);
virtual QString documentUrl(const QString &module) const =0
QString designerManualUrl() const
bool activateIdentifier(const QString &identifier, QString *errorMessage) override
QString documentUrl(const QString &module) const override
bool activateIdentifier(const QString &identifier, QString *errorMessage) override
bool showPage(const QString &path, QString *errorMessage) override
static constexpr auto webPrefix
static constexpr auto pythonWebPrefix
static constexpr auto propertySeparator
static constexpr auto htmlSuffix
Combined button and popup list for selecting options.