Auf dieser Seite

QFocusEvent Class

Die Klasse „QFocusEvent“ enthält Ereignisparameter für Fokusereignisse von Widgets. Mehr...

Header: #include <QFocusEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Erbt von: QEvent

Öffentliche Funktionen

QFocusEvent(QEvent::Type type, Qt::FocusReason reason = Qt::OtherFocusReason)
bool gotFocus() const
bool lostFocus() const
Qt::FocusReason reason() const

Geschützte Funktionen

QFocusEvent(QFocusEvent &&)
QFocusEvent &operator=(QFocusEvent &&)
QFocusEvent &operator=(const QFocusEvent &other)

Ausführliche Beschreibung

Fokusereignisse werden an Widgets gesendet, wenn sich der Fokus der Tastatureingabe ändert. Fokusereignisse treten aufgrund von Mausaktionen, Tastendrücken (wie z. B. „ Tab “ oder „ Backtab “), dem Fenstersystem, Popup-Menüs, Tastenkombinationen oder anderen anwendungsspezifischen Gründen auf. Der Grund für ein bestimmtes Fokusereignis wird von „ reason()“ im entsprechenden Ereignis-Handler zurückgegeben.

Die Ereignisbehandler ` QWidget::focusInEvent()`, ` QWidget::focusOutEvent()`, ` QGraphicsItem::focusInEvent ` und ` QGraphicsItem::focusOutEvent()` empfangen Fokusereignisse.

Siehe auch QWidget::setFocus(), QWidget::setFocusPolicy() und Tastaturfokus in Widgets.

Dokumentation zu Mitgliedsfunktionen

[explicit] QFocusEvent::QFocusEvent(QEvent::Type type, Qt::FocusReason reason = Qt::OtherFocusReason)

Erstellt ein Fokus-Ereignisobjekt.

Der Parameter „ type “ muss entweder „ QEvent::FocusIn “ oder „ QEvent::FocusOut “ lauten. Der Parameter „ reason “ beschreibt die Ursache der Fokusänderung.

[protected delete] QFocusEvent::QFocusEvent(QFocusEvent &&)

Erstellt eine Instanz von ` QFocusEvent`. Diese Funktion wurde gelöscht.

bool QFocusEvent::gotFocus() const

Gibt ` true ` zurück, wenn ` type()` den Wert ` QEvent::FocusIn` ergibt; andernfalls wird `false` zurückgegeben.

bool QFocusEvent::lostFocus() const

Gibt „ true “ zurück, wenn „ type()“ den Wert „ QEvent::FocusOut “ ergibt; andernfalls wird „false“ zurückgegeben.

Qt::FocusReason QFocusEvent::reason() const

Gibt den Grund für dieses Fokusereignis zurück.

[protected delete] QFocusEvent &QFocusEvent::operator=(QFocusEvent &&)

Weist „ other “ dieser „ QFocusEvent “-Instanz zu. Diese Funktion wird gelöscht.

[noexcept protected default] QFocusEvent &QFocusEvent::operator=(const QFocusEvent &other)

other Weist dieser Instanz von „ QFocusEvent “ den Wert „ “ zu. “ zu dieser Instanz von „ “ zu.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.