QCustomPlot Discussion and Comments

Blurry fonts and graph using QCP on Android/IOSReturn to overview

Hey guys,

First of all really spectacular library with great functions. I'm using QCP in an qml application, where I inherit the QCP-Widget inside a QQuickItem which works really great. Performance of real time plots are really okay. The application has to be multi platform. On Windows and low dpi android tablets, the lines and fonts of QCP are really sharp and look good. On Android and IOS the fonts and the lines are looking blurry. I experimented with different approaches, that were already mentioned in the forum.
Here is a screenshot of the android verion on a 4K display (HTC U11): https://imgur.com/a/rALAeon

Does anyone has a tip regarding this behaviour? I'm not really familiar with coding in Qts painting API

It seems like the system isn't communicating the correct device pixel ratio.
What's the output of

qDebug() << [QCP's parent widget]->devicePixelRatio();
qDebug() << customPlot->bufferDevicePixelRatio();

You can try decativating the label caching:

customPlot->setPlottinhHint(QCP::phCacheLabels, false)

But note that 4K on an embedded android is pretty steep. Make sure your system has the power to render complex graphics at such resolution – most apps render a few boxes as buttons and a few lines of text, which is doable in 4K. But complex plots with a million data points and channel fill, not so much ;).

The output of your 2 debug lines brings following

qApp->devicePixelRatio:  4
customPlot->bufferDevicePixelRatio:  4

and current plot looks like this: https://imgur.com/a/22ZPk3S

i have modified also plottingHints, but seems like the workarounds are not taking effect. Pixel Ratio is correct. My Rendering type is currently opengl. Perhaps Software rendering could do the trick?

I have experimented a little bit and was able to get better looking fonts in my point of view. It is looking better:


My font definition is looking this way:

    QFont font = qApp->font();  // start out with MainWindow's font..
    font.setPointSize(11); // and make a bit smaller for legend
    font.setStyleHint(QFont::AnyStyle, QFont::OpenGLCompatible);

and in the main.cpp i have added following config:


I think it could be better, cause on windows without High-DPI fonts are clear and sharp. I don't know where i have to dig for this issue.

Regards Michael