Results 1 to 10 of 10

Thread: QwtPlotIntervalCurve's constant width.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2015
    Posts
    22
    Thanks
    23
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QwtPlotIntervalCurve's constant width.

    Here is situation. I have a class inherited from QwtPlot. I use QwtPlotIntervalCurve to plot squares of certain height regardless of scaling (i.e. width between top and bottom side of square set by QwtPlotInterval must be always constant if I zoom in or zoom out). But it looks like if I use something like QWidget::mapToGlobal() or QWidget::mapFromGlobal of QwtPlotCanvas (this->canvas()->mapFromGlobal()) all conversions are done inside of QwtPlotCanvas automatically, and size of square is wrong. Am I right about it? In that case is it possible in Qwt to play with local and global coordinates for solving that situation, and if answer is "yes", how can it be done?

    P.S. Am I right that every coordinate that we specify to plot elements are firstly exist in global coordinate space and QwtPlot converts it to local coordinate space itself?

    Here is code I used:

    Qt Code:
    1. ...
    2.  
    3. const qreal c_dYCoord = findMiddleYCoordByInterval(m_vYCoords[c_uCurveNum]);
    4. const qreal c_dSquareheight = qMax(static_cast<qreal>(msc_iTextHeight), msc_iLineNonEmptyWidth * c_dPercents / msc_uMaxPercents);
    5. const QPointF c_top = this->canvas()->mapFromGlobal(QPoint(0, c_dYCoord + c_dSquareheight));
    6. const QPointF c_bottom = this->canvas()->mapFromGlobal(QPoint(0, c_dYCoord - c_dSquareheight));
    7.  
    8. const qreal c_dRealHeight = c_top.y() - c_bottom.y();
    9.  
    10. const QwtInterval c_intervalToAttach(c_dYCoord - c_dRealHeight, c_dYCoord + c_dRealHeight);
    11.  
    12. ...
    13.  
    14. currentCurve.push_back(QwtIntervalSample(dCurTime_sec, c_intervalToAttach)); //currentCurve is actually vector of QwtIntervalSample
    15.  
    16. currPlotElement->setSamples(currentCurve); //currPlotElement is QwtPlotIntervalCurve* sample.
    17.  
    18. ...
    To copy to clipboard, switch view to plain text mode 

    Thanks,
    Toniy.
    Last edited by Toniy; 17th August 2015 at 11:13.

Similar Threads

  1. Replies: 1
    Last Post: 10th August 2015, 23:38
  2. Problem with QwtPlotIntervalCurve
    By SandyEmerald in forum Qwt
    Replies: 2
    Last Post: 11th October 2013, 16:16
  3. yLeft axis constant width
    By baray98 in forum Qwt
    Replies: 4
    Last Post: 4th January 2013, 16:40
  4. Auto-adjusting height of a constant width window
    By akiross in forum Qt Programming
    Replies: 0
    Last Post: 7th July 2010, 01:46
  5. Replies: 1
    Last Post: 28th January 2009, 14:47

Tags for this Thread

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.