Results 1 to 4 of 4

Thread: QGraphicsItem setPos

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default QGraphicsItem setPos

    Hey guys,

    I'm coding a light QGraphicsScene based file browser.

    I have 10 000 QGraphicsItem inside my QGraphicsScene.

    I'm doing a setPos on the 10 000 items at once.
    This is quite slow.

    What's the fastest way to apply a setPos to 10 000 items ?

    Can I disable the scene's update to perform it faster or something ?

    Thanks.

  2. #2
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsItem setPos

    Do all setPos before put scene into view....

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsItem setPos

    You can use QGraphicsView::NoViewportUpdate on your view before setting the positions and then change back.

  4. The following user says thank you to Lykurg for this useful post:

    bunjee (5th October 2009)

  5. #4
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsItem setPos

    What is the difference with QWidget::setUpdatesEnabled ?

Similar Threads

  1. Replies: 2
    Last Post: 25th March 2011, 09:18
  2. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  3. QGraphicsItem setpos()
    By qtuser20 in forum Qt Programming
    Replies: 6
    Last Post: 3rd August 2009, 17:17
  4. QGraphicsItem pos() and setpos()
    By jimc1200 in forum Qt Programming
    Replies: 6
    Last Post: 16th March 2009, 18:51
  5. Replies: 1
    Last Post: 25th February 2009, 00:34

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.