Results 1 to 2 of 2

Thread: Real Time Plot with Qthrea,QWidget and Qwtplot

  1. #1
    Join Date
    Apr 2011
    Macerata, Italy
    Qt products
    Unix/X11 Windows

    Default Real Time Plot with Qthrea,QWidget and Qwtplot

    Goodmorning everybody,
    I'm working on an application which aquires data from HW (Reflective Memory) and plots them in a Grafic Interface.
    What i tried is devolopping 2 Threads, the one in charge to aquire the data and the second one to plot data by means of a qwtplot. The problem is i could only exchange data between threads with SIGNAL/SLOT way but it's not so efficient.
    I've tried to inherits qwtplot from qthread and exchange data by global variables but it creates some problem of communications between threads.
    Any suggestions are welcome.

  2. #2
    Join Date
    Feb 2006
    Munich, Germany
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    MacOS X Unix/X11 Windows

    Default Re: Real Time Plot with Qthrea,QWidget and Qwtplot

    a) Introduce a mutex guarded buffer to pass the new samples from your sampling thread to your application
    b) Decouple the sampling rate and the update interval of your plot widget.

    (b) means to introduce a QTimer with a reasonable interval ( depends on the amount of data you need to display ) to check periodically if there are new samples, taking them out into some other buffer and calling replot() displaying the samples of the second buffer.

    Use Qwt 6.0 and check the oscilloscope example. Note that this example also shows how to paint incrementally, what makes the code much more difficult as for an application, that doesn't need to have very high refresh rates and can always do a full replot.


Similar Threads

  1. Replies: 5
    Last Post: 19th November 2010, 02:25
  2. QFileSystemWatcher with a Qwt Real-time plot
    By gen_mass in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2010, 21:28
  3. Replies: 6
    Last Post: 14th May 2009, 12:02
  4. Best way in Qt to plot curve per real-time reading?
    By Sheng in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2009, 22:33
  5. real time plotting
    By gyre in forum Qwt
    Replies: 4
    Last Post: 11th December 2007, 16:13

Tags for this Thread


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.