[PyQt] QTreeWidget and fixed column widths on window resize
Andreas Pakulat
apaku at gmx.de
Thu Jul 31 22:24:10 BST 2008
On 31.07.08 21:37:04, Chris M wrote:
> 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)
This doesn't take into account any headers or scrollbars so it won't
work.
What should work however is setting the last column to a fixed size via
the horizontal headerview. See QTreeView.horizontalHeader() and
QHeaderView.
Andreas
--
Don't worry. Life's too long.
-- Vincent Sardi, Jr.
More information about the PyQt
mailing list