Revert "Adjust QtWebKit _key_press to QtWebEngine one"

This reverts commit f52326c5eea83e58d95afb696480600c6a8a5b7b.

For some reason this causes a lot of segfaults...
This commit is contained in:
Florian Bruhin 2016-07-07 12:47:48 +02:00
parent e1bad17f2a
commit 7e3e9618b2

View File

@ -25,7 +25,6 @@ import xml.etree.ElementTree
from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QUrl, QPoint, QTimer from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QUrl, QPoint, QTimer
from PyQt5.QtGui import QKeyEvent from PyQt5.QtGui import QKeyEvent
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKitWidgets import QWebPage from PyQt5.QtWebKitWidgets import QWebPage
from PyQt5.QtWebKit import QWebSettings from PyQt5.QtWebKit import QWebSettings
@ -361,13 +360,16 @@ class WebViewScroller(tabmod.AbstractScroller):
release_evt = QKeyEvent(QEvent.KeyRelease, key, Qt.NoModifier, 0, 0, 0) release_evt = QKeyEvent(QEvent.KeyRelease, key, Qt.NoModifier, 0, 0, 0)
getter = None if getter_name is None else getattr(frame, getter_name) getter = None if getter_name is None else getattr(frame, getter_name)
# FIXME needed?
# self._widget.setFocus()
for _ in range(count): for _ in range(count):
# Abort scrolling if the minimum/maximum was reached. # Abort scrolling if the minimum/maximum was reached.
if (getter is not None and if (getter is not None and
frame.scrollBarValue(direction) == getter(direction)): frame.scrollBarValue(direction) == getter(direction)):
return return
QApplication.postEvent(self._widget, press_evt) self._widget.keyPressEvent(press_evt)
QApplication.postEvent(self._widget, release_evt) self._widget.keyReleaseEvent(release_evt)
def up(self, count=1): def up(self, count=1):
self._key_press(Qt.Key_Up, count, 'scrollBarMinimum', Qt.Vertical) self._key_press(Qt.Key_Up, count, 'scrollBarMinimum', Qt.Vertical)