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

HiDPI scaling is not respected for menu icons and padding #39

Open
paulmcauley opened this issue Mar 15, 2021 · 4 comments
Open

HiDPI scaling is not respected for menu icons and padding #39

paulmcauley opened this issue Mar 15, 2021 · 4 comments

Comments

@paulmcauley
Copy link

I have a HiDPI display at 250% scaling.

Here is a screenshot of how the Material menu looks:
konsole_Material_menu

Here is a screenshot of how a normal menu looks:
konsole_normal_menu

As you can see, the menu's icon size and padding are too small when scaling is used.

Zren added a commit that referenced this issue Mar 15, 2021
The horzPadding is now smallSpacing instead of a hardcoded 4px.
@Zren
Copy link
Owner

Zren commented Mar 15, 2021

Was planning to refactor the TextButton::horzPadding from a hardcoded 4px anyways, so I just made it use smallSpacing.

As for why the QMenu doesn't scale, I'm not sure.

Here's what 200% scaling looks like for me to confirm the bug.

2021-03-15___19-07-33

@Zren
Copy link
Owner

Zren commented Mar 15, 2021

Hmm, if I uncomment the code to display the normal "Application Menu" icon button that tells KWin to display the menu, it draws the entire menu at 100%. Even the text is at 100% scaling.

2021-03-15___19-17-57

Even breeze seems to have this bug. Can you confirm this @paulmcauley?

2021-03-15___19-20-14

@paulmcauley
Copy link
Author

No, I don't have the problem with a normal application menu in Breeze (Plasma 5.21.2). Here is what 250% with a normal application menu looks like for me:
breeze_application_menu_250

@SeptemberHX
Copy link

It is possible to fix the small icon with QProxyStyle.

    int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override {
        qCDebug(category) << metric;
        if (metric == QStyle::PM_ButtonIconSize) {
            return QProxyStyle::pixelMetric(metric, option, widget) * pixelRatio;
        }
        return QProxyStyle::pixelMetric(metric, option, widget);
    }

Then appMenu->setStyle(xxx) should works.
But I don't know how to get the pixelRatio in a decoration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants