[Interest] Synchronous painting on QGraphicsScene

Patrick Stinson patrickkidd at gmail.com
Sat Oct 7 19:27:50 CEST 2017


Hmm. Actually, I think that the elastic node example is implemented in the same way as my app. Because of the delayed response of the “elasticity” in the algorithm it is not possible to demonstrate a solution to my problem even if it solved it.

Like the elastic node example, I am implementing QGraphicsItem::itemChange for the node listening for QGraphicsItem::ItemPositionHasChanged, and then updating the edges’s geometry just after calling ::prepareGeometryChange. This queues an update for the next paint buffer, which is what causes my problem.

What I am wondering is if it is possible to implement painting in a synchronous way, where all paint events which result from a single mouse event are done in the same buffer frame.

Make sense?

> On Oct 7, 2017, at 1:01 AM, Christian Gagneraud <chgans at gmail.com> wrote:
> 
> On 7 October 2017 at 16:08, Patrick Stinson <patrickkidd at gmail.com> wrote:
>> Hi there!
>> 
>> I have a graph-ish diagram app where dragging some objects (like nodes) necessitates dragging other objects (like connecting edges). However, if I update an edge from the mouse event or ItemChanged(position) event then the edge isn’t painted until the next paint event. At times, this is quite obvious for example when nudging a node with an arrow key and the node is going in one direction and edge goes in the other direction for one frame because it is one buffer behind.
>> 
>> Any thoughts on synchronous painting?
> 
> Have you check the "Elastic node"  example? It does exactly what
> you're describing. And last time i tried it, it worked very well, no
> painting artifact.
> How is your "update"  done exactly?
> 
> Chris
> 
>> 
>> Thank you
>> -Patrick
>> _______________________________________________
>> 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/20171007/b6802347/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1403 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171007/b6802347/attachment.bin>


More information about the Interest mailing list