[Qt-interest] QGraphicsView QThread

Fred Duarte fred.duarte at openbossa.org
Tue Mar 31 16:43:51 CEST 2009


Tnx, Bas.

I'll give a closer look at your solution, trying to find the crash point.

Any news, i'll mail to the list.

On Tue, Mar 31, 2009 at 9:48 AM, Bas Terwijn <B.Terwijn at uva.nl> wrote:

>
> hi all,
>
> Fred Duarte wrote:
>
> I have not tried this approach(Graphics update with QThreads), but seems a
> cool solution. Do you have this code published anywhere?
>
> In the small attachment you find two project:
>
> GraphicsSceneTimer, which uses QTimer and works fine
> GraphicsSceneThread, which uses QThread and sometimes fails to update and
> crashes regularly
>
> And for the problem you're having, it may require a more detailed
> thread safety mechanism. Not just a mutex in the update() method.
>
>  This approach worked when using a simple QWidget to draw to. I am open to
> suggestions. I already tried many things without success.
>
> kind regards,
> Bas Terwijn
>
> --
> Frederico Duarte
>
> On Mon, Mar 30, 2009 at 12:03 PM, Bas Terwijn <B.Terwijn at uva.nl> wrote:
>
>>
>> hi all,
>>
>> I am trying for some time to use QGraphicsView in a multi-threaded
>> application where in the main thread I create an QGraphicsView object
>> and run the event loop while in a seperate QThread I create and and
>> change many QGraphicsItems that are to be visualized in the main thread.
>> For thread safety I use a mutex to synchronize the (overloaded)
>> QGraphicsView::update() method and all changes to the QGraphicsItems.
>>
>> My approach doesn't work. I find that the QGraphicsView doesn't update,
>> even when I send signals which I think should start the
>> QGraphicsView::updateScene() from the main thread. I also experience
>> core dumps.
>>
>> Did anybody find a way to use QGraphicsView to visualize QGraphicsItems
>> that are changed by a seperate QThread?
>>
>> Thank you for your time,
>> Bas Terwijn
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
>


-- 
Frederico Simas Duarte
MLS (Mobile Linux Software)
INDT (Instituto Nokia de Tecnologia)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090331/32c7daaa/attachment.html 


More information about the Qt-interest-old mailing list