[PyKDE] Totally stuck on QTableWidget conversion

Dave S eric3 at pusspaws.net
Sat Oct 7 12:34:56 BST 2006


On Tuesday 03 October 2006 23:25, David Boddie wrote:
> On Tue Oct 3 21:35:03 MEST 2006, Dave S wrote:
> > (1)  I used to use self.tableitem.setSpan(2,2) to join 2 X rows together
> > in QT3 I then wrote text in a large font with a different coloured
> > background to differentiate different sections of my QTable.
> >
> > Googling I found
> >
> > http://lists.trolltech.com/qt4-preview-feedback/2006-09/thread00172-0.htm
> >l
> >
> > So setSpan() still exists in QT4 but apparently not in PyQt() ? I have
> > read & re-read the docs (got headache - got asprin!)  Is there an
> > alternative ?
>
> It's in Qt 4.2. There may be a workaround, depending on what you need.
> You'll have to explain what you want to display, but it may not be possible
> to make it look the same as in Qt 3.
>
> > (2) I used to use self.table1.setColumnStretchable(0, 1) to fill my
> > QTable no matter what size. I Have googled and found a reference or two
> > but no-one seems to know how to replace it.
> >
> > At the moment I am thinking about a bodge of ... signal: re-size
> > QTableWidget -> slot: get QTableWidget size -> calculate and re-size
> > columns but there has to be a better way -  any suggestions ?
>
> Take a look at either the stretchLastSection property or setResizeMode()
> method in QHeaderView. You can obtain the table's headers with the
> horizontalHeader() and verticalHeader() methods.

I finally got this part working :)

self.tableWidget.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)

Thanks 

Dave


>
> David
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list