Results 1 to 3 of 3

Thread: How do I get the inner dimensions of a QGraphicsView?

  1. #1
    Join Date
    Jan 2012
    Posts
    66
    Thanks
    20
    Thanked 2 Times in 2 Posts
    Platforms
    Windows

    Default Re: How do I get the inner dimensions of a QGraphicsView?

    I'm a bit confused about how to get the inner dimensions (scrollable area) of a QGraphicsView in pixels. I've seen several posts about how to get the size of the QGraphicsView itself in terms of how much space it takes up on the screen, but I need its inner dimensions.

    I keep thinking it might be QGraphicsView::sceneRect, but I don't think that is right. For example, if I use QGraphicsView::scale to zoom in, then the QGraphicsView's inner dimensions will have grown, but the underlying scene will not have grown.

    Am I missing something?


    Added after 56 minutes:


    I always forget to look in the inherited members. *sigh*

    It seems as though the correct way to do this is to call QAbstractScrollArea::maximumViewportSize(). Someone please correct me if I'm wrong.
    Last edited by wayfaerer; 6th February 2012 at 03:19.

  2. #2
    Join Date
    Jan 2012
    Posts
    66
    Thanks
    20
    Thanked 2 Times in 2 Posts
    Platforms
    Windows

    Default Re: How do I get the inner dimensions of a QGraphicsView?

    Hm, no, maximumViewportSize() doesn't seem to do it.

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

    Default Re: How do I get the inner dimensions of a QGraphicsView?

    viewport()->size() should do it. Of course you need to call it after the widget is already visible. maximumViewportSize() should also do the trick, you are probably calling it too early.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt Designer QPushButton resize dimensions
    By qtnewbi3 in forum Qt Tools
    Replies: 0
    Last Post: 13th July 2011, 18:10
  2. Resizing QListWidget's dimensions to fit its contents
    By vaibhav in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2011, 15:59
  3. Maximum PNG dimensions?
    By blooglet in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2011, 09:49
  4. Arrays & Vectors Dimensions
    By lixo1 in forum Qt Programming
    Replies: 5
    Last Post: 19th February 2009, 19:55
  5. 3 Dimensions using opengl
    By vermarajeev in forum Qt Programming
    Replies: 30
    Last Post: 23rd April 2007, 12:31

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.