PDA

View Full Version : Problem determining size of QGraphicsView



Bocki
17th February 2008, 07:47
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

Integer.toString(ui.graphicsView.geometry().height ())
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!

ashukla
17th February 2008, 09:04
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().

Bocki
17th February 2008, 14:27
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)?

Gopala Krishna
17th February 2008, 14:54
Probably you can try graphicsView->viewport()->geometry().
Also have a look at QGraphicsScene::sceneRect()

What exactly do you want to do ?