Hi.<br><br>I am going to explain what I mean...<br><br>My CustomMapCanvasItem subclasses the MapCanvasItem class. <br>The constructor for my objects includes a call to MapCanvasItem(MapCanvas) so as to initialize the parent class instance. <br>
This call in turn executes a QGraphicsItem(0, MapCanvas-&gt;scene()) for the same purpose and consequently adds the newly created item to the scene (which is a private member of the MapCanvas).<br>Then, somehow, Qgis renders the scene using the QGraphicsScene and QgraphicsView methods. <br>
<br>My point here is to say that since I add the Items to the scene, and since I don&#39;t control how Qgis accesses those items after having added them (because QGis uses the QGraphicsScene and View methods for the rendering), I can&#39;t add any synchronization between Qgis thread and mine. <br>
In short: since Qgis thread does not implement any synchronization for the accesses to the QGraphicsItems/Scene/View, it is useless to try and synchronize in my own thread. <br><br>I understand very well what you mean when you say that the graphics scene must not be used concurrently without synchronization, but since Qgis code does not synchronize, I don&#39;t see how I could in my own thread alone...<br>
<br>I hope I have made my point clear enough...<br>Maybe things do not take place at all like I think they do, because apparently you find my question strange and I am not an expert in Qt inner workings...<br><br>Although I know you are probably handling numerous other questions at the same time, If you can find a few moments to look into mine further, I would greatly appreciate it. If it is possible for you, maybe you could give me a quick idea of how you would create a thread designed to move the items and provide synchronization at the same time (explanations or pseudo code would be great).<br>
<br>Thank you again for your help.<br><br>Florian<br><br><div class="gmail_quote">On Thu, Apr 30, 2009 at 12:46 PM, Martin Dobias <span dir="ltr">&lt;<a href="http://wonder.sk">wonder.sk</a>@<a href="http://gmail.com">gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Wed, Apr 29, 2009 at 10:43 PM, Florian El Ahdab &lt;<a href="mailto:felahdab@gmail.com">felahdab@gmail.com</a>&gt; wrote:<br>

&gt;<br>
&gt; I understand very well your remarks about the synchronization. However,<br>
&gt; since I am adding the items to the MapCanvas using the QGis API, and since<br>
&gt; this API doesn&#39;t seem to provide any way to synchronize the access to the<br>
&gt; items, I don&#39;t see how I could have the synchronization properly<br>
&gt; implemented. I can add all the mutexes that I want in my code, the QGis API<br>
&gt; won&#39;t synchronize...<br>
&gt;<br>
&gt; Did I miss something? Is there an implicit synchronization in the Qt API<br>
&gt; regarding the QGraphicScene?<br>
<br>
</div>I don&#39;t understand what do you mean by saying &quot;QGis API won&#39;t<br>
synchronize&quot; as QGIS API has nothing to do with it in this case.<br>
<br>
There is no implicit synchronization. You have to make sure that the<br>
graphics scene is not being used concurrently in more threads.<br>
<font color="#888888"><br>
Martin<br>
</font></blockquote></div><br>