Nominate our 2022 Qt Champions!

QPainterPath multi-thread access

  • I'd like to use two threads:

    1. GUI thread uses const-only methods of QPainterPath object
    2. Second thread adds tens of thousands points to this objects

    My GUI thread sometimes crushes while calling x.elementAt(i) or
    x.elementCount() or while i'll trying to make deep-copy...

    If I use QMutex while accessing to object - all work nice, but slow ...

    I'd like not to deep-copy object. Is it possible?

  • You can only touch GUI items from the main thread, mutex or no.

  • const methods can be called in a const context. They do not protect you from changes done from another thread while they are executed. So this approach will not work.

Log in to reply