Results 1 to 7 of 7

Thread: Qwt 6.2 - problems with high dpi scaling

  1. #1
    Join Date
    Oct 2019
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Qwt 6.2 - problems with high dpi scaling

    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?

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 6.2 - problems with high dpi scaling

    Which Qt version ?
    Do you also see the problem when using https://sourceforge.net/p/qwt/git/ci/qwt-6.2/tree/ ?

    Uwe

  3. #3
    Join Date
    Oct 2019
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt 6.2 - problems with high dpi scaling

    The Qt version we are using is 5.14.0.

    I am not sure about your second question. The problem occurs with qwt 6.2.0, qwt 6.1.4 worked fine (we can exactly define the commit when the problem showed up and that commit was the upgrade from qwt 6.1.4 to qwt 6.2). Does your link lead to an advanced version of qwt 6.2? If yes, I will try it.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 6.2 - problems with high dpi scaling

    Quote Originally Posted by mwh View Post
    Does your link lead to an advanced version of qwt 6.2?
    This is the 6.2 branch, with all bugfixes that have been reported so far against 6.2.0. The next minor release ( = 6.2.1 ) will be made of it.
    It does not include changes that break binary compatibility - those exclusively go to the development branch ( https://sourceforge.net/p/qwt/git/ci/develop/tree/ )

    Uwe

  5. #5
    Join Date
    Oct 2019
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt 6.2 - problems with high dpi scaling

    Thank you for the information. I tried with the binary compatible version containing the bugfixes and the bug is gone.

    Legend ok again.jpg

    So my next question is do you already have an ETA for the 6.2.1? Or can you recommend using the bugfix version as it is now?

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 6.2 - problems with high dpi scaling

    A bugfix branch should always be better than the latest corresponding release. According Qwt 6.2.1: guess it is time to publish what has been fixed over the last 2 years.
    Also note, that the development branch should also have no bugs. However its API is not stable yet.

    Uwe

  7. #7
    Join Date
    Oct 2019
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt 6.2 - problems with high dpi scaling

    Thank you for the information.

Similar Threads

  1. Replies: 7
    Last Post: 12th November 2021, 18:05
  2. Time from HIGH to LOW
    By arthuki in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2016, 18:42
  3. High CPU Utilization
    By navi1084 in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2009, 09:37
  4. Very high CPU usage with QTableView and MVC
    By montylee in forum Qt Programming
    Replies: 7
    Last Post: 24th March 2009, 06:14
  5. Scaling Painter without scaling the coordinate sytem
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 7th January 2008, 21:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.