Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.1
-
None
-
cc6a4199225f034075751580fd5fd816cbfee6ea
Description
If a widget has Qt::NoContextMenu set, then
the widget does not feature a context menu, context menu handling is deferred to the widget's parent.
From https://doc.qt.io/qt-5/qt.html#ContextMenuPolicy-enum
Just, QWebEngineView does not follow that specification, instead it just swallows the event, so the context menu on the parent widget is not instead invoked.
Reason seems to be that bool QWebEngineView::event(QEvent *ev) has an implementation which always accepts events of type QEvent::ContextMenu, so no deferring to the parent ever happens, including the case of Qt::NoContextMenu.
See http://code.qt.io/cgit/qt/qtwebengine.git/tree/src/webenginewidgets/api/qwebengineview.cpp#n317
A fix would be to make that method follow instead the behaviour of bool QWidget::event(QEvent *event) and only accept the event in case of matching policies, and ignore in case of others, incl. Qt::NoContextMenu.
See http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qwidget.cpp#n8981
Attachments
For Gerrit Dashboard: QTBUG-62345 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
208735,1 | Fix Qt::NoContextMenu policy handling in QWebEngineView | dev | qt/qtwebengine | Status: ABANDONED | 0 | 0 |
208736,3 | Fix Qt::NoContextMenu policy handling in QWebEngineView | 5.10 | qt/qtwebengine | Status: MERGED | +2 | 0 |