7# include "assistantclient.h"
9#include <QtGui/qdesktopservices.h>
11#include <QtCore/qcoreapplication.h>
12#include <QtCore/qstring.h>
13#include <QtCore/qtextstream.h>
14#include <QtCore/qurl.h>
18using namespace Qt::StringLiterals;
27 std::unique_ptr<HelpClient> result;
31 result = std::make_unique<AssistantClient>();
44static constexpr auto webPrefix =
"https://doc.qt.io/qt-6/"_L1;
45static constexpr auto pythonWebPrefix =
"https://doc.qt.io/qtforpython-6/PySide6/"_L1;
51 const bool result = QDesktopServices::openUrl(QUrl(path));
53 *errorMessage = QCoreApplication::translate(
"WebHelpClient",
54 "Unable to open url (%1).").arg(path);
62 const auto propPos = identifier.lastIndexOf(propertySeparator);
63 const QString widget = propPos != -1 ? identifier.sliced(0, propPos) : identifier;
64 QString result = widget.toLower() + htmlSuffix;
66 result += u'#' + identifier.sliced(propPos + propertySeparator.size()) +
"-prop"_L1;
73 const QString url = identifier.startsWith(
"http"_L1)
74 ? identifier : webPrefix + webPage(identifier);
86 const auto propPos = identifier.lastIndexOf(propertySeparator);
87 const QString widget = propPos != -1 ? identifier.sliced(0, propPos) : identifier;
88 return widget + htmlSuffix;
95 QString url = identifier;
96 if (!identifier.startsWith(
"http"_L1)) {
97 const auto module = identifier.startsWith(
"QAction"_L1) ?
"QtGui"_L1 :
"QtWidgets"_L1;
98 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.