Skip to content

ButtonItem: draw pixmap to logical size#2873

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:hidpi-autobtn
Nov 3, 2023
Merged

ButtonItem: draw pixmap to logical size#2873
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:hidpi-autobtn

Conversation

@pijyoi
Copy link
Copy Markdown
Contributor

@pijyoi pijyoi commented Nov 2, 2023

On hidpi displays, PlotItem's "auto" icon is rendered smaller, making it harder to click.
This is due to ButtonItem drawing the pixmap in device pixels.

This PR changes the drawing to use logical sizes so that the icon is the same size across different DPI displays.

Remarks:
The "auto" graphic is actually 32x32 while the logical size used is 14, which means that even on a DPI 2.0 display, we will have a nice non-blurry rendering.

@pijyoi pijyoi marked this pull request as ready for review November 3, 2023 00:19
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 3, 2023

Thanks @pijyoi

This is one of those issues in hindsight makes me think "oh yeah, that button is smaller on my laptop vs. my desktop", but never really realized it even as I was switching between displays.

diff LGTM, merging!

@j9ac9k j9ac9k merged commit 0ca7344 into pyqtgraph:master Nov 3, 2023
@pijyoi pijyoi deleted the hidpi-autobtn branch November 3, 2023 03:23
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

Successfully merging this pull request may close these issues.

2 participants