Results 1 to 4 of 4

Thread: Problem determining size of QGraphicsView

  1. #1
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Problem determining size of QGraphicsView

    Hello, currently I try to figure out how to get the actual dimensions of a QGraphicsView.

    I created a form with the designer on which a QGraphicsView ist placed. In the properties of the designer it reads 752x507 (width x height) under "geometry".

    Getting the dimensions during runtime with code like this
    Qt Code:
    1. Integer.toString(ui.graphicsView.geometry().height())
    To copy to clipboard, switch view to plain text mode 
    gives me 752x526.

    But when I draw a rectangle on the related QGraphicsScene I can draw a figure with 747x502. This rectangle is shown exactly at the bordes of the QGraphicsView (without scrollbars etc.).

    Can you explain to me, why this happens and how I can determine programmatically and reliably the dimensions of the QGraphicsView?

    I'm a little bit confused that I'm not able to get dependable widths and heights...

    Thanks in advance for your help!

  2. #2
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem determining size of QGraphicsView

    For deep understanding of widgets; take a look of
    http://doc.trolltech.com/4.3/geometry.html
    Here is some difference b/w geometry() as well as frameGeometry().
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  3. #3
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem determining size of QGraphicsView

    Thanks for that link, I shouldn't just look in the Java documentation.

    But for me there remains this question: Wherefrom do I get the dimensions of my QGraphicsView (because all the methods descibed give wrong results)?

  4. #4
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem determining size of QGraphicsView

    Probably you can try graphicsView->viewport()->geometry().
    Also have a look at QGraphicsScene::sceneRect()
    What exactly do you want to do ?
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

Similar Threads

  1. Simple Problem with QFont (point size)
    By mtrpoland in forum Newbie
    Replies: 4
    Last Post: 31st December 2007, 17:49
  2. Setting the scene size in QGraphicsView
    By Valheru in forum Newbie
    Replies: 5
    Last Post: 11th November 2007, 16:03
  3. Size of QGraphicsView
    By IsleWitch in forum Newbie
    Replies: 10
    Last Post: 10th October 2007, 13:09
  4. QGraphicsView scrolling problem with 4.3.0
    By hb in forum Qt Programming
    Replies: 8
    Last Post: 30th August 2007, 23:18
  5. Problem with QGraphicsView.
    By kiranraj in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2007, 20:44

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.