Class: QgsFocusWatcher

class qgis.gui.QgsFocusWatcher

Bases: PyQt5.QtCore.QObject

A event filter for watching for focus events on a parent object. Usually QObjects must subclass and override methods like focusOutEvent to handle focus events. Using this class as an event filter avoids the need to subclass objects and the focus events can be directly caught using the emitted signals.

New in version 2.16.

QgsFocusWatcher(parent: QObject) Constructor for QgsFocusWatcher.

Parameters

parent

parent widget to catch focus events for. This class will automatically be

installed as an event filter for parent.

Methods

childEvent

connectNotify

customEvent

disconnectNotify

eventFilter

param obj

isSignalConnected

receivers

sender

senderSignalIndex

timerEvent

Signals

focusChanged

Emitted when parent object’s focus changes.

focusIn

Emitted when parent object gains focus.

focusOut

Emitted when parent object loses focus.

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
eventFilter(self, obj: QObject, event: QEvent) bool
Parameters
  • obj (QObject) –

  • event (QEvent) –

Return type

bool

focusChanged

Emitted when parent object’s focus changes.

Parameters

focused (bool) – True if object gained focus, False if object lost focus [signal]

focusIn

Emitted when parent object gains focus. [signal]

focusOut

Emitted when parent object loses focus. [signal]

isSignalConnected(self, QMetaMethod) bool
receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)