[PyQt] QTreeWidget Column Resize

Baz Walter bazwal at ftml.net
Mon Nov 30 19:21:20 GMT 2009


andre hotz wrote:
> I want to get notified when the user changes the size or position of 
> a column so I can store the new size/position and save it in a config file.
> Unfortunatly, there does not seem to be an event or something which 
> informs me about the changes.
> I tried it by declaring a "columnResized" method
> 
> class myTreeWidget_DEF(QtGui.QTreeWidget):
>    def __init__(self, parent=None):
>        QtGui.QTreeWidget.__init__(self, parent)
>          def columnResized(self, a,b,c):
>        print "test"
> 
> but nothing happens.

QTreeView.columnResized isn't virtual, so your reimplemetation won't get 
called by qt.

do you actually need constant updating of the config file? if not, you 
could just save the last sizes/positions when your application closes.


More information about the PyQt mailing list