QChildEvent Class
The QChildEvent class contains event parameters for child object events. More…
| Header | #include <QChildEvent> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
| Inherits | QEvent |
List of all members, including inherited members
Public Functions
| QChildEvent(Type type, QObject *child) | |
| ~QChildEvent() | |
| QObject * | child() const |
| bool | added() const |
| bool | polished() const |
| bool | removed() const |
Reimplemented Public Functions
| QChildEvent * | clone() const |
Detailed Description
An object receives a ChildAdded event when it becomes the parent of another object, and a ChildRemoved event when a child is removed or destroyed. QObject::event() passes both to QObject::childEvent().
void Tracker::childEvent(QChildEvent *event) {
if (event->added())
qDebug() << "new child" << event->child();
}
See also QObject::childEvent() and QObject::setParent().
Differences from Qt
ChildPolished is defined, but Nt never sends it.
Member Function Documentation
QChildEvent::QChildEvent(Type type, QObject *child)
Constructs a child event of the given type (ChildAdded, ChildPolished or ChildRemoved) for child.
QChildEvent::~QChildEvent()
Destroys the child event.
bool QChildEvent::added() const
Returns true if the event is ChildAdded; otherwise returns false.
QObject * QChildEvent::child() const
Returns the child object that was added or removed.
QChildEvent * QChildEvent::clone() const
Reimplements QEvent::clone().
bool QChildEvent::polished() const
Returns true if the event is ChildPolished; otherwise returns false.
bool QChildEvent::removed() const
Returns true if the event is ChildRemoved; otherwise returns false.