Results 1 to 2 of 2

Thread: timerEvent for each QGraphicsItem

  1. #1
    Join Date
    Jan 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default timerEvent for each QGraphicsItem

    Hi all,

    as suggested by others on the forum, I tried using timerEvent for my traffic simulation system. I looked at the mouse example and added a timerEvent for each of the vehicle in the simulation. The system seems slow though when I have more than 50 vehicles moving around. Is that generally a bad idea to have the timerEvent for each moving object? I have a scene class that contains all the vehicles (not a subclass of QGraphicsScene, just a normal class). Would it be better to have the scene class to response to timerEvent and update all vehicles at once?

    Hope someone can advice on this. Thanks.

    Thuan Seah Tan
    QT newbie

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

    Default Re: timerEvent for each QGraphicsItem

    Quote Originally Posted by tts80 View Post
    Would it be better to have the scene class to response to timerEvent and update all vehicles at once?
    Yes, it would be better this way.

Similar Threads

  1. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  2. QGraphicsItem and signals
    By aamer4yu in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2006, 11:19

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
  •  
Qt is a trademark of The Qt Company.