Auf dieser Seite

QActionEvent Class

Die Klasse „QActionEvent“ stellt ein Ereignis bereit, das ausgelöst wird, wenn ein „ QAction “ hinzugefügt, entfernt oder geändert wird. Mehr...

Header: #include <QActionEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Erbt von: QEvent

Öffentliche Funktionen

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

Geschützte Funktionen

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

Ausführliche Beschreibung

Aktionen können Steuerelementen hinzugefügt werden, beispielsweise mithilfe von ` QWidget::addAction()`. Dadurch wird ein ` ActionAdded `-Ereignis ausgelöst, das Sie abfangen können, um benutzerdefiniertes Verhalten bereitzustellen. Beispielsweise implementiert ` QToolBar ` die Methode ` QWidget::actionEvent()` neu, um ` QToolButton`s für die Aktionen zu erstellen.

Siehe auch „ QAction“ , „ QWidget::addAction()“, „ QWidget::removeAction()“ und „ QWidget::actions()“.

Dokumentation zu den Member-Funktionen

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

Erstellt ein Aktionsereignis. Der Parameter „ type “ kann folgende Werte annehmen: „ ActionChanged “, „ ActionAdded “ oder „ ActionRemoved “.

action ist die Aktion, die geändert, hinzugefügt oder entfernt wird. Wenn type „ActionAdded“ ist, soll die Aktion vor der Aktion „ before “ eingefügt werden. Wenn before „ nullptr “ ist, wird die Aktion angehängt.

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

Erstellt eine Instanz von ` QActionEvent`. Diese Funktion wurde gelöscht.

QAction *QActionEvent::action() const

Gibt die Aktion zurück, die geändert, hinzugefügt oder entfernt wurde.

Siehe auch „ before()“.

QAction *QActionEvent::before() const

Wenn type() den Wert ActionAdded zurückgibt, wird die Aktion zurückgegeben, die vor action() ausgeführt werden soll. Wenn diese Funktion den Wert nullptr zurückgibt, soll die Aktion an bereits vorhandene Aktionen für dasselbe Widget angehängt werden.

Siehe auch ` action()` und ` QWidget::actions()`.

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

other Weist dieser „ QActionEvent “-Instanz „ “ zu. Diese Funktion wird gelöscht.

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

other Weist dieser Instanz von „ QActionEvent “ den Wert „ “ zu. “ zu dieser Instanz von „ “ zu.

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