PyQt QTableItem inheritance...

Mike Meyer mwm at
Tue Apr 1 19:31:45 CEST 2003

I've already tried posting this to the pyKDE mail list, and gotten no

I'm trying to create an item in a QTable that uses the
QDoubleValidator on the input edit field. The only way I can see to do
this is subclass QTableItem, and override createEditor with a method
that sets the validator, like so:

class Float_Field(QTableItem):

    def __init__(self, table, data):
        print "Creating float field."
        QTableItem.__init__(self, table, QTableItem.OnTyping, str(data))

    def createEditor(self):
        print "createEditor"
        editor = QLineEdit(self.text(), self.table().viewport())
        self.connect(editor, SIGNAL("textChanged(QString &)"),
                     self.table(), SLOT("doValueChanged"))
        return editor

While I get the output from __init__, I never see the output from
createEditor. Any help would be appreciated.


Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list