Using multiple Qt (SQL) Models
- by radix07
I have a near real-time application that I am using Qt and an SQLite database to run.
I am curious if it is safe to have two separate models access a database at once. I know 2 separate views can access a model just fine, but I can't find any document addressing this. I also realize that SQLite is thread safe for reading, so I don't see a real issue to doing this from the SQLite part of things...
Basically I want to use a QSqlTableModel to do the real-time read and write in the background and at the same time use a QSqlQueryModel to give the user desired data. Since I may be doing lots of filtering in the background using the table model I can't use it as the main view as well. I have gotten this to work for the most part, but am not sure if this is the best way to do this.
If the models act like multiple SQL queries I don't believe this should be an issue, but I would like to know from someone I bit more knowledgeable about this stuff since this is pretty new to me.
Thanks