美文网首页
QTreeWidgetItem::removeChild函数

QTreeWidgetItem::removeChild函数

作者: 雯饰太一 | 来源:发表于2023-06-01 07:58 被阅读0次

QTreeWidgetItem::removeChild函数

void QTreeWidgetItem::removeChild(QTreeWidgetItem* child);

Removes the given item indicated by child. The removed item will not be deleted.[移除指定的子孩子,但是这个子孩子并不会被删除]

QTreeWidgetItem *QTreeWidgetItem::takeChild(int index);

Removes the item at index and returns it, otherwise return 0.[移除指定位置的子孩子,并返回该位置的子孩子指针,如果没有就返回空值]

QList<QTreeWidgetItem *> QTreeWidgetItem::takeChildren();

Removes the list of children and returns it, otherwise returns an empty list.[移除所有的子孩子,并将这些子孩子的指针以List的形式返回出去]

通常,QT中有remove,take意思的函数,其具体的表现形式需要查阅一下官方文档的说明,如上几个函数,都不会自动删除子孩子,需要外部调用之后,主动的对这些子孩子的指针进行管理。

相关文章

网友评论

      本文标题:QTreeWidgetItem::removeChild函数

      本文链接:https://www.haomeiwen.com/subject/udvredtx.html