[Interest] QSqlRelationalDelegate combobox is not updated

Alex Malyushytskyy alexmalvtk at gmail.com
Fri Apr 20 02:32:26 CEST 2012


I fixed problem manually calling select on the column relation model

QSqlRelationalTableModel* model =....
model->select();
...........
QSqlTableModel* childModel = model->relationModel ( TAC_street_id );
Q_CHECK_PTR( childModel );
childModel->select();

I am still not sure this is not a bug.
I am surprised QSqlRelationalTableModel select() does not call
select() for every relation model set itself.

Regards,
    Alex



---------- Forwarded message ----------
From: Alex Malyushytskyy <alexmalvtk at gmail.com>
Date: Thu, Apr 19, 2012 at 2:34 PM
Subject: QSqlRelationalDelegate combobox is not updated
To: interest at qt-project.org


I found a problem which looks like a bug when trying to display data
from database in
QTableView using QSqlRelationalDelegate.

Assume I have 2 tables:
-streets
-addresses

Table Addresses has column which contains reference to ID in the streets.
QSqlRelationalTableModel is used for both tables and edit strategy is
set to QSqlTableModel::OnFieldChange.


Initially table is loaded correctly, but then if record is added into
or removed from the streets
the change does not appear when viewing addresses.
In other words if combobox is opened it contains old values, even
though if table streets is displayed, all changes are there.

I verified that select() for addresses is called after appropriate
changes are made in streets at the file (with 3rd party software).
I tried to set different QSqlRelationalDelegate hoping this should
re-create the combobox, but it did not fix the problem
So I am not sure what else could be done.

Any idea is appreciated.
Regards,

Alex



More information about the Interest mailing list