Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPainterPath multi-thread access
Forum Updated to NodeBB v4.3 + New Features

QPainterPath multi-thread access

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    k06aaa
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

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

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        miroslav
        wrote on last edited by
        #3

        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.

        Mirko Boehm | mirko@kde.org | KDE e.V.
        FSFE Fellow
        Qt Certified Specialist

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved