QChildEvent 类在增加或删除子对象时发送。
Header: | #include <QChildEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Inherits: | <<< QEvent |
- 所有成员的列表,包括继承的成员
- QChildEvent 是 Event 类的一部分。
【详细描述】
添加或删除子事件时,这个事件会立即发送到对象。
在这两种情况下,您都只能依赖子项是 QObject ,或者 QObject::isWidgetType() 返回真 。
这些事件的处理程序是 QObject::childEvent()。
【成员函数】
QChildEvent::QChildEvent(QEvent::Type type, QObject *child)
构造 type 特定的子事件对象。
type 可以是 QEvent::ChildAdded, QEvent::ChildRemoved或 QEvent::ChildPolished.
参见 child().
bool QChildEvent::added() const
事件类型 type() 是获得子对象 QEvent::ChildAdded返回真,否则假。
QObject *QChildEvent::child() const
返回已添加或删除的子对象。
bool QChildEvent::polished() const
事件类型 type() 是子部件被"修改" QEvent::ChildPolished 返回真,否则假。
bool QChildEvent::removed() const
事件类型 () 是移除子对象 QEvent::ChildRemoved返回真,否则假。