In questa pagina

QFocusEvent Class

La classe QFocusEvent contiene i parametri relativi agli eventi di focus dei widget. Maggiori informazioni...

Intestazione: #include <QFocusEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Eredita da: QEvent

Funzioni pubbliche

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

Funzioni protette

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

Descrizione dettagliata

Gli eventi di focus vengono inviati ai widget quando cambia il focus dell'input da tastiera. Gli eventi di focus si verificano a seguito di azioni del mouse, pressioni di tasti (come Tab o Backtab), del sistema delle finestre, dei menu a comparsa, delle scorciatoie da tastiera o per altri motivi specifici dell'applicazione. Il motivo di un particolare evento di focus viene restituito da reason() nel gestore di eventi appropriato.

I gestori di eventi QWidget::focusInEvent(), QWidget::focusOutEvent(), QGraphicsItem::focusInEvent e QGraphicsItem::focusOutEvent() ricevono gli eventi di focus.

Vedi anche QWidget::setFocus(), QWidget::setFocusPolicy() e Focus da tastiera nei widget.

Documentazione delle funzioni membro

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

Crea un oggetto evento focus.

Il parametro ` type ` deve assumere uno dei seguenti valori: ` QEvent::FocusIn ` o ` QEvent::FocusOut`. Il parametro ` reason ` descrive la causa del cambiamento di focus.

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

Crea un'istanza di ` QFocusEvent`. Questa funzione è stata eliminata.

bool QFocusEvent::gotFocus() const

Restituisce ` true ` se ` type()` restituisce ` QEvent::FocusIn`; altrimenti restituisce `false`.

bool QFocusEvent::lostFocus() const

Restituisce ` true ` se ` type()` è ` QEvent::FocusOut`; altrimenti restituisce `false`.

Qt::FocusReason QFocusEvent::reason() const

Restituisce il motivo di questo evento di focus.

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

Assegna " other " a questa istanza di " QFocusEvent ". Questa funzione viene eliminata.

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

Assegna per copia other a questa istanza di QFocusEvent.

© 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.