[PyKDE] large tables problem

Jim Bublitz jbublitz at nwinternet.com
Sat Jul 10 09:12:00 BST 2004


On Thursday 24 June 2004 00:54, Vicent Mas wrote:

Just to revist this thread one more time, it turns out I'm in the middle of 
developing an app that uses QTable a lot (although not with large datasets). 
The easiest way to grab keyboard input (as was discussed) is in 
QTable.keyPressEvent. Just do something like:

class XXXTable (QTable):
	def __init__ (self, ...):
		QTable.__init__ (self, ...)

	def keyPressEvent (self, e):
		if e.key () == Key_XXX:
			<construct a switch for the keys you want to intercept>

		else:
			e.ignore ()

		# finally, pass any unhandled keys to QTable
		QTable.keyPressEvent (self, e)


I found it handy to subclass QTableItem a lot too - for displaying debit 
amounts in parens as (100.00) and also in red, for providing an little button 
plus edit or label widget as a cell editor and to popup value selection 
dialogs, and other things.

When I get some time, I hope to post some sample code to the Wiki, since 
questions about coloring cells in QTable, formatting, etc. come up on the 
list from time to time.

Jim




More information about the PyQt mailing list