Results 1 to 10 of 10

Thread: QGraphicsItem Tracer

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: QGraphicsItem Tracer

    You can also consider the following design -
    Have a list of points associated with each graphics item. And use these points to in QGraphicsScene::drawBackground to draw the trails.
    You can also have a pixmap for background, and you need to update the pixmap on itemChange signal . This approach might save you from using item for the trails.

  2. #2
    Join Date
    Jun 2006
    Location
    Colorado
    Posts
    12
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    5

    Default Re: QGraphicsItem Tracer

    I have a similar implementation problem.

    I'm developing a 2D earth plot using the Graphics View Framework to represent the flight path of a aircraft (Position in Latitude and Longitude). The background is a image of a Mercator projection of the earth added via (QGraphicView). I already have the means of converting from geographical coordinates to the scene coordinates.

    The user needs to have the ability to add or delete aircraft (0 to 10) hence each aircraft is a reimplementation of QGraphicsItem. Each aircraft stores its initial position (Lat & Lon) and adds its current position to storage "QList" during its flight. I want to show the flight path from take off (New York ) to landing (Paris). The user must have the ability of selecting a aircraft and seeing where it had taken off from even after it has already started its journey.

    I plan on updating the Earth Plot via a QTimer connected to the scene's advance() slot (similar to the Colliding Mice Example) during the aircraft flight.

    In the AircraftItem every time it geographical position has been updated and the QTimer timeout() signal is triggered then in my AircraftItem::advance(int step) function I was planning on calling AircraftItem::itemChange() to change its position translated into the scene's coordinates.

    Ideally the whole flight path is represented by a QPainter::drawPolyline

    When I update the aircraft's position on my plot do I need to change its boundingRect() "Not really sure how to do this, btw" and should I do my drawing in its paint function.

  3. #3
    Join Date
    Jun 2006
    Location
    Colorado
    Posts
    12
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    5

    Default Re: QGraphicsItem Tracer

    NOTE In my AircraftItem Object when my advance(int step) function is activated by the QTimer::timeout() signal I want to update the aircraft's current position (converted into the scene's coordinates) Now as I draw the flight path from the initial starting point. Does the entire flight path trace need to be within the AIrcraftItem::boundingRect()?

Similar Threads

  1. selection of QGraphicsItem
    By navi1084 in forum Qt Programming
    Replies: 6
    Last Post: 23rd July 2009, 06:33
  2. Casting QGraphicsItem child from QGraphicsItem
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2008, 15:37
  3. Replies: 2
    Last Post: 28th June 2008, 16:31
  4. Is it possible to use QPainter with QGraphicsItem?
    By william.dias in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2008, 10:19
  5. Beesoft Tracer - remote/local debugging
    By piotrek in forum Qt-based Software
    Replies: 0
    Last Post: 2nd July 2007, 07:38

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