[PyKDE] QSqlEditorFactory.createEditor invocation problem, possibly PyQt bug
Phil Thompson
phil at river-bank.demon.co.uk
Mon Jun 17 23:49:00 BST 2002
Hans-Peter Jansen wrote:
> Hi Phil et al.,
>
> after mangling my code for some hours, I'm suspect a PyQt problem
> in QSqlEditorFactory.
>
> This is the code in qt3/examples/sql/overview/table3/main.h:
>
> class CustomSqlEditorFactory : public QSqlEditorFactory
> {
> Q_OBJECT
> public:
> QWidget *createEditor( QWidget *parent, const QSqlField *field );
> };
>
> and in main.cpp:
>
> QWidget *CustomSqlEditorFactory::createEditor(
> QWidget *parent, const QSqlField *field )
> {
> if ( field->name() == "statusid" ) {
> QWidget *editor = new StatusPicker( parent );
> return editor;
> }
>
> return QSqlEditorFactory::createEditor( parent, field );
> }
>
> My corresponding python version:
>
> class CustomSqlEditorFactory(QSqlEditorFactory):
> def __init__(self):
> print "CustomSqlEditorFactory.__init__"
> QSqlEditorFactory.__init__(self)
>
> def createEditor(self, parent, field):
> print "createEditor:", parent, field
> if str(field.name()) == "statusid":
> return StatusPicker(parent)
> else:
> return QSqlEditorFactory.createEditor(parent, field)
>
> The constuctor gets called, but createEditor doesn't. The PyQt docs
> state, this class is fully implemented, but Boudewijn gave me the
> hint, that it has two methods with the same name and the same number
> of arguments. Could it be the problem here?
Shouldn't be (famous last words), but I'll look into it.
Phil
More information about the PyQt
mailing list