QActionEvent 类

QActionEvent class provides an event that is generated when a QAction 被添加、被移除或被改变时。 更多...

头: #include <QActionEvent>
qmake: QT += gui
继承: QEvent

公共函数

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

额外继承成员

详细描述

QActionEvent class provides an event that is generated when a QAction 被添加、被移除或被改变时。

动作可以被添加到 Widget,使用 QWidget::addAction ()。这生成 ActionAdded 事件,可以处理这以提供自定义行为。例如, QToolBar 重实现 QWidget::actionEvent () 以创建 QToolButton 为动作。

另请参阅 QAction , QWidget::addAction (), QWidget::removeAction (),和 QWidget::actions ().

成员函数文档编制

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

构造动作事件。 type 可以是 ActionChanged , ActionAdded ,或 ActionRemoved .

action 是被改变、被添加或被移除的动作。若 type is ActionAdded , the action is to be inserted before the action before 。若 before is 0, the action is appended.

QAction *QActionEvent:: action () const

返回被改变、被添加或被移除的动作。

另请参阅 before ().

QAction *QActionEvent:: before () const

type () 是 ActionAdded ,返回动作的出现应该前于 action (). If this function returns 0, the action should be appended to already existing actions on the same widget.

另请参阅 action () 和 QWidget::actions ().