Skip to content

Commit c1dfc95

Browse files
committed
fix(gui): update screen geometry retrieval to use primaryScreen for Qt5-Qt6 compatibility
(cherry picked from commit 371b5c9)
1 parent 49e4954 commit c1dfc95

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

datalab/gui/tour.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,8 @@ def __resize_window(self, factor: float) -> None:
456456
Args:
457457
factor: Factor by which the size of the window is multiplied.
458458
"""
459-
desktop = QW.QApplication.desktop()
460-
screen = desktop.screenNumber(desktop.cursor().pos())
461-
screen_geometry = desktop.screenGeometry(screen)
459+
screen = QW.QApplication.primaryScreen()
460+
screen_geometry = screen.geometry()
462461
width = int(screen_geometry.width() * factor)
463462
height = int(screen_geometry.height() * factor)
464463
self.win.resize(width, height)

datalab/tests/backbone/config_unit_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def check_conf(conf, name, win: QW.QMainWindow, h5files):
128128
# Check position, taking into account screen offset (e.g. Linux/Gnome)
129129
conf_x, conf_y = sec_main[OPT_POS.option]
130130
conf_w, conf_h = sec_main[OPT_SIZ.option]
131-
available_go = QW.QDesktopWidget().availableGeometry()
131+
available_go = QW.QApplication.primaryScreen().availableGeometry()
132132
x_offset, y_offset = available_go.x(), available_go.y()
133133
assert_in_interval(win.x(), conf_x - x_offset, 0, "X position")
134134
assert_in_interval(win.y(), conf_y - y_offset / 2, 15 + y_offset, "Y position")

0 commit comments

Comments
 (0)