[PyQt] Using a protected slot (columnResized)

Andreas Pakulat apaku at gmx.de
Wed Dec 26 11:04:39 GMT 2007


On 25.12.07 13:19:10, Noam Raphael wrote:
> 2007/12/25, Phil Thompson <phil at riverbankcomputing.co.uk>:
> > On Tuesday 25 December 2007, Noam Raphael wrote:
> > > Hello,
> > >
> > > I want to know when the width of columns in a table has changed. So I
> > > wrote something like this:
> > >
> > > class TableView(QtGui.QTableView):
> > >     def columnResized(self, column, oldWidth, newWidth):
> > >         print 'columnResized(%r,%r,%r)' % (column,oldWidth,newWidth)
> > >         QtGui.QTableView.columnResized(self, column, oldWidth, newWidth)
> > >
> > > I then used my TableView instead of QtGui.QTableView. However, the
> > > method isn't called when a column is resized. Did I do something
> > > wrong? Should it be done in another way?
> >
> > It isn't virtual so reimplementing it has no effect.
> >
> So there's no way I can know when a table column was resized?

Sure there is: Listen for the sectionResized signal of the header view.

Andreas

-- 
Your object is to save the world, while still leading a pleasant life.


More information about the PyQt mailing list