Help viewer: Add option for scroll wheel zooming

Fixes: QTCREATORBUG-14154
Change-Id: Ia6c4aedb78954614477f0228ba82c4dc476a2525
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2019-02-15 15:30:52 +01:00
parent 9e965409d1
commit 334c76fd31
12 changed files with 90 additions and 11 deletions

View File

@@ -292,6 +292,31 @@ WebView::WebView(WebEngineHelpViewer *viewer)
{
}
bool WebView::event(QEvent *ev)
{
// work around QTBUG-43602
if (ev->type() == QEvent::ChildAdded) {
auto ce = static_cast<QChildEvent *>(ev);
ce->child()->installEventFilter(this);
} else if (ev->type() == QEvent::ChildRemoved) {
auto ce = static_cast<QChildEvent *>(ev);
ce->child()->removeEventFilter(this);
}
return QWebEngineView::event(ev);
}
bool WebView::eventFilter(QObject *src, QEvent *e)
{
Q_UNUSED(src)
// work around QTBUG-43602
if (m_viewer->isScrollWheelZoomingEnabled() && e->type() == QEvent::Wheel) {
auto we = static_cast<QWheelEvent *>(e);
if (we->modifiers() == Qt::ControlModifier)
return true;
}
return false;
}
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = page()->createStandardContextMenu();