After some searching, I was able to find the culprit for this behaviour.
It's a part of the drawPolyline template function, added in 2.1.0:
template <class DataType>
void QCPAbstractPlottable1D<DataType>::drawPolyline(QCPPainter *painter, const QVector<QPointF> &lineData) const
// if drawing lines in plot (instead of PDF), reduce 1px lines to cosmetic, because at least in
// Qt6 drawing of "1px" width lines is much slower even though it has same appearance apart from
// High-DPI. In High-DPI cases people must set a pen width slightly larger than 1.0 to get
// correct DPI scaling of width, but of course with performance penalty.
if (!painter->modes().testFlag(QCPPainter::pmVectorized) &&
QPen newPen = painter->pen();
As it seems, forcing width to 0 at this point, results in those "weird dotted/dashed lines" in my original post.
Now, I was intrigued by this, and, after some more searching, I think I've found out what is happening, although I'm not really sure why.
Apparently, setting cosmetic pen width (i.e. pen width of 0) does not go well with high-DPI Qt environment variable setting.
I am using this:
// for high DPI screens
I am using a somewhat weird combination of high-DPI and non-high-DPI screen resolutions for development and on the target lab PC where app is deployed and running.
I'm doing the development on a laptop with a 4K screen, but also using a HD 1920x1080 monitor in concurrently on the same laptop (actually using that non-4K monitor as the "main").
Since I was getting all kinds of problems with my app when switching from 4K to HD screen (both on my dev laptop/monitor and on the target lab PC which also has a non-4K monitor) - problems with sizes/scaling of widgets, with alignment of buttons and panels, min/max size boundaries for some panels, etc.
I found an easy solution to all those scaling problems in setting that env variable featured above to 1, and had no problem with DPI switching or various resolutions since.
It turns out that, when QT_AUTO_SCREEN_SCALE_FACTOR is 1, and pen width is 0 (cosmetic), lines get that weird "dashed" look. Once I take out setting the environment variable (which is set at the very beginning of my main() ), polylines of width 0 on QCP Graph look as they should be looking, i.e. as solid, non-dashed lines.
Unfortunately, at the moment I have no idea why this happens and I cannot simply comment that env variable out as a solution, since then all kinds of widget alignment and scaling problems rear their ugly head again, when switching from low- to high-DPI screens and back.
I guess the quick-and-dirty solution will be to comment out that setting of pen width to 0 in drawPolyline template in qcustomplot.h, and go with that, at least for now (I have deadlines to meet and cannot afford to spend too much time on solving this properly at the moment).
But I hope this might help someone else at some point in future :)
I'm currently using Qt 5.12.0 (i.e. not Qt 6.x), so it might be that his happen only when using Qt 5.x. Once I switch to Qt 6.x I'll try to remember and check this part out again.