[KMag] Fix HiDPI support
ClosedPublic

Authored by cfeck on Jun 6 2018, 10:09 PM.

Details

Summary

Adjust the centering shift based on the device scale factor.
Also enable HiDPI icons.

BUG: 394308

Test Plan

Only tested with "QT_SCALE_FACTOR=x.x kmag"

Diff Detail

Repository
R428 KMag
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cfeck requested review of this revision.Jun 6 2018, 10:09 PM
cfeck created this revision.
zzag added a subscriber: zzag.Jun 6 2018, 10:36 PM
zzag added inline comments.
kmagzoomview.cpp
330

It can be const.

davidedmundson requested changes to this revision.Jun 10 2018, 2:17 PM
davidedmundson added a subscriber: davidedmundson.
davidedmundson added inline comments.
kmagzoomview.cpp
331

You're getting the logical width of m_coloredPixmap from it's pixel size, so you should be using the devicePixelRatio of m_coloredPixmap and not the devicePixelRatio of the current paint device. They're probably the same, you shouldn't cound on it.

(Also consider looking at style()->drawItemPixmap it's a convenient wrapper around centering a pixmap in a rect, which looks to be what this code is trying to do)

This revision now requires changes to proceed.Jun 10 2018, 2:17 PM
davidedmundson added inline comments.Jun 10 2018, 2:22 PM
kmagzoomview.cpp
331

s/cound/count

cfeck updated this revision to Diff 36468.Jun 21 2018, 3:09 PM

Use devicePixelRatio from pixmap

cfeck planned changes to this revision.Jun 21 2018, 3:11 PM
cfeck requested review of this revision.Jun 21 2018, 3:17 PM

Regarding using QStyle::drawItemPixmap(): that won't work, because I need to scale the painter to draw the pixmap scaled. Centering in this case needs the additional transformations.

cfeck marked 3 inline comments as done.Jun 21 2018, 3:18 PM
davidedmundson accepted this revision.Jun 21 2018, 3:26 PM
This revision is now accepted and ready to land.Jun 21 2018, 3:26 PM
This revision was automatically updated to reflect the committed changes.