Results 1 to 5 of 5

Thread: QGraphicsScene size

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsScene size

    Could anyone help me to solve this problem?
    Thank you in advance

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QGraphicsScene size

    If you are still looking for a solution, It may not be it is not possible to do directly, there is an alternate way (and I guess, QGraphicsScene is designed to be used this way)

    Size of the QGraphicsScene is by default unlimited, so set the required size, using QGraphicsScene::setSceneRect(), and QGraphicsView, will ensure to show all the size (it can show more than the set size, if the containing widget is larger). Setting the scene rectangle will not restrict the items being drawn outside the scene rectangle, this is because item draw them self and scene does not draw them, so items have to get the scene rectangle first and them draw themselves with in the scene rectangle.

    In your case, as you posted of using large text which may be drawn beyond the scene rectangle, you should first get the scene rectangle, and set restriction to draw wrapped test with in this rectangle.

Similar Threads

  1. how to check QGrapicsView/QGraphicsScene size
    By estel in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 9th February 2010, 23:38
  2. Replies: 12
    Last Post: 30th May 2009, 14:29
  3. Replies: 2
    Last Post: 23rd March 2009, 17:26
  4. QGraphicsScene size
    By invictus in forum Qt Programming
    Replies: 11
    Last Post: 12th August 2007, 21:26
  5. How can I make size of QGraphicsScene smaller?
    By troorl_ua in forum Qt Programming
    Replies: 6
    Last Post: 21st April 2007, 07:56

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.