[PyKDE] Totally stuck on QTableWidget conversion

David Boddie david at boddie.org.uk
Tue Oct 3 23:25:20 BST 2006

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.html
> 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.


More information about the PyQt mailing list