Humm, bummer. I'm using a customized QSqlQueryModel where there is no select() method. =(
/Tottish
Humm, bummer. I'm using a customized QSqlQueryModel where there is no select() method. =(
/Tottish
Sorry, my answer is wrong.
You're using QSqlQueryModel instead of QSqlTableModel.
In this case you use QSqlQueryModel::setQuery to obtain the same result
A camel can go 14 days without drink,
I can't!!!
Yeah, I know how to set the query except:
"Note that the query must be active and must not be isForwardOnly()."
And I suppose that is why the data can't be displayed when the db-connection goes down.
/Tottish
OK.
With QSqlTableModel the result is the same because QSqlQueryModel::select use setQuery.
As solution you can use a QAbstractTableModel where you store the result af the query
A camel can go 14 days without drink,
I can't!!!
Thank you for replying but I'm not sure I'm following.
I don't think there is a method called QSqlQueryModel::select and if there is I can't find it.
Could you try to explain in more detail how I would go about saving my query in a QAbstractTableModel?
If anyone else have other opinions on how this should best be preformed, all input is welcome.
Thanks!
/Tottish
A camel can go 14 days without drink,
I can't!!!
Ah, I think I see now, but wouldn't such an operation be really expensive if the table has a couple of hundred rows and say 25 columns (as it is in my case)?
How fast would the interaction be with such a table compared to creating a SQLite table and "copy" the retrived query into that?
Anyway, I'll check it out!
Thanks for the tip!
/Tottish
Using "in memory" model (I think) is faster than using a "file-system" model (like SQLITE). You can also create an "in memory" SQLITE database.
Depends from the "size" of the data that you retrieve
A camel can go 14 days without drink,
I can't!!!
Tottish (28th April 2011)
OK mcosta, I'll go with the in memory model then. The data shouldn't be very bulky.
Thanks a lot!
/Tottish
Bookmarks