Пример #1
0
 def _compute_max_zoom(self):
     # The max zoom is the one that fits one item into the view
     # We don't allow to zoom any further than this
     item = QGraphicsRectItem(0, 0, ProjectItemIcon.ITEM_EXTENT, 0)
     self.scene().addItem(item)
     self.scene().removeItem(item)
     item_scene_rect = item.boundingRegion(
         item.sceneTransform()).boundingRect()
     item_view_rect = self.mapFromScene(item_scene_rect).boundingRect()
     viewport_extent = min(self.viewport().width(),
                           self.viewport().height())
     return viewport_extent / item_view_rect.width()