QtWebEngine: Make :fake-key work

This commit is contained in:
Florian Bruhin 2016-08-18 18:44:33 +02:00
parent 2cbaf0ccb3
commit c0ffcfc585

View File

@ -1946,20 +1946,20 @@ class CommandDispatcher:
keyinfo.modifiers, keyinfo.text) keyinfo.modifiers, keyinfo.text)
if global_: if global_:
receiver = QApplication.focusWindow() window = QApplication.focusWindow()
if receiver is None: if window is None:
raise cmdexc.CommandError("No focused window!") raise cmdexc.CommandError("No focused window!")
QApplication.postEvent(window, press_event)
QApplication.postEvent(window, release_event)
else: else:
try: try:
tab = objreg.get('tab', scope='tab', tab='current') tab = objreg.get('tab', scope='tab', tab='current')
except objreg.RegistryUnavailableError: except objreg.RegistryUnavailableError:
raise cmdexc.CommandError("No focused webview!") raise cmdexc.CommandError("No focused webview!")
# pylint: disable=protected-access
receiver = tab._widget
# pylint: enable=protected-access
QApplication.postEvent(receiver, press_event) tab = self._current_widget()
QApplication.postEvent(receiver, release_event) tab.post_event(press_event)
tab.post_event(release_event)
@cmdutils.register(instance='command-dispatcher', scope='window', @cmdutils.register(instance='command-dispatcher', scope='window',
debug=True) debug=True)