hi, 

I'm trying to add an icon to a QTreeWidget, and maya doesn't seem to like the 
way I do it.. I've got two versions below, the first one is working fine(ish), 
the second makes maya crash, and I'd like to understand why !

from PySide.QtGui import *
# working version
tree = QTreeWidget()
tree.show()
tree.setColumnCount(2)
itm = QTreeWidgetItem(tree, ['item1'])
# widget creation
w = QWidget()
lyt = QHBoxLayout(w)
lbl = QLabel('---')
lyt.addWidget(lbl)
itm.setSizeHint(1, w.sizeHint())
tree.setItemWidget(itm, 1, w)
    
# OPTION B
class QNode(QTreeWidgetItem):
    def __init__(self, parent, name_list):
        super(QNode, self).__init__(parent, name_list)
    def attach_icon(self):
        # widget creation
        icons_widget = QWidget()
        lyt = QHBoxLayout(icons_widget)
        start_lbl = QLabel('---')
        lyt.addWidget(start_lbl)
        self.setSizeHint(1, icons_widget.sizeHint())
        self.treeWidget().setItemWidget(self, 1, icons_widget)
tree = QTreeWidget()
tree.show()
tree.setColumnCount(2)
itm = QNode(tree, ['item1'])
itm.attach_icon()

I'm running out of ideas, so any suggestion or hint you have is more than 
welcome =]
Thank you !

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/04057bec-6ec8-413c-8c67-bb0dbbed7dac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to