1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-22 02:02:10 +02:00

WebView: Support QApplication::wheelScrollLines

This commit is contained in:
David Rosca 2016-12-27 21:52:54 +01:00
parent 6652d971ba
commit a4d284fa71

View File

@ -988,6 +988,19 @@ void WebView::_wheelEvent(QWheelEvent *event)
if (event->modifiers() & Qt::ControlModifier) {
event->delta() > 0 ? zoomIn() : zoomOut();
event->accept();
return;
}
// QtWebEngine ignores QApplication::wheelScrollLines() and instead always scrolls 3 lines
if (event->spontaneous()) {
const qreal multiplier = QApplication::wheelScrollLines() / 3.0;
if (multiplier != 1.0) {
QWheelEvent e(event->pos(), event->globalPos(), event->pixelDelta(),
event->angleDelta() * multiplier, 0, Qt::Horizontal, event->buttons(),
event->modifiers(), event->phase(), event->source(), event->inverted());
QApplication::sendEvent(m_rwhvqt, &e);
event->accept();
}
}
}