- class QFocusEvent¶
The
QFocusEvent
class contains event parameters for widget focus events. More…Synopsis¶
Methods¶
def
__init__()
def
__repr__()
def
gotFocus()
def
lostFocus()
def
reason()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by
reason()
in the appropriate event handler.The event handlers QWidget::focusInEvent(), QWidget::focusOutEvent(), QGraphicsItem::focusInEvent and QGraphicsItem::focusOutEvent() receive focus events.
See also
setFocusPolicy()Keyboard Focus in Widgets
- __init__(arg__1)¶
- Parameters:
arg__1 –
QFocusEvent
- __init__(type[, reason=Qt.OtherFocusReason])
- Parameters:
type –
Type
reason –
FocusReason
Constructs a focus event object.
The
type
parameter must be either QEvent::FocusIn or QEvent::FocusOut. Thereason
describes the cause of the change in focus.- __repr__()¶
- Return type:
str
- gotFocus()¶
- Return type:
bool
Returns
true
if type() is QEvent::FocusIn; otherwise returns false.- lostFocus()¶
- Return type:
bool
Returns
true
if type() is QEvent::FocusOut; otherwise returns false.- reason()¶
- Return type:
Returns the reason for this focus event.