Results 1 to 3 of 3

Thread: refreshtest example: newbie understanding problems

  1. #1
    Join Date
    Dec 2011
    Location
    Jena, Germany
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default refreshtest example: newbie understanding problems

    Hello everyone - thx for reading!

    I am working on a plot for an ad-converter. Because I'm new to C++, Qt and Qwt, I am currently studying the refreshtest example to get a clue of how to implement the plot. I think I get most of the code, but the following is not clear to me:

    When and by what are these functions called:

    Qt Code:
    1. QPointF CircularBuffer::sample(size_t i) const
    2. {
    3. const int size = d_values.size();
    4.  
    5. int index = d_startIndex + i;
    6. if ( index >= size )
    7. index -= size;
    8.  
    9. const double x = i * d_step - d_offset - d_interval;
    10. const double y = d_values.data()[index];
    11.  
    12. return QPointF(x, y);
    13. }
    14.  
    15. QRectF CircularBuffer::boundingRect() const
    16. {
    17. return QRectF(-1.0, -d_interval, 2.0, d_interval);
    18. }
    To copy to clipboard, switch view to plain text mode 

    Since this is the Qwt forum, I desisted from posting the whole code of the example. I hope thats fine.


    Looking forward for your help!
    Emi

  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: refreshtest example: newbie understanding problems

    Like the name of the class indicates this is a circular buffer with fixed samples, where the start index gets modified by time. It is only for the example - nothing you need to spend your time with.

    All you you should have understood is that you can assign arrays of points to a curve or implement a bridge ( like CircularBuffer ) that reads the points from however you need to store your points.

    Uwe

  3. #3
    Join Date
    Dec 2011
    Location
    Jena, Germany
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: refreshtest example: newbie understanding problems

    Thanks Uwe!

    Quote Originally Posted by Uwe View Post
    Like the name of the class indicates this is a circular buffer with fixed samples, where the start index gets modified by time. It is only for the example - nothing you need to spend your time with.
    Ok, I think I got this roughly. But for a general understanding it would be nice to know how and when these functions are called. I can't find anything in the code which triggers CircularBuffer::sample(). But if I add qDebug("bla") to the function, I see it is called regularly. Maybe this is basic knowledge, which I didn't stumble over yet!?

    I know this might be a question for the newbie forum, but in my first thread about Qwt I was asked to post here next time.

    Thank you for your help,
    Emi

Similar Threads

  1. Replies: 2
    Last Post: 25th October 2011, 17:34
  2. Newbie signal-slot problems in a tcp server-client app
    By neoclaw in forum Qt Programming
    Replies: 2
    Last Post: 31st May 2010, 10:00
  3. Replies: 1
    Last Post: 25th January 2010, 10:12
  4. Newbie Mac OS X problems
    By Vnuce in forum Newbie
    Replies: 9
    Last Post: 22nd October 2009, 14:48
  5. Problems understanding QGraphicsScene
    By Bocki in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2008, 12:43

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.