[PyQt] Table Cell Span
Eric Weick
eweick at yumaed.org
Wed May 5 18:28:58 BST 2010
I have come across an issue that I am unable to resolve with regards to cell
spanning on a table.
The issue... The cells span correctly, but there is a 'ghost' image left in
the first cell as can be seen in the attached image.
I have tried reversing the last 2 lines of the code below... tbl.setSpan and
then tbl.setItem, but this did not help.
I appreciate any help on this.
-Eric
I am using PyQt 4.4 and Qt4.5
I created a form with a table on it with qtDesigner and then the following
code ...
from PyQt4 import QtGui,QtCore
class subtracker_log(QtGui.QMainWindow):
def __init__(self, conn, parent = None):
#Load QT form created using designer
QtGui.QWidget.__init__(self)
self.ui = Ui_trackerLog() #Name of the class created by pyQt
from the qtDesigner (name of the form object: ex Ui_MainForm)
self.ui.setupUi(self) #Name of the function in class
that sets up the ui
self.testTable()
def testTable(self):
tbl = self.ui.tblTrackerLog
tbl.clear()
tbl.setRowCount(5)
hdrItems=['Per 0', 'Per 1', 'Per 2', 'Per 3', 'Per 4', 'Per 5',
'Per 6']
tbl.setColumnCount(len(hdrItems))
for i in range(len(hdrItems)):
headerItem = QtGui.QTableWidgetItem()
headerItem.setText(hdrItems[i])
tbl.setHorizontalHeaderItem(i,headerItem)
cell = QtGui.QTableWidgetItem()
cell.setText('2,2')
cell.setTextAlignment(QtCore.Qt.AlignCenter)
tbl.setItem(2, 1, cell)
tbl.setSpan(2, 1, 0, 4)
--
Eric Weick
Kofa High School
Teacher/Programmer
928.502.5585
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100505/5283b205/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CellSpan.png
Type: image/png
Size: 11665 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100505/5283b205/attachment.png>
More information about the PyQt
mailing list