Get visible rectangle of QGraphicsView?

前端 未结 6 1456
借酒劲吻你
借酒劲吻你 2020-12-15 22:04

I\'ve been pulling my hair out with this one for hours. There\'s a thread here about it, but nothing seems to be working. QGraphicsView::rect() will return the width and hei

6条回答
  •  庸人自扰
    2020-12-15 22:45

    Just map the pixel-based viewport rectangle to the scene using the view:

    graphicsView->mapToScene(graphicsView->viewport()->geometry()).boundingRect()
    

    Bye, Marcel

提交回复
热议问题