[Qt-interest] Showing a "Please wait" dialog during sql query
Justin Noel
justin at ics.com
Mon Jun 7 19:39:51 CEST 2010
On 06/07/2010 01:31 PM, Gillen Daniel wrote:
> Hi @all
>
> I have a massive problem here and don't seem to find a solution for it.
>
> I'm developping a database application based on a MySQL database and I
> would need to display a "Please wait" dialog while
> populating a QSqlQueryModel. The data from QSqlQueryModel gets displayed
> in a widget in my main window, so I have to exec the query in my main
> thread. The problem is that any dialog I open before querying the data
> hangs as my query blocks the main thread.
>
> Does anyone has an idea on how I could solve this? I would need some
> sort of 2nd thread which displays the dialog with his own event loop but
> as far as I understand, Qt does not support GUI interaction in a second
> thread. Or is it perhaps possible to exec the query in a second thread
> and then move the whole QSqlQueryModel and database connection to my
> main thread?
>
You may find this article on Threading Qt Database Access useful:
http://www.linuxjournal.com/article/9602
--Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: justin.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100607/d8f9f2e3/attachment.vcf
More information about the Qt-interest-old
mailing list