[PyQt] Bug on SqlRelationalTableModel?

simone simozack at yahoo.it
Wed Jun 25 14:15:26 BST 2008


I'm trying to write a program like the "asset manager" present on the 
Mark Summerfield book (and with "like" I could write "copying the code 
of "). The only thing I change is that every time I double-click on a 
row in the detail view, a dialog opens and the I can modify the values 
in the fields (linked by a mapper to the model below).

When the user clicks on the "ok" buttun, automatically the changes are 
saved in the database, by a mapper.submit() call. But... here's the 
(possible) bug: when I change the master view, the first column of the 
detail doesn't change the value (a foreign key field). Look at this example:

Master view:

-------------------------------
| date  | user | note         |
-------------------------------
| 25/06 | Me   |              |
| 26/06 | Me   |              |
-------------------------------

Detail view (when I click on 25/06):

-----------------
| Work  | Hours |
-----------------
| Some  |     1 |
-----------------

Detail view (when I click on 26/06):

-------------------
| Work    | Hours |
-------------------
| Another |     2 |
-------------------

If I change the "work" on the 26/06 detail row in "Else" I have this result:

Detail view (when is selected the row on 26/06):

-----------------
| Work  | Hours |
-----------------
| Else  |     1 |    -- As expected
-----------------

Detail view (if I change to 25/06):

-----------------
| Work  | Hours |
-----------------
| Else  |     2 |  -- Unexpected
-----------------

In the database the values are different as expected.

The database engine is Sqlite, PyQt 4.3.3, Python 2.5.2 on Windows XP SP3.
What could it be? :)

--
Simone
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



More information about the PyQt mailing list