[Interest] "Loading", recursion and GUI's

William Hallatt goblincoding at gmail.com
Tue Jan 8 09:15:50 CET 2013


I have to update the tree widget with each element visited and as far as
I'm aware, one cannot use widget classes in separate threads (QThread).
You are probably right that I can do that via a signals and slots (thanks
for that, I don't know why I didn't think of it, it's rather obvious), but
won't that "cost" roughly the same?  Each time the recursive function is
called, a signal will be emitted telling the GUI to update so how will it
be different?

Thanks for taking the time out to explain, I appreciate it.

Kind regards,
William






On 7 January 2013 17:51, alexander golks <alex at golks.de> wrote:

> sounds like you're blocking the gui painting.
> i would start a thread for parsing the dom and use some signals/slots to
> signal the gui the current state, like:
>
> signals:
>   void startDomParsing();
>
> slots:
>   void onDomParsingFinished()
>   {
>     delete progress;
>     // or whatever
>   }
>
> or instead of onDomParsingFinished() you could even connect your
> QThread::finished() signal
> to the progress::deleteLater() or alike...
> and some signals from thread to gui slots for updateing your tree widget.
>
> or, call QCoreApplication::processEvents at appropriate places, if you
> don't want to do it the threaded way.
>
> alex
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130108/1e8197cc/attachment.html>


More information about the Interest mailing list