Results 1 to 3 of 3

Thread: Thread-safety of QGraphicsView::items.

  1. #1
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Thread-safety of QGraphicsView::items.

    Hi all!

    I can't find this information anywhere else, so I'll just ask this small question here: is QGraphicsView::items thread-safe?

    If it isn't, which I fear, is a wrapper around it with a QMutex to prevent simultaneous access enough, or is ALL use of QGraphicsView forbidden in concurrent threads?

    Thanks in advance for your time!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Thread-safety of QGraphicsView::items.

    You cannot access any widget from a non-gui thread. You cannot access any QObject from more than one thread. There is no way to work around this with mutexes. Use signals and slots or events for synchronization.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    Nicuvëo (22nd February 2011)

  4. #3
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Thread-safety of QGraphicsView::items.

    Ok, thanks for the quick answer!

Similar Threads

  1. QGraphicsView + steady Items
    By medved6 in forum Qt Programming
    Replies: 2
    Last Post: 25th August 2010, 19:20
  2. QWidget and thread safety
    By spraff in forum Qt Programming
    Replies: 3
    Last Post: 22nd January 2009, 01:11
  3. QPointer and thread safety
    By Nb2Qt in forum Qt Programming
    Replies: 1
    Last Post: 22nd August 2008, 09:22
  4. QTableWidget Design & Thread Safety Question
    By bpetty in forum Qt Programming
    Replies: 4
    Last Post: 28th March 2008, 00:09
  5. QFile and thread-safety
    By Raistlin in forum Qt Programming
    Replies: 2
    Last Post: 31st January 2008, 15:42

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.