Nesta página

QActionEvent Class

A classe QActionEvent fornece um evento que é gerado quando um objeto ` QAction ` é adicionado, removido ou alterado. Mais...

Cabeçalho: #include <QActionEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Herdado de: QEvent

Funções públicas

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

Funções protegidas

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

Descrição detalhada

É possível adicionar ações aos controles, por exemplo, usando ` QWidget::addAction()`. Isso gera um evento ` ActionAdded `, que você pode tratar para fornecer um comportamento personalizado. Por exemplo, ` QToolBar ` reimplementa ` QWidget::actionEvent()` para criar ` QToolButton`s para as ações.

Veja também QAction, QWidget::addAction(), QWidget::removeAction() e QWidget::actions().

Documentação das funções-membro

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

Cria um evento de ação. O parâmetro ` type ` pode ser ` ActionChanged`, ` ActionAdded` ou ` ActionRemoved`.

action é a ação que é alterada, adicionada ou removida. Se type for ActionAdded, a ação deve ser inserida antes da ação before. Se before for nullptr, a ação é anexada.

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

Cria uma instância de ` QActionEvent` por meio da construção `move`. Essa função foi excluída.

QAction *QActionEvent::action() const

Retorna a ação que foi alterada, adicionada ou removida.

Veja também before().

QAction *QActionEvent::before() const

Se type() for ActionAdded, retorna a ação que deve aparecer antes de action(). Se essa função retornar nullptr, a ação deve ser anexada às ações já existentes no mesmo widget.

Veja também action() e QWidget::actions().

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

A função “Move-assigns” atribui “ other ” a esta instância de “ QActionEvent ”. Essa função é excluída.

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

Copia e atribui other a esta instância de 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.