Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menubar in titlebar is not visible in second monitor #51

Closed
Pikachuxxxx opened this issue Jan 17, 2024 · 3 comments
Closed

Menubar in titlebar is not visible in second monitor #51

Pikachuxxxx opened this issue Jan 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Pikachuxxxx
Copy link

Pikachuxxxx commented Jan 17, 2024

Hi, wow this is a amazing project thanks for it! So while I was playing around with the examples, GoodShowCase renders the main menu with an offset when moved to second monitor.

Could be a QT bug not sure, will investigate more on my side as well.

Using QGoodWindow : 2.4.2
QT Version : 5.14.2
Windows 11

@Pikachuxxxx
Copy link
Author

Pikachuxxxx commented Jan 17, 2024

int mouseScreen = qApp->desktop()->screenNumber(QCursor::pos());

QScreen* screen = qApp->screens()[mouseScreen];//windowHandle()->screen();

widget->windowHandle()->setScreen(screen);

int x = qFloor(screen->geometry().x() / m_pixel_ratio);
int y = qFloor(screen->geometry().y() / m_pixel_ratio);

x += widget->x() - screen->geometry().topLeft().x();
y += widget->y() - screen->geometry().topLeft().y();

In qgoodwindow.cpp line 2006 onwards where the QMenu class is Handled, we will have to subtract the top left for it to work properly on multiple monitors, nor sure if this the right way to get the screen but seems to do the fix for now.

@antonypro
Copy link
Owner

Hi, @Pikachuxxxx!

This problem occurs on a secondary monitor without high DPI on Qt 5.14 and Qt 5.15.

To solve this problem, before reposition the menu, the library asks if the window is on a monitor with high DPI or not.

You can test it in QGoodWindow-2.4.3-beta3:
https://github.com/antonypro/QGoodWindow/tree/test/QGoodWindow-2.4.3-beta3

Thanks!

@antonypro antonypro added the bug Something isn't working label Jan 26, 2024
@antonypro
Copy link
Owner

Hi, @Pikachuxxxx!

I'm going to close this issue because the solution is present in version 2.4.3.
If you believe that are problems remaining, please ask to reopen this issue or open a new issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants