PDA

View Full Version : Editable and cached QSqlQueryModel



evgeniy
29th July 2014, 11:11
Did anybody make editable and cached QSqlQueryModel. I know which way I should go and made something. I use data, setData and other methods in subclassing model. But on every step I get surprises, ex. inserted row become checkable after editing. I know that sources of QsqlTableModel will be useful, but they are too complicated. Has anybody more compact ready solution?
Thanks in advance!

wysota
31st July 2014, 08:57
QSqlQueryModel is by definition read-only. If you want a model that you can modify then either use QSqlTableModel (perhaps with triggers on the dbms side to distribute the data into proper tables) or implement a custom model that fetches data using an sql query and then submits it using a different sql query.