Results 1 to 5 of 5

Thread: Proper Setup for Using the Graphics View Framework

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jan 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 2 Times in 1 Post

    Default Re: Proper Setup for Using the Graphics View Framework

    The way I'd think about how to organize your functions, is to think about what difference between the QGraphicsScene and the QGraphicsView. The QGraphicsScene contains the actual canvas that you are drawing. In your case it would be the map of the world and the other graphical items. The QGraphicsView is like the window into your scene, so with this thinking Zooming and Panning would be handled in the View.

    As for printing/saving, as ecanela said, they can be handled in either the scene or the view. However, if you handle it in the view remember that unless you add special code, it will only print/save what is currently being viewed in the View. If you handle printing/saving in the scene, then the entire scene will be printed/saved.

    For mouse interactions, you can override the mouseMoveEvent, mousePressEvent and mouseReleaseEvent in either the QGraphicsView or QGraphicsScene. Depending on what you're doing it might be easier and better organized if you can handle it in the widgets/items that you are drawing.

    Lastly, if you are just doing simple zoom in/out, try using QGraphicsView::scale. This way, you won't need to worry about playing with the transformation matrix.

    Good Luck!

  2. The following 2 users say thank you to dchow for this useful post:

    mlik (14th May 2010), Wazman (28th January 2010)

Similar Threads

  1. Problem about Graphics View Framework
    By FinderCheng in forum Qt Programming
    Replies: 5
    Last Post: 3rd November 2009, 08:16
  2. Problem with Graphics View Framework
    By Disperato in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2009, 20:44
  3. Issues with the Graphics View Framework
    By lni in forum Qt Programming
    Replies: 8
    Last Post: 26th April 2009, 14:13
  4. about the contextMenuEvent in graphics view framework
    By bingoking in forum Qt Programming
    Replies: 1
    Last Post: 21st April 2009, 06:04
  5. Replies: 4
    Last Post: 5th August 2008, 19:55

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.