[Interest] QIcons and multithreading
alan.ezust at gmail.com
Thu Apr 4 18:45:46 CEST 2013
The reason, simply, is that the graphics memory and the objects that reside
in it are not thread-safe, and to make them thread-safe would cause a great
performance impact, so Qt doesn't try.
You can read more about this in the documentation, but in general, we use
QImage instead of QIcon in other threads, and we avoid creating or
accessing any QWidget from other threads, and instead communicate via
signals and slots to those objects from other threads. More is written
about it in the documentation:
You can also read more about it in my chapter on "thread safety and
http://www.ics.com/designpatterns - login or register first then go to:
On Thu, Apr 4, 2013 at 6:06 AM, Sensei <senseiwa at gmail.com> wrote:
> On 4/3/13 4:14 PM, Alan Ezust wrote:
> no. You can't create widgets or QPixmap in other threads.
>> The warning is "QPixmap: It is not safe to use pixmaps outside the GUI
>> Also, besides QIcons, am I heading for disaster in creating widgets
>> as I
>> am doing in a separate threads?
> Might I ask why is this?
> I don't start un-parented threads, my threads are always parent of my main
> window... not that this could somehow ameliorate the fact that I need
> refactoring. :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest