[PyKDE] How to add a Table Validator

Steve Taetzsch staetzsc at yahoo.com
Wed Feb 2 02:44:44 GMT 2005

I'm trying to port a Tkinter application to pyqt. It
has a table that the user can enter dates in one
column and I'd like to add a validator to the entry.
I'd also would like to validate dollar amount entries
in another column. After reading the docs, I'm still
missing something. Below is some code I am trying. If
I uncomment the lines creating an editor, the app
slows way down. There can be a few hundred rows. I'm
also trying to change the background color of
alternate rows which seems to be working.

Something tells me I'm doing this all wrong. I'm new
to  qt, and am trying to decide between qt,gtk and wx
for my new widget library. Any tips would be


dateValidRegExp is a global variable for now.

class myTableItem(QTableItem):
    def __init__(self, table, edittype,
        QTableItem.__init__(self, table, edittype,
        self.row = row
        self.debit_flag = debit_flag
##        self.editor = self.createEditor()
##        dateValidator =
##        dateValidator.setRegExp(dateValidRegExp)
##        self.editor.setValidator(dateValidator)

    def paint(self, painter, colorgroup, rect,
        cg = QColorGroup(colorgroup)
        if self.row % 2:

        QTableItem.paint(self,painter, cg,rect,selected)

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the PyQt mailing list