このページでは

QActionEvent Class

QActionEvent クラスは、QAction が追加、削除、または変更された際に発生するイベントを提供します。詳細...

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

パブリック関数

QActionEvent(int type, QAction *action, QAction *before = nullptr)
QAction *action() const
QAction *before() const

プロテクトされた関数

QActionEvent(QActionEvent &&)
QActionEvent &operator=(QActionEvent &&)
QActionEvent &operator=(const QActionEvent &other)

詳細な説明

アクションは、たとえばQWidget::addAction() を使用することで、コントロールに追加できます。これにより、ActionAdded イベントが生成され、これを処理してカスタム動作を提供することができます。たとえば、QToolBar は、QWidget::actionEvent() を再実装して、アクション用のQToolButtonを作成しています。

QAction 、QWidget::addAction()、QWidget::removeAction()、およびQWidget::actions()も参照してください 。

メンバ関数のドキュメント

QActionEvent::QActionEvent(int type, QAction *action, QAction *before = nullptr)

アクションイベントを生成します。type には、ActionChanged 、ActionAdded 、またはActionRemoved を指定できます。

action は、変更、追加、または削除されるアクションです。type がActionAddedの場合、そのアクションはbefore のアクションの前に挿入されます。before がnullptr の場合、そのアクションは末尾に追加されます。

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

QActionEvent のインスタンスをMoveコンストラクタで生成します。この関数は削除されています。

QAction *QActionEvent::action() const

変更、追加、または削除されたアクションを返します。

before()も参照してください 。

QAction *QActionEvent::before() const

type() の値がActionAdded の場合、action() の前に表示されるべきアクションを返します。この関数がnullptr を返した場合、そのアクションは同じウィジェット上の既存のアクションの末尾に追加されるべきです。

action() およびQWidget::actions()も参照してください 。

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

other をこのQActionEvent インスタンスに割り当てます。この関数は削除されます。

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

other をこのQActionEvent インスタンスにコピーして割り当てます。

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