Results 1 to 3 of 3

Thread: No idea about QGraphicsView

  1. #1
    Join Date
    May 2007
    Posts
    91
    Thanks
    60
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy No idea about QGraphicsView

    I used QGraphicsView to draw a diagram like below
    this diagram is depending on an xml file
    so, the height and the width can be variable acoording to the user
    Now I can draw it using a given initial position like (300,300)
    My problem is:
    1.after I finished drawing this diagram, what should i do to make it in the central of the window, especially when the user change the size of the window?
    2.is there any way I can change the size of the scene/view according to the size of the diagram? and this diagram is still in the central of the window?


    Thank a lot for help!
    Attached Images Attached Images

  2. #2
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: No idea about QGraphicsView

    Don't give a size to the scene and use the QGraphicsView::centerOn(const QGraphicsItem * item) function

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

    Shawn (27th June 2007)

  4. #3
    Join Date
    May 2007
    Posts
    91
    Thanks
    60
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: No idea about QGraphicsView

    thx a lot
    I remove this
    Qt Code:
    1. scene.setSceneRect (0,0,2000,1600);
    To copy to clipboard, switch view to plain text mode 

    and it works !

Similar Threads

  1. QGraphicsView and item focus
    By Micawber in forum Qt Programming
    Replies: 3
    Last Post: 22nd June 2007, 20:36
  2. QGraphicsScene and QGraphicsView
    By rossd in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2007, 14:43
  3. QGraphicsView rendering issue
    By guilugi in forum Qt Programming
    Replies: 9
    Last Post: 6th April 2007, 09:09
  4. Using QGraphicsView with model/view programming
    By JLP in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 11:04
  5. QGraphicsView and QGraphicsScene speeds
    By jnk5y in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2006, 07:13

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.