I am trying to create a Qt shelf tool for Houdini. This requires a QtreeWidget with 2 columns, the first showing just some text and the second containing a dropdown menu. Below is an image illustrating this:
The result above is what I am aiming at, and is exactly what I get when I execute my code in an standalone python shell or inside other DCC apps. Whenever I try to execute this code inside Houdini though (e.g. in a hython shell, from a shelf tool, from the python source window), Houdini crashes with the following messages:
Fatal error: Segmentation fault (sent by pid 0) Crash log saved to /tmp/houdini_temp/crash.untitled.sgatto_31294_log.txt Warning: Missing charsets in String to FontSet conversion
Below the code I am executing:
from PySide2 import QtCore, QtWidgets class MyWidget(QtWidgets.QMainWindow): def __init__(self, parent=None, controller=None): super(MyWidget, self).__init__(parent) tree = QtWidgets.QTreeWidget() tree.setColumnCount(2) tree.headerItem().setText(0, "Column 1") tree.headerItem().setText(1, "Column 2") cell = QtWidgets.QComboBox() cell.addItems(['a','b','c']) item = QtWidgets.QTreeWidgetItem(tree) tree.setItemWidget(item, 1, cell) self.setCentralWidget(tree) win = MyWidget() win.show()
Commenting
tree.setItemWidget(item, 1, cell)
Does anybody have any idea of why this is happening? Is this a bug?
Any suggestions on alternative ways to make this work would be greatly appreciated.
P.S. I already tried passing hou.qt.mainWindow() and hou.ui.mainQtWindow() as parent to MyWidget, and neither made any difference.
Thanks!
