Results 1 to 6 of 6

Thread: Scale displayed incorrectly

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    12
    Thanks
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Scale displayed incorrectly

    I think I discovered a bug in the way that the scale is displayed.

    I have an example program with a bare QwtPlot and a checkbox that sets/clears the attribute QwtScaleEngine::Floating for the x axis. Here is the code:

    Qt Code:
    1. QtDialogTest::QtDialogTest(QWidget* parent)
    2. : QDialog(parent)
    3. {
    4. ui.setupUi(this);
    5. Populate();
    6. ui.plot->setAxisAutoScale(QwtPlot::xBottom);
    7. connect(ui.enableFloatingAttributecheckBox, &QCheckBox::stateChanged, this, &QtDialogTest::EnableFloatingAttribute);
    8. }
    9.  
    10. void QtDialogTest::EnableFloatingAttribute(int state)
    11. {
    12. bool enable = (state == Qt::Checked);
    13. ui.plot->axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating, enable);
    14. ui.plot->replot();
    15. }
    16.  
    17. void QtDialogTest::Populate()
    18. {
    19. QVector<QPointF> samples{ QPointF(1000.4, 1.0), QPointF(1001.4, 1.5), QPointF(1001.7, 2.0), QPointF(1001.9, 1.5), QPointF(1002.05, 1.0) };
    20. auto curve = new QwtPlotCurve;
    21. curve->setSamples(samples);
    22. QBrush brush(QColor::fromRgb(255, 0, 0));
    23. QPen pen(QColor::fromRgb(128, 0, 0));
    24. curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, brush, pen, QSize(8, 8)));
    25. curve->setPen(pen);
    26. curve->attach(ui.plot);
    27. }
    To copy to clipboard, switch view to plain text mode 

    When the plot is displayed, everything seems ok (see attached file ScaleOk.png). However, when I reduce the size of the plot, the scale is not displayed correctly anymore (see attached file ScaleWrong.png). I guess the plot attempts to display the leftmost label of the scale and - correctly - reduced the space between the ticks. But since the leftmost data point has a value of 1000.4, which also is the value of the leftmost minor tick, these two are not displayed correctly to each other anymore.

    Can you perhaps provide a short-term bugfix for this?
    Attached Images Attached Images

Similar Threads

  1. Qt Quick output is displaying incorrectly after compile
    By rostamiani in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 7th June 2015, 08:04
  2. Qt SvgRenderer renders SVG incorrectly
    By Daevius in forum Qt Programming
    Replies: 0
    Last Post: 2nd October 2011, 16:40
  3. QtSVG build incorrectly
    By Helios in forum Installation and Deployment
    Replies: 0
    Last Post: 11th July 2010, 05:58
  4. Load image from QNetworkReply incorrectly
    By tqlong in forum Qt Programming
    Replies: 0
    Last Post: 1st July 2010, 16:51
  5. Replies: 1
    Last Post: 24th June 2010, 15:00

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.