Attached is the code that I'm asking about.  If you run it, then 'Add', then
type something into the first cell, then press tab, it returns to the first
cell.  Then, tab a couple more times, and 'Add' another row.  Then you can
type something into the first cell, and press tab, and it jumps to where you
left off in the first row.

Thanks for your help!
Kerri

On 5/12/08, David Boddie <[EMAIL PROTECTED]> wrote:
>
> On Wed, 7 May 2008 09:06:22 -0600, Kerri Reno wrote:
>
> > I have a small table widget where each cell contains a widget.  I start
> > with two rows of the table filled with data.  If I add a new third row
> to
> > the table, and then start in the first cell to change that line, when I
> > press tab it goes to the second cell in the first row.  Has anyone seen
> and
> > conquered this issue?  If no one has seen it, I can send example code
> that
> > will highlight the problem.
>
>
> Does the problem occur only if you add the third row?
>
> I think you might need to post some sample code that demonstrates the
> problem. :-)
>
> David
>
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Yuma Educational Computer Consortium
Compass Development Team
Kerri Reno
[EMAIL PROTECTED]      (928) 502-4240
.·:*¨¨*:·.   .·:*¨¨*:·.   .·:*¨¨*:·.
#!/usr/bin/env python
# vim:set ts=4:set ff=unix

import sys
from PyQt4.Qt import *

class calTypeTable(QTableWidget):

	def __init__(self,parent):
		QTableWidget.__init__(self,parent)
		self.setColumnCount(9)

		labels = ['Name','Description','Start','Stop',
				'FTE','# of Mths','First PP','Last PP','']
		self.setHorizontalHeaderLabels(labels)

		vheader = self.verticalHeader()
		vheader.hide()

	def addRow(self):
		r = self.rowCount()
		self.insertRow(r)

		# put name and description in a lineEdit
		name = QLineEdit(self)
		self.setCellWidget(r,0,name)
		name.setFocus(Qt.OtherFocusReason)
		desc = QLineEdit(self)
		self.setCellWidget(r,1,desc)

		start = QDateEdit(self)
		self.setCellWidget(r,2,start)

		stop = QDateEdit(self)
		self.setCellWidget(r,3,stop)

		# put default fte in
		dfte = QDoubleSpinBox(self)
		dfte.setDecimals(4)
		dfte.setSingleStep(.0005)
		dfte.setMaximum(1.2)
		self.setCellWidget(r,4,dfte)

		# add number of months combo box
		nom = QComboBox(self)
		nom.addItems(['0.0','9.0','10.0','10.5','11.0','12.0'])
		self.setCellWidget(r,5,nom)

		# add first and last pay period spin boxes
		fpp = QSpinBox(self)
		fpp.setMaximum(27)
		self.setCellWidget(r,6,fpp)
		lpp = QSpinBox(self)
		lpp.setMaximum(27)
		self.setCellWidget(r,7,lpp)

		self.setCellWidget(r,8,QCheckBox())
		
class calTypeDlg(QDialog):

	def __init__(self,parent=None):
		QDialog.__init__(self,parent)
		self.setModal(True)

		self.setWindowTitle('Calendar Types')
		self.resize(QSize(QRect(0,0,700,200).size()).expandedTo(self.minimumSizeHint()))

		layout = QVBoxLayout(self)

		self.tbl = calTypeTable(self)
		layout.addWidget(self.tbl)

		buttonBox = QDialogButtonBox(
			QDialogButtonBox.Save)
		
		addButton = QPushButton(self)
		addButton.setText('&Add')
		buttonBox.addButton(addButton,QDialogButtonBox.ActionRole)

		self.connect(addButton,
			SIGNAL('clicked()'),
			self.addType)


		layout.addWidget(buttonBox)

		self.connect(buttonBox,
				SIGNAL('accepted()'),
				self.accept)

		self.connect(buttonBox,
				SIGNAL('rejected()'),
				self.reject)

		self.show()

	def addType(self):
		self.tbl.addRow()

if __name__ == '__main__':
	app = QApplication(sys.argv)
	form = calTypeDlg()
	app.exec_()
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to