aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2021-08-11 15:37:13 +0200
committerEike Ziller <eike.ziller@qt.io>2021-11-05 09:10:15 +0000
commitb7853efaf3a3e2d6b6ae0c77ddd886934b1ba234 (patch)
treef1165a0803c1020c4f58a83654c4ffae95801547 /src/plugins/help
parent083c8029b0c160759238de3d4b24284dfc16cb19 (diff)
Re-enable QWebEngine help viewer backend for Qt 6.2
Fixes: QTCREATORBUG-26380 Change-Id: I8aa31bebd5a8a20f664a17bca2f657fcfac4b1f5 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/help')
-rw-r--r--src/plugins/help/CMakeLists.txt7
-rw-r--r--src/plugins/help/webenginehelpviewer.cpp12
2 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/help/CMakeLists.txt b/src/plugins/help/CMakeLists.txt
index e63599eb07e..09050db7b96 100644
--- a/src/plugins/help/CMakeLists.txt
+++ b/src/plugins/help/CMakeLists.txt
@@ -49,12 +49,7 @@ extend_qtc_plugin(Help
macwebkithelpviewer.mm
)
-set(BUILD_HELPVIEWERBACKEND_QTWEBENGINE_DEFAULT YES)
-if (Qt6_FOUND)
- set(BUILD_HELPVIEWERBACKEND_QTWEBENGINE_DEFAULT NO)
-endif ()
-
-option(BUILD_HELPVIEWERBACKEND_QTWEBENGINE "Build QtWebEngine based help viewer backend." ${BUILD_HELPVIEWERBACKEND_QTWEBENGINE_DEFAULT})
+option(BUILD_HELPVIEWERBACKEND_QTWEBENGINE "Build QtWebEngine based help viewer backend." YES)
find_package(Qt5 COMPONENTS WebEngineWidgets QUIET)
extend_qtc_plugin(Help
CONDITION BUILD_HELPVIEWERBACKEND_QTWEBENGINE AND TARGET Qt5::WebEngineWidgets
diff --git a/src/plugins/help/webenginehelpviewer.cpp b/src/plugins/help/webenginehelpviewer.cpp
index 65d80c4d30c..7ece25833ff 100644
--- a/src/plugins/help/webenginehelpviewer.cpp
+++ b/src/plugins/help/webenginehelpviewer.cpp
@@ -37,7 +37,11 @@
#include <QDesktopServices>
#include <QTimer>
#include <QVBoxLayout>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
+#include <QWebEngineContextMenuRequest>
+#else
#include <QWebEngineContextMenuData>
+#endif
#include <QWebEngineHistory>
#include <QWebEngineProfile>
#include <QWebEngineSettings>
@@ -335,7 +339,11 @@ bool WebView::eventFilter(QObject *src, QEvent *e)
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
+#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
+ QMenu *menu = createStandardContextMenu();
+#else
QMenu *menu = page()->createStandardContextMenu();
+#endif
// insert Open as New Page etc if OpenLinkInThisWindow is also there
const QList<QAction*> actions = menu->actions();
auto it = std::find(actions.cbegin(), actions.cend(),
@@ -344,7 +352,11 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
// insert after
++it;
QAction *before = (it == actions.cend() ? 0 : *it);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
+ QUrl url = lastContextMenuRequest()->linkUrl();
+#else
QUrl url = page()->contextMenuData().linkUrl();
+#endif
if (m_viewer->isActionVisible(HelpViewer::Action::NewPage)) {
auto openLink = new QAction(QCoreApplication::translate("HelpViewer",
Constants::TR_OPEN_LINK_AS_NEW_PAGE), menu);