How to get the parent's size (height and width in pixels) from child widget?
-
Hey,
I have a QGraphicsView and a tabWidget.
the QGraphicsView is a child of the tabWidget.
How is it possible to get the size (width and height in pixels) of the tabWidget inside my QGraphicsView?
I ask this, because I want to block zooming in QGraphicsView before one side of it becomes less than the tabWidget's side.
Thanks for answers -
@Niagarer
the GraphicsView is inside the tab widget right?
If so just check the size of the graphicsview itself (or better it's viewport), since it gets resized by the tabwidget automatically. -
@raven-worx
Yes, it worked, thanks!
I can't find a method to get the real size of the QGraphicsScene rectangle in pixels (this number should become smaller when I zoom out). To do what I want, I will need this I guess.
But this is actually another question. -
@Niagarer said in How to get the parent's size (height and width in pixels) from child widget?:
I can't find a method to get the real size of the QGraphicsScene rectangle in pixels (this number should become smaller when I zoom out)
you need to use the
mapFromScene()
methods.view->mapFromScene( view->sceneRect() ).boundingRect()
-
@raven-worx
yes, it works, thank you!