Add postpone argument to AbstractTab.send_event
This commit is contained in:
parent
a846a5b89f
commit
4362d42c50
@ -566,11 +566,18 @@ class AbstractTab(QWidget):
|
|||||||
"""Return the widget events should be sent to."""
|
"""Return the widget events should be sent to."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def send_event(self, evt):
|
def send_event(self, evt, *, postpone=False):
|
||||||
"""Send the given event to the underlying widget."""
|
"""Send the given event to the underlying widget.
|
||||||
recipient = self._event_target()
|
|
||||||
QApplication.sendEvent(recipient, evt)
|
|
||||||
|
|
||||||
|
Args:
|
||||||
|
postpone: Postpone the event to be handled later instead of
|
||||||
|
immediately. Using this might cause crashes in Qt.
|
||||||
|
"""
|
||||||
|
recipient = self._event_target()
|
||||||
|
if postpone:
|
||||||
|
QApplication.postEvent(recipient, evt)
|
||||||
|
else:
|
||||||
|
QApplication.sendEvent(recipient, evt)
|
||||||
|
|
||||||
@pyqtSlot(QUrl)
|
@pyqtSlot(QUrl)
|
||||||
def _on_link_clicked(self, url):
|
def _on_link_clicked(self, url):
|
||||||
|
Loading…
Reference in New Issue
Block a user