QActionEvent Class

The QActionEvent class provides an event that is generated when a QAction is added, removed, or changed. 更多...

头文件: #include <QActionEvent>
qmake: QT += gui
基类: QEvent

公有函数

QActionEvent(int type, QAction *action, QAction *before = Q_NULLPTR)
QAction *action() const
QAction *before() const
  • 6 个公有函数继承自 QEvent

其他继承的成员

  • 1 个属性继承自 QEvent
  • 1 个静态公有成员继承自 QEvent
  • 2 个受保护的变量继承自 QEvent

详细描述

The QActionEvent class provides an event that is generated when a QAction is added, removed, or changed.

Actions can be added to widgets using QWidget::addAction(). This generates an ActionAdded event, which you can handle to provide custom behavior. For example, QToolBar reimplements QWidget::actionEvent() to create QToolButtons for the actions.

参见 QAction, QWidget::addAction(), QWidget::removeAction(), and QWidget::actions().

成员函数

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

Constructs an action event. The type can be ActionChanged, ActionAdded, or ActionRemoved.

action is the action that is changed, added, or removed. If type is ActionAdded, the action is to be inserted before the action before. If before is 0, the action is appended.

QAction *QActionEvent::action() const

Returns the action that is changed, added, or removed.

参见 before().

QAction *QActionEvent::before() const

If type() is ActionAdded, returns the action that should appear before action(). If this function returns 0, the action should be appended to already existing actions on the same widget.

参见 action() and QWidget::actions().