summaryrefslogtreecommitdiffstats
path: root/src/designer/src/designer/qdesigner_actions.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-11-06 12:42:59 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-11-06 14:11:36 +0100
commit5f238adc4c652e6e1bb34752f201cf8e377cbc25 (patch)
tree1e5a877cbafdb63ff7f3eee324de9dfa73b1c969 /src/designer/src/designer/qdesigner_actions.cpp
parent7ecd60c80c506c3af8127aa12ebc5a2d64370f0f (diff)
Designer: Use QDesktopServices to show designer help
Task-number: QTBUG-86746 Change-Id: I3533c8eecacda4f8edf31c912c3c75e707549b19 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/designer/src/designer/qdesigner_actions.cpp')
-rw-r--r--src/designer/src/designer/qdesigner_actions.cpp39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp
index 4b98d6493..11cb350df 100644
--- a/src/designer/src/designer/qdesigner_actions.cpp
+++ b/src/designer/src/designer/qdesigner_actions.cpp
@@ -70,9 +70,12 @@
#include <QtGui/qaction.h>
#include <QtGui/qactiongroup.h>
+#include <QtGui/qcursor.h>
+#include <QtGui/qdesktopservices.h>
#include <QtGui/qevent.h>
#include <QtGui/qicon.h>
#include <QtGui/qimage.h>
+#include <QtGui/qpainter.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qscreen.h>
#if defined(QT_PRINTSUPPORT_LIB) // Some platforms may not build QtPrintSupport
@@ -83,9 +86,7 @@
# define HAS_PRINTER
# endif
#endif
-#include <QtGui/qpainter.h>
#include <QtGui/qtransform.h>
-#include <QtGui/qcursor.h>
#include <QtCore/qsize.h>
#include <QtCore/qlibraryinfo.h>
@@ -987,23 +988,32 @@ QAction *QDesignerActions::minimizeAction() const
void QDesignerActions::showDesignerHelp()
{
- QString url = AssistantClient::designerManualUrl();
- url += QStringLiteral("qtdesigner-manual.html");
- showHelp(url);
+ showHelp("qtdesigner-manual.html");
}
void QDesignerActions::helpRequested(const QString &manual, const QString &document)
{
- QString url = AssistantClient::documentUrl(manual);
- url += document;
- showHelp(url);
+ Q_UNUSED(manual);
+ showHelp(document);
}
-void QDesignerActions::showHelp(const QString &url)
+bool QDesignerActions::showHelp(const QString &htmlFile)
{
- QString errorMessage;
- if (!m_assistantClient.showPage(url, &errorMessage))
- QMessageBox::warning(core()->topLevel(), tr("Assistant"), errorMessage);
+ const int qtVersion = QT_VERSION;
+ QString url;
+ QTextStream(&url) << "http://doc.qt.io/qt-" << (qtVersion >> 16)
+// TODO: uncomment the line below just before Qt 6.0 release
+// we should have then http://doc.qt.io/qt-6.0/ link valid (like in case of 5.x series).
+// Currently it redirects to Qt 6 snapshot.
+// << "." << ((qtVersion >> 8) & 0xFF)
+ << '/' << htmlFile;
+
+ return QDesktopServices::openUrl(QUrl(url));
+}
+
+bool QDesignerActions::showIdentifier(const QString &identifier)
+{
+ return showHelp(identifier.toLower() + ".html");
}
void QDesignerActions::aboutDesigner()
@@ -1032,10 +1042,7 @@ void QDesignerActions::showWidgetSpecificHelp()
return;
}
- QString errorMessage;
- const bool rc = m_assistantClient.activateIdentifier(helpId, &errorMessage);
- if (!rc)
- QMessageBox::warning(core()->topLevel(), tr("Assistant"), errorMessage);
+ showIdentifier(helpId);
}
void QDesignerActions::updateCloseAction()