Wrong handling of multiple screens having different resolutions
Requirements
-
I searched through the issues if the issue already exists
Steps to reproduce
- On a system with two monitors having different resolutions, start/place labplot on the secondary monitor
- create a data picker worksheet and enable the zooming window
Expected
The zooming window is properly placed above the current position of the the cursor.
Observed
The zooming window is off like on the screenshot below:
When placing labplot on the primary screen the positioning is correct:
The problem is because we're using QApplication::desktop() to get the resolution and the dpi number instead of getting the geomerty of the current screen. In !375 (merged) desktop() is replaced with primaryScreen() which will lead to the same problem. We need change the code and to properly handle the different screen geometries and also the changes between them (-> check how labplot behaves when being moved from one monitor to another).
This problem also affects such basic stuff like the initial size of the worksheet which is wrong when being created while the application window in not placed on the primary screen.
Ways to determine the proper screen:
- https://doc.qt.io/qt-5/qwidget.html#screen - available since Qt 5.14
- const auto* screen = widget->window()->windowHandle()->screen();
- https://doc.qt.io/qt-5/qdesktopwidget.html#screenNumber
Labplot Version
Debug build 2.10.0-1017-g3ab6efebd
Oct 13 2023, 21:06:57
System: macOS 14.0
Lokalisierung: English,United Kingdom (Dezimalpunkt ',', Tausendertrenner '.'
Zahlenformat: Dezimalpunkt ',', Tausendertrenner '.', Exponentialzeichen 'e', Nullzeichen '0', Prozentzeichen '%', Positiv-/Negativzeichen '+'/'-' (Aktualisiert beim Neustart)
Architektur: x86_64-little_endian-lp64
Kernel: darwin 23.0.0
C++ Compiler: AppleClang 14.0.3.14030022
C++ Compiler Optionen: -fdiagnostics-color=always -fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Wvla -Wdate-time -D_GNU_SOURCE -Wall -Wextra -Wundef -Wpointer-arith -Wunreachable-code -Wunused -Wdeprecated-declarations -fno-omit-frame-pointer -fstack-protector -fexceptions -std=c++17 -O2 -Wcast-align -Wswitch-enum -fvisibility=default -pedantic -Wzero-as-null-pointer-constant