A question about QTreeWidget
I am using the SetItemWidget function of QTreeWidget. I new a widget and set it to one QTreeWidgetItem, After call removeItemWidget, If I need to delete widget. what does removeItemWidget do for me.
5 replies
This function make as it says … remove widget from item. So if you did not set a widget in item, nothing have to remove. If you want to remove item from tree, just delete it.
- QTreeWidget treeWidget;
- MyOwnWidget *pCustomWidget = new MyOwnWidget;
- treeWidget.SetItemWidget(pOneItem, 0, pCustomeWidget)
- treeWidget.RemoveItemWidget(pOneItem,0);
- treeWidget.clear()
- //If I need to call those ?????If the clear and RemoveItemWidget function will release the memory automatically.
- delete pCustomWidget;
- delete pOneItem;
If you already call clear [doc.qt.nokia.com], you do not have to delete it. I’m not sure if you call removeItemWidget [doc.qt.nokia.com], your pCustomWidget will be deleted.
You must log in to post a reply. Not a member yet? Register here!


