Bug 419527 - KmPlot graph view is pixelated with HiDPI scaling
Summary: KmPlot graph view is pixelated with HiDPI scaling
Status: RESOLVED FIXED
Alias: None
Product: kmplot
Classification: Applications
Component: general (show other bugs)
Version: 1.3.0
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-02 08:22 UTC by Christoph Feck
Modified: 2020-05-22 09:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 20.04.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Feck 2020-04-02 08:22:46 UTC
SUMMARY
KmPlot has no HiDPI support.

STEPS TO REPRODUCE
1. Run "QT_SCALE_FACTOR=1.2 kmplot"
2. Add a graph by clicking on "Create > Cartesian Plot" and enter f(x)=x^2

OBSERVED RESULT
Graph view is pixelated. Also reproducible with integral scale factors.

EXPECTED RESULT
Device pixel ratio is taken into account when creating the graph pixmap.
Comment 1 Yuri Chornoivan 2020-05-04 16:20:41 UTC
I have added

QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);

into main.cpp in 2019 trying to make HiDPI work, but it seems that this does not make any difference. Is there any other way to fix this on Qt level?
Comment 2 Christoph Feck 2020-05-04 16:34:33 UTC
The pixmap that kmplot creates in view.cpp needs to be created with the same device ratio as the window, but rendering probably also needs to be adjusted.

https://cgit.kde.org/kmplot.git/tree/kmplot/view.cpp#n2923

https://doc.qt.io/qt-5/qpixmap.html#setDevicePixelRatio
Comment 3 Yuri Chornoivan 2020-05-08 08:23:49 UTC
If somebody will want to test the possible fix someday:

https://phabricator.kde.org/D29421
Comment 4 Yuri Chornoivan 2020-05-22 08:59:07 UTC
Git commit 97a1b21d12fdd8b0b0267a0d4ba28aa9eb674bdd by Yuri Chornoivan.
Committed on 22/05/2020 at 08:58.
Pushed by yurchor into branch 'master'.

Get rid of pixelation on HiDPI displays

Differential revision: https://phabricator.kde.org/D29421
FIXED-IN: 20.04.2

M  +3    -1    kmplot/view.cpp

https://invent.kde.org/education/kmplot/commit/97a1b21d12fdd8b0b0267a0d4ba28aa9eb674bdd
Comment 5 Yuri Chornoivan 2020-05-22 09:00:13 UTC
Git commit 5fa5072f644199b35fd956b98973bcb5e11bf23a by Yuri Chornoivan.
Committed on 22/05/2020 at 09:00.
Pushed by yurchor into branch 'release/20.04'.

Get rid of pixelation on HiDPI displays

Differential revision: https://phabricator.kde.org/D29421
FIXED-IN: 20.04.2

M  +3    -1    kmplot/view.cpp

https://invent.kde.org/education/kmplot/commit/5fa5072f644199b35fd956b98973bcb5e11bf23a