Sur cette page

QChildEvent Class

La classe QChildEvent contient des paramètres d'événements pour les événements d'objets enfants. Plus d'informations...

En-tête : #include <QChildEvent>
CMake : find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake : QT += core
Héritages : QEvent

Fonctions publiques

QChildEvent(QEvent::Type type, QObject *child)
bool added() const
QObject *child() const
bool polished() const
bool removed() const

Description détaillée

Les événements enfants sont envoyés immédiatement aux objets lorsque des enfants sont ajoutés ou supprimés.

Dans les deux cas, vous ne pouvez compter que sur le fait que l'enfant soit un QObject (ou, si QObject::isWidgetType() renvoie true, un QWidget). En effet, dans le cas QEvent::ChildAdded, l'enfant n'est pas encore entièrement construit ; dans le cas QEvent::ChildRemoved, il a peut-être déjà été détruit.

Le gestionnaire de ces événements est QObject::childEvent().

Documentation des fonctions membres

QChildEvent::QChildEvent(QEvent::Type type, QObject *child)

Construit un objet événement enfant d'un type particulier pour le child.

type peut être QEvent::ChildAdded, QEvent::ChildRemoved, ou QEvent::ChildPolished.

Voir aussi child().

bool QChildEvent::added() const

Renvoie true si type() est QEvent::ChildAdded; sinon renvoie false.

QObject *QChildEvent::child() const

Renvoie l'objet enfant qui a été ajouté ou supprimé.

bool QChildEvent::polished() const

Renvoie true si type() est QEvent::ChildPolished; sinon renvoie false.

bool QChildEvent::removed() const

Renvoie true si type() est QEvent::ChildRemoved; sinon renvoie false.

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