WTableView QueryModel and update

Added by Maximilian Kleinert almost 5 years ago


I have a WTabWidget with two tabs. One tab has a line edit and a button. When the button is clicked an entry is added to the database. The second tab contains a WTableView with a QueryModel of the database table. On the button action I call reload() on the model, after the transaction was committed. Now the strange thing happens. In order to correctly size the WTableView horizontally and vertically I put it into a nested container with WHBoxLayout and WVBoxlayout and a stretching dummy on both directions. If I do so, the table sizes fine, but does not display the update after a new entry was added and the tab was switched. If I press the alt key the new entry is displayed without anything in the server log (no new POST event or WebRequest), so the browser is not updating but already has the data.

If I do not add the layouts everything works as expected.

Here is an example code.

Best regards


main.cpp (4.04 KB) main.cpp