Results 1 to 15 of 15

Thread: oscilloscope example,how to add a square wave on the canvas

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,324
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: oscilloscope example,how to add a square wave on the canvas

    if we use two append() methods,there is only only one signaldata class and curvedata class,how should I set the data for p_curve?
    Your SignalData::PrivateData class has *two* QPointF arrays: values and values2. You are using one of these for the sample and one of them for the model, right? appendSignal() should put a new point onto the end of values, and appendModel() should put a new point onto the end of values2. What is the problem?

    Have you made your design so complicated that you don't understand it any more?

    When I originally offered you a solution to this, I gave you another class: ModelData. You decided to combine the sample and the model into one class, SignalData, and now you are getting confused because you are using one class to hold two different things, and your design makes that class a Singleton. It is getting you into trouble, because now you can have values and values2 with different lengths, but there is only one size() member function, and that is returning the length of values. Likewise for the other member functions - they are using values, and same property for values2 might be different. If you are depending on size() to set the points into the curves, then one curve will be wrong.

  2. #2
    Join Date
    Apr 2012
    Posts
    10
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: oscilloscope example,how to add a square wave on the canvas

    thanks a lot. I have got the idea.
    I change the program with the method you told me. And I add a Plot::update2() in plot.h and plot.cpp.there are indeed two dynamic lines on the canvas now.
    I will add a screen shot function in the program later.Then I will post the photo here to share my joy with you.
    Thanks again.

  3. #3
    Join Date
    Aug 2012
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: oscilloscope example,how to add a square wave on the canvas

    Hello,I also want to add another wave,but i can't do it.I think we have the same problem.So can you give me your succeed code?Thank you!

  4. #4

    Default Re: oscilloscope example,how to add a square wave on the canvas

    Hello, I have the same problem. Can you post your code? thank you very much

Similar Threads

  1. Replies: 1
    Last Post: 11th April 2012, 08:50
  2. Oscilloscope
    By P@u1 in forum Qwt
    Replies: 1
    Last Post: 1st July 2011, 15:21
  3. QWT oscilloscope example
    By Pablo220372 in forum Qwt
    Replies: 2
    Last Post: 10th June 2011, 08:19
  4. Replies: 8
    Last Post: 2nd August 2006, 16:19

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.