Fix WebEngineElement.click on Qt 5.6
This commit is contained in:
parent
f718b66c48
commit
7a4a34c374
@ -25,7 +25,7 @@
|
||||
from PyQt5.QtCore import QRect, Qt, QPoint
|
||||
from PyQt5.QtGui import QMouseEvent
|
||||
|
||||
from qutebrowser.utils import log, javascript
|
||||
from qutebrowser.utils import log, javascript, qtutils
|
||||
from qutebrowser.browser import webelem
|
||||
|
||||
|
||||
@ -159,11 +159,15 @@ class WebEngineElement(webelem.AbstractWebElement):
|
||||
# because it was added in Qt 5.6, but we can be sure we use that with
|
||||
# QtWebEngine.
|
||||
# pylint: disable=no-member
|
||||
ev = QMouseEvent(QMouseEvent.MouseButtonPress, QPoint(0, 0),
|
||||
QPoint(0, 0), QPoint(0, 0), Qt.NoButton, Qt.NoButton,
|
||||
Qt.NoModifier, Qt.MouseEventSynthesizedBySystem)
|
||||
# pylint: enable=no-member
|
||||
self._tab.send_event(ev)
|
||||
# This also seems to break stuff on Qt 5.6 for some reason...
|
||||
if qtutils.version_check('5.7'):
|
||||
ev = QMouseEvent(QMouseEvent.MouseButtonPress, QPoint(0, 0),
|
||||
QPoint(0, 0), QPoint(0, 0), Qt.NoButton,
|
||||
Qt.NoButton, Qt.NoModifier,
|
||||
Qt.MouseEventSynthesizedBySystem)
|
||||
# pylint: enable=no-member
|
||||
self._tab.send_event(ev)
|
||||
|
||||
# This actually "clicks" the element by calling focus() on it in JS.
|
||||
js_code = javascript.assemble('webelem', 'focus', self._id)
|
||||
self._tab.run_js_async(js_code)
|
||||
|
Loading…
Reference in New Issue
Block a user