Delete QTreeWidgetItem in PyQt?

后端 未结 2 712
灰色年华
灰色年华 2021-02-05 17:06

I\'m finding it frustratingly hard to find a simple way to delete my selected QTreeWidgetItem.

My patchwork method involves setting the tree\'s current sele

2条回答
  •  Happy的楠姐
    2021-02-05 18:05

    PyQt4 uses sip to generate the python bindings for Qt classes, so you can delete the C++ object explicitly through the sip python API:

    import sip
    ...
    sip.delete(current)
    

    The binding generator for PySide, shiboken, has a similar module.

提交回复
热议问题