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