[PyQt] Not sure how to use QSqlRelationalTableModel

Mark Summerfield mark at qtrac.eu
Tue Jul 10 16:22:28 BST 2007


On 2007-07-10, IloChab wrote:
> I'm trying to use  QSqlRelationalTableModel to show records on a table that
> will grow at run-time.
>
> What I get is that it works fine for records that are already present in
> sql tables but it doesn't for new lines that I add at run-time using
> .setData method.
>
> I'll attach to this message the original PyQt example about
> QSqlRelationalTableModel that I modified adding an "addRecord" function
> that shows the wrong behaviour I'm talking about.
>
> So I'd like to know what it the correct way to code that function.
>
> Thanks.
> Ciao.
> Licia

I haven't tried it, but I think that your problem may solved by adding

    model.submitAll()

at the end of your addRecord() method.

-- 
Mark Summerfield, Qtrac Ltd., www.qtrac.eu




More information about the PyQt mailing list