[Interest] QSqlQueryModel refresh

Bo Thorsen bo at fioniasoftware.dk
Sat Mar 3 18:42:43 CET 2012


No, the setQuery will do the refresh for you.

Bo.

Den 03-03-2012 16:30, Jason H skrev:
> The problem with this, is I need a whole other model to assign it to
> because some engineer put an:
> if (model == newModel) return;
> construct in the code.
>
> I really should be able to have the model inform the views that the cell
> has changed and have them retrieve the data using DisplayRole and a
> modelIndex...
>
> I see this question asked a lot and there is no answer on any of the
> threads.
>
> I might somehow be able to use a delegate, but I need a widget for that,
> and from a model perspective I don't have one.
>
>
> ------------------------------------------------------------------------
> *From:* Thales Lange <thaleslange at gmail.com>
> *To:* interest at qt-project.org; scorp1us at yahoo.com
> *Sent:* Friday, March 2, 2012 6:31 PM
> *Subject:* Re: [Interest] QSqlQueryModel refresh
>
> Jason,
>
> I don't realize another way to update the QSqlQueryModel after you
> change the Table data. You will have to call "setQuery(...)" again.
>
> If you are facing performance problems, you can try to limit your query
> ("SELECT ... LIMIT 100").
>
> Eventually, if you have a complex SQL statement, you can create a
> Temporary Table to handle these data, so you can use a simple SQL
> statement. Or, you can try to optimize your SQL statement.
>
> In my brief experience, I didn't have performance problem with refresh.
>
> Best Regards,
> Thales Lange.
>
> On 02-03-2012 19:13, Jason H wrote:
>  > How after I have reimplmented setData() to make my model writable, do I
>  > refresh my view? I could drop the whole model and reload it, but that is
>  > expensive.
>  >
>  >
>  >
>  >
>  >
>  > _______________________________________________
>  > Interest mailing list
>  > Interest at qt-project.org <mailto:Interest at qt-project.org>
>  > http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Interest mailing list