QFocusEvent Class

QFocusEvent クラスは、ウィジェットのフォーカスイベント用のイベントパラメータを含んでいます。詳細...

ヘッダ #include <QFocusEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
継承: QEvent

パブリック関数

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

詳細説明

フォーカスイベントは、キーボード入力のフォーカスが変更されたときにウィジェットに送信されます。フォーカス・イベントは、マウス操作、キー押下(TabBacktab など)、ウィンドウ・システム、ポップアップ・メニュー、キーボード・ショートカット、その他のアプリケーション固有の理由によって発生します。特定のフォーカス・イベントの理由は、適切なイベント・ハンドラのreason() によって返されます。

イベント・ハンドラQWidget::focusInEvent()、QWidget::focusOutEvent()、QGraphicsItem::focusInEvent およびQGraphicsItem::focusOutEvent() は、フォーカス・イベントを受け取る。

QWidget::setFocus()、QWidget::setFocusPolicy()、およびウィジェットのキーボード・フォーカスも参照してください

メンバ関数ドキュメント

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

フォーカスイベントオブジェクトを構築する。

type パラメータには、QEvent::FocusIn またはQEvent::FocusOut のいずれかを指定します。reason には、フォーカスの変化の原因を記述します。

bool QFocusEvent::gotFocus() const

type() がQEvent::FocusIn であればtrue を返し、そうでなければ false を返す。

bool QFocusEvent::lostFocus() const

type() がQEvent::FocusOut であればtrue を返し、そうでなければ false を返す。

Qt::FocusReason QFocusEvent::reason() const

このフォーカスイベントの理由を返します。

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