Re-enable QWebEngine help viewer backend for Qt 6.2

Fixes: QTCREATORBUG-26380
Change-Id: I8aa31bebd5a8a20f664a17bca2f657fcfac4b1f5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Eike Ziller
2021-08-11 15:37:13 +02:00
parent 083c8029b0
commit b7853efaf3
2 changed files with 13 additions and 6 deletions

View File

@@ -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

View File

@@ -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);