[PyKDE] New QTableWidget queries :)

Dave S eric3 at pusspaws.net
Sat Oct 7 23:14:52 BST 2006


On Saturday 07 October 2006 14:31, Andreas Pakulat wrote:
> On 07.10.06 12:48:05, Dave S wrote:
> > I think these are my last set of QTableWidget problems ...
> >
> >
> >
> > (1) In a QTableWidget I do not want the LHS row count displayed.  I am
> > trying to ...
> >
> > self.tableWidget.setSectionHidden(0, True)
> >
> > but do not understand what value to set logicalindex to ?
>
> That's not a section, but the vertical header, so just to
> tablewidget.verticalHeader().hide()

Tried it - it works :)


>
> > (2) My QTableWidget top headers have centered text, I need them to be
> > left aligned
> >
> > self.tableWidget.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stret
> >ch) ... fills the full width
> > self.tableWidget.horizontalHeader().setDefaultAlignment(QtGui.QAlignment.
> >AlignLeft)
> >
> > and I get an error ...
> > 'Module has no attribute QAlignment'
>
> Because AlignLeft is a Member of Qt, which is part of QtCore (IIRC). So
> you want
>
> setDefaultAlignment(QtCore.Qt.AlignLeft)
>

Tried it - it works :)

> > (3) This appears to be a tuffy; My QTableWidget has two columns at
> > certain rows I would like to span the two columns to make a single long
> > row. The old setSpan() used to do this. Any idea how I can get a similar
> > effect ?
>
> This is only available in Qt4.2 and I'm not sure it'll work with
> QTableWidget. The methods columnSpan/rowSpan are part of the QTableView
> API and not all of those method work properly when used with a
> QTableWidget.
>

I saw a post from Phil about his intention to implement the new methods in 
Qt4.2 at some point in the future. So hopefully this will end up in a windows 
binary and I will be able to use span. 

In the mean time I have improvised with my GUI QtableWidget layout - its OK 
for now and I will keep an eye out for Qt4.2

Thanks for all your help - it is appreciated. I am getting more fluent with 
Qt4 and the conversion is getting easier ...

Thanks once again

Dave







> Andreas




More information about the PyQt mailing list