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

BreakpointWidget: Correct icon position #12921

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

VampireFlower
Copy link
Contributor

On Windows, when the current display scale is set to over 150%, the breakpoint icons are in the wrong location. For example, at 200%:
image

This is because the size of the QPixmap is consistent until devicePixelRatioF > 1.5

  • 100% - pix.size: QSize(24, 24)

  • 125% - pix.size: QSize(24, 24)

  • 150% - pix.size: QSize(24, 24)

  • 165% - pix.size: QSize(40, 40)

  • 175% - pix.size: QSize(42, 42)

  • 200% - pix.size: QSize(48, 48)

  • 225% - pix.size: QSize(48, 48)

The simple fix is to use an immediate value of 24 and ignore the size

@TryTwo
Copy link
Contributor

TryTwo commented Jul 9, 2024

Thanks for fixing this! I'm no good at considering these edge cases.

I think the reason why a constant 24 works, is because the row height is generally constant at 30 and we calculate the pixmap as 0.8 * height for padding. I'm worried that something might affect the row height though. Maybe the font/language being used could change it?

Does this fix it?

      const QSize size = pix.deviceIndependentSize().toSize();
      const QPoint p = QPoint((r.width() - size.width()) / 2, (r.height() - size.height()) / 2);

@VampireFlower
Copy link
Contributor Author

Yep, this works great. Now the size isn't hard coded to a constant.

@AdmiralCurtiss AdmiralCurtiss merged commit 321c464 into dolphin-emu:master Jul 10, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants