首页| 论坛| 消息

回复: Qt子控件析构的时候,父控件会自动把它从子控件列表中删除吗?
#6 回 stlcours 的帖子 [ustone 06-08 17:27]
stlcours:不是你说的:当业务类析构的时候。。。而且这个业务类拥有btn (2018-06-08 17:03) 
没说清楚,btn是业务类的成员对象,btn的parent为主窗体。
#7 [ustone 06-27 19:31]
看到了:
Construction/Destruction Order of QObjects
When QObjects are created on the heap (i.e., created with new), a tree can be constructed from them in any order, and later, the objects in the tree can be destroyed in any order. When any QObject in the tree is deleted, if the object has a parent, the destructor automatically removes the object from its parent. If the object has children, the destructor automatically deletes each child. No QObject is deleted twice, regardless of the order of destruction.
When QObjects are created on the stack, the same behavior applies.

<< 1 2 >> (2/2)

回复 发表
主题 版块