Hello,

consider the following code:

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. // The next four lines enable high dpi scaling for the application
  4. QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  5. QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
  6. QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
  7. QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
  8.  
  9. QApplication a(argc, argv);
  10. QwtPlotClient w;
  11. w.show();
  12. return a.exec();
  13. }
  14.  
  15. QwtPlotClient::QwtPlotClient(QWidget *parent)
  16. : QDialog(parent),
  17. m_plot(new QwtPlot)
  18. {
  19. m_ui.setupUi(this);
  20. m_ui.plotFrame->layout()->addWidget(m_plot);
  21.  
  22. auto legend = new QwtLegend();
  23. legend->setFrameStyle(QFrame::Box | QFrame::Sunken);
  24. m_plot->insertLegend(legend, QwtPlot::BottomLegend);
  25.  
  26. QVector<QPointF> points{ QPointF(0, 25), QPointF(10, 12), QPointF(20, 20), QPointF(30, 31), QPointF(40, 20), QPointF(50, 15) };
  27. auto curve1 = new QwtPlotCurve("Curve 1");
  28. curve1->setSamples(points);
  29. curve1->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, QBrush(Qt::red), QPen(Qt::darkRed), QSize(8, 8)));
  30. curve1->setPen(QPen(Qt::red));
  31. curve1->setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
  32. curve1->setLegendAttribute(QwtPlotCurve::LegendShowSymbol, true);
  33. curve1->attach(m_plot);
  34.  
  35. m_plot->setAxisAutoScale(QwtPlot::xBottom, true);
  36. m_plot->setAxisAutoScale(QwtPlot::yLeft, true);
  37. }
To copy to clipboard, switch view to plain text mode 

Running this code gets the following result (the legend is broken):
Broken legend.jpg

When I remove the first 4 lines in main(), qwt behaves as expected (the legend is correct):
Legend ok.jpg

We used to use Qwt 6.1.4 before and there were no problems with high dpi scaling like this.

Is this a bug or am I missing something?