forked from qt-creator/qt-creator
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:
@@ -49,12 +49,7 @@ extend_qtc_plugin(Help
|
|||||||
macwebkithelpviewer.mm
|
macwebkithelpviewer.mm
|
||||||
)
|
)
|
||||||
|
|
||||||
set(BUILD_HELPVIEWERBACKEND_QTWEBENGINE_DEFAULT YES)
|
option(BUILD_HELPVIEWERBACKEND_QTWEBENGINE "Build QtWebEngine based help viewer backend." 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})
|
|
||||||
find_package(Qt5 COMPONENTS WebEngineWidgets QUIET)
|
find_package(Qt5 COMPONENTS WebEngineWidgets QUIET)
|
||||||
extend_qtc_plugin(Help
|
extend_qtc_plugin(Help
|
||||||
CONDITION BUILD_HELPVIEWERBACKEND_QTWEBENGINE AND TARGET Qt5::WebEngineWidgets
|
CONDITION BUILD_HELPVIEWERBACKEND_QTWEBENGINE AND TARGET Qt5::WebEngineWidgets
|
||||||
|
|||||||
@@ -37,7 +37,11 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||||
|
#include <QWebEngineContextMenuRequest>
|
||||||
|
#else
|
||||||
#include <QWebEngineContextMenuData>
|
#include <QWebEngineContextMenuData>
|
||||||
|
#endif
|
||||||
#include <QWebEngineHistory>
|
#include <QWebEngineHistory>
|
||||||
#include <QWebEngineProfile>
|
#include <QWebEngineProfile>
|
||||||
#include <QWebEngineSettings>
|
#include <QWebEngineSettings>
|
||||||
@@ -335,7 +339,11 @@ bool WebView::eventFilter(QObject *src, QEvent *e)
|
|||||||
|
|
||||||
void WebView::contextMenuEvent(QContextMenuEvent *event)
|
void WebView::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||||
|
QMenu *menu = createStandardContextMenu();
|
||||||
|
#else
|
||||||
QMenu *menu = page()->createStandardContextMenu();
|
QMenu *menu = page()->createStandardContextMenu();
|
||||||
|
#endif
|
||||||
// insert Open as New Page etc if OpenLinkInThisWindow is also there
|
// insert Open as New Page etc if OpenLinkInThisWindow is also there
|
||||||
const QList<QAction*> actions = menu->actions();
|
const QList<QAction*> actions = menu->actions();
|
||||||
auto it = std::find(actions.cbegin(), actions.cend(),
|
auto it = std::find(actions.cbegin(), actions.cend(),
|
||||||
@@ -344,7 +352,11 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
// insert after
|
// insert after
|
||||||
++it;
|
++it;
|
||||||
QAction *before = (it == actions.cend() ? 0 : *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();
|
QUrl url = page()->contextMenuData().linkUrl();
|
||||||
|
#endif
|
||||||
if (m_viewer->isActionVisible(HelpViewer::Action::NewPage)) {
|
if (m_viewer->isActionVisible(HelpViewer::Action::NewPage)) {
|
||||||
auto openLink = new QAction(QCoreApplication::translate("HelpViewer",
|
auto openLink = new QAction(QCoreApplication::translate("HelpViewer",
|
||||||
Constants::TR_OPEN_LINK_AS_NEW_PAGE), menu);
|
Constants::TR_OPEN_LINK_AS_NEW_PAGE), menu);
|
||||||
|
|||||||
Reference in New Issue
Block a user