[Qt-interest] QGraphicsSvgItems automatically start a new thread?

Guido Seifert Wargand at gmx.de
Wed Nov 10 10:06:25 CET 2010


Hi,
lately I had a strange problem. I use several QGraphicSvgItems and for some
reason whenever my widget loses focus I got a warning. Something like 'Cannot send events to objects owned by a different thread'. For some time I was not able to understand what this meant. Simply because I did not send any events. Ok, not directly via sendEvent, of course there are events like showEvents. focusEvents, and such involved. But this is nothing I can influence directly. 

What puzzled me even more was that my program is not multi-threaded. No QThread or related classes. It took me some time a discover that all
QGraphicSvgItems I created normally with 'new' where located in a different
thread. 

The only way I found the get rid of this message was:
'graphicItem->moveToThread(thread())'.

I cannot say that this solution is very satisfying. I am not sure what side effects might lurk behind this hack. 

Anyone an idea what I might do wrong? Some method to prevent threading in the first place?

Regards,
Guido

  
-- 
GRATIS! Movie-FLAT mit über 300 Videos. 
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome



More information about the Qt-interest-old mailing list