[PyKDE] New QTableWidget queries :)

Andreas Pakulat apaku at gmx.de
Sat Oct 7 14:31:59 BST 2006


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()

> (2) My QTableWidget top headers have centered text, I need them to be left 
> aligned
> 
> self.tableWidget.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch) 
> ... 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)

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

Andreas

-- 
Do not sleep in a eucalyptus tree tonight.




More information about the PyQt mailing list