slightly better autoresizing, not great

This commit is contained in:
Roberto Alsina 2020-01-31 17:10:18 -03:00
parent ed55a157fe
commit 1e5e3fe81a

View File

@ -92,10 +92,12 @@ class Window(QObject):
self.update_replica_of_data() self.update_replica_of_data()
for _, mon in self.xrandr_info.items(): for _, mon in self.xrandr_info.items():
mon['item'].update_visuals(mon) mon['item'].update_visuals(mon)
self.adjust_view()
def adjust_view(self): def adjust_view(self):
self.ui.sceneView.resetTransform()
self.ui.sceneView.ensureVisible(self.scene.sceneRect(), 100, 100) self.ui.sceneView.ensureVisible(self.scene.sceneRect(), 100, 100)
scale_factor = 0.7 * min( scale_factor = .8 * min(
self.ui.sceneView.width() / self.scene.sceneRect().width(), self.ui.sceneView.width() / self.scene.sceneRect().width(),
self.ui.sceneView.height() / self.scene.sceneRect().height(), self.ui.sceneView.height() / self.scene.sceneRect().height(),
) )