enaml
enaml copied to clipboard
PopupView positions incorrectly with multiple displays
The ensure_on_screen
function in https://github.com/nucleic/enaml/blob/main/enaml/qt/q_popup_view.py#L866 seems to mess up the popup location when multiple screens are present (at least on linux with Qt6, didn't test anything else).
I have 3 screens and it places the popup on the first leftmost screen when the window is on the rightmost screen. If that function is commented out then it works as I would expect.
I think the root issue comes from _get_screen
on line 829 which somehow does not get the parent screen. However I do not have access to a multi screen setup ATM to investigate.
I tested this feature extensively on Windows with a three screen setup when I wrote it.
It may be something wonky with your Linux setup.
On Wed, Jul 20, 2022 at 12:56 Matthieu Dartiailh @.***> wrote:
I think the root issue comes from _get_screen on line 829 which somehow does not get the parent screen. However I do not have access to a multi screen setup ATM to investigate.
— Reply to this email directly, view it on GitHub https://github.com/nucleic/enaml/issues/499#issuecomment-1190583491, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABBQSP4HC4K2WQ3TOZ3P4LVVA4UBANCNFSM54ELL3RQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Perhaps it can be disabled on linux? I added a few print statements
target_pos=PyQt6.QtCore.QPoint(4800, 750)
anchor_pos=PyQt6.QtCore.QPoint(100, 0)
trial_geo=PyQt6.QtCore.QRect(4700, 720, 200, 69) # This is the correct position on my screen
desk_geo=PyQt6.QtCore.QRect(0, 0, 1920, 1080)
geo=PyQt6.QtCore.QRect(1720, 720, 200, 69)
~~I'm curious if desk_geo returns all monitors as one big screen on windows?~~ Edit: Looks like X11 does this. At least on my setup it appears to be clamping it to within a single screen size (my setup is 3 FHD screens in a horizontal line).
There is a note in QScreen https://doc.qt.io/qt-5/qscreen.html#availableGeometry-prop
Note, on X11 this will return the true available geometry only on systems with one monitor and if window manager has set _NET_WORKAREA atom. In all other cases this is equal to geometry(). This is a limitation in X11 window manager specification.
Edit: It appears to be X11 only, on wayland it works fine.
Closed by #500