Getting the size of a QGraphicsView

后端 未结 5 1916
眼角桃花
眼角桃花 2021-01-20 14:07

I want to know the size of a certain QGraphicsView. Its size isn\'t fixed because the widget is part of a grid layout. I tried using this->ui->myGra

5条回答
  •  终归单人心
    2021-01-20 14:42

    Constantly received 100x30 as the size of my QGraphicsView as well. It turned out I was asking for the size of the QGraphicsView before it was shown.

    After moving my initialization code to showEvent, I got the correct dimensions.

提交回复
热议问题