Not sure if there is a 'cleaner' solution but overriding the event is
fairly simple, for example;
class MyTreeWidget(QTreeWidget):
def __init__(self, parent = None):
super(MyTreeWidget, self).__init__(parent)
def resizeEvent(self, event):
width = event.size().width()
self.setColumnWidth(1, 100)
self.setColumnWidth(2, width - 100)
Also means you can make your common customizations within the __init__
method to keep your main code cleaner.
2008/7/31 Tyler Distad <[EMAIL PROTECTED]>:
> I am attempting to create a QTreeWidget containing two columns. The
> rightmost column is to remain at a fixed width, no matter how large
> the window itself grows. The leftmost column is to grow in the normal
> manner. (Picture the playlist columns in your favorite music player,
> and you probably have exactly what I'm attempting.)
>
> However, I am completely unable to restrict the growth of the
> right-hand component. The only suggestion I can find online deals with
> overloading resizeEvent(), which seems ludicrously complicated for
> something like this. Is there any sort of a clean solution?
>
> Tyler Distad
> _______________________________________________
> PyQt mailing list [email protected]
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt