Results 1 to 2 of 2

Thread: QwtPlot with patient monitor style

  1. #1
    Join Date
    Jun 2011
    Posts
    38
    Thanks
    8
    Thanked 1 Time in 1 Post

    Default QwtPlot with patient monitor style

    Hi everyone,

    I'm trying to display plots with QwtPlot in this way:
    http://www.youtube.com/watch?v=-K9Aj49hHzA
    Note how the curve is "eaten up" and not just moved.

    My first approach looks like this:
    Qt Code:
    1. void QwtTest::timerEvent(QTimerEvent * event)
    2. {
    3. for(int i = 0; i < 5; ++i)
    4. {
    5. yData_[currXPos_] = sin(2*pi*sinPos_/(0.169*dataSize_));
    6. ++sinPos_;
    7. currXPos_ = (currXPos_ + 1) % dataSize_;
    8. }
    9. ui.qwtPlot->replot();
    10. //everything until here is working, this makes the curve restart at the left hand side when the right hand side is reached
    11. //now i want to overpaint parts of the plot to get the free space between the 2 parts of the curve
    12. QPainter painter(ui.qwtPlot);
    13. painter.setPen(Qt::blue);
    14. painter.fillRect(ui.qwtPlot->rect(), QColor(0,0,0));
    15. //this part does not do anything...
    16. }
    To copy to clipboard, switch view to plain text mode 

    Do you have any suggestions?
    Thanks in advance!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,321
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QwtPlot with patient monitor style

    You can't use QPainter outside of a paintEvent() handler, so whatever you want to draw on the plot has to be done inside the QwtPlot paintEvent. So, you will probably have to derive from QwtPlot, reimplement drawCanvas() to draw your things after the normal QwtPlot::drawCanvas() is finished.

Similar Threads

  1. QT on LCD monitor
    By Ratheendrans in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 5th March 2011, 16:03
  2. X Monitor in a Qt form
    By prasenjit in forum Qt-based Software
    Replies: 1
    Last Post: 29th April 2010, 06:58
  3. Monitor a new added File
    By designer.software in forum Qt Programming
    Replies: 1
    Last Post: 27th February 2010, 09:50
  4. Replies: 6
    Last Post: 14th May 2009, 12:02
  5. Qt system monitor?
    By khopper in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2008, 15:32

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
  •  
Qt is a trademark of The Qt Company.