In questa pagina

QActionEvent Class

La classe QActionEvent fornisce un evento che viene generato quando un'azione di scelta ( QAction ) viene aggiunta, rimossa o modificata. Per saperne di più...

Intestazione: #include <QActionEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Eredita da: QEvent

Funzioni pubbliche

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

Funzioni protette

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

Descrizione dettagliata

È possibile aggiungere azioni ai controlli, ad esempio utilizzando QWidget::addAction(). Ciò genera un evento ActionAdded, che è possibile gestire per fornire un comportamento personalizzato. Ad esempio, QToolBar reimplementa QWidget::actionEvent() per creare QToolButtons per le azioni.

Vedi anche QAction, QWidget::addAction(), QWidget::removeAction() e QWidget::actions().

Documentazione sulle funzioni membro

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

Crea un evento di azione. Il valore di ` type ` può essere ` ActionChanged`, ` ActionAdded` o ` ActionRemoved`.

action è l'azione che viene modificata, aggiunta o rimossa. Se type è ActionAdded, l'azione deve essere inserita prima dell'azione before. Se before è nullptr, l'azione viene aggiunta alla fine.

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

Crea un'istanza di ` QActionEvent`. Questa funzione è stata eliminata.

QAction *QActionEvent::action() const

Restituisce l'azione che è stata modificata, aggiunta o rimossa.

Vedi anche before().

QAction *QActionEvent::before() const

Se type() restituisce ActionAdded, restituisce l'azione che dovrebbe apparire prima di action(). Se questa funzione restituisce nullptr, l'azione dovrebbe essere aggiunta alle azioni già esistenti sullo stesso widget.

Vedi anche action() e QWidget::actions().

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

Assegna " other " a questa istanza " QActionEvent ". Questa funzione viene eliminata.

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

Assegna “ other ” a questa istanza di “ 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.