QTreeView and QStandardItem row height

2,342 views
Skip to first unread message

Robert Kolbeins

unread,
Jan 29, 2014, 7:39:02 PM1/29/14
to python_in...@googlegroups.com
Hello,

This relates to Justin's pyqt for maya tutorial and the custom outliner.   I can't way a way to control spacing between the rows, the text gets difficult to read when so closely stacked up.  Any thoughts ?

Thanks,
Robert

Justin Israel

unread,
Jan 30, 2014, 4:21:19 AM1/30/14
to python_in...@googlegroups.com

Hey Robert,

When using a QTreeView, you have to control the row height by setting a custom QItemDelegate on the view:
http://qt-project.org/doc/qt-4.8/qabstractitemview.html#setItemDelegate

This QItemDelegate can have a custom sizeHint which let's you choose how big it should be given a current state. But you could just return a constant size
http://qt-project.org/doc/qt-4.8/qabstractitemdelegate.html#sizeHint

Its a little more obscure with model/view than with the convenience widgets like QTreeWidget. With that widget, you control the size via QTreeWidgetItems

Let me know if you need more specific examples (answering via mobile now)

- justin

--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/df44f683-63e5-459d-adfd-7da453ddaf2e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages