QCustomPlot Discussion and Comments

how to setup a timer that repeatedly calls MainWindow::realtimeDataSlotReturn to overview

hi
I'm new to QT,
I'm going ti use QCustomplot real-time! when I'm using the tutorial example, I get an error in these lines!

    // setup a timer that repeatedly calls MainWindow::realtimeDataSlot:
    connect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimeDataSlot()));
    dataTimer.start(0); // Interval 0 means to refresh as fast as possible

and the error is:

C:\Users\matrix\Documents\Plotting\mainwindow.cpp:37: error: 'dataTimer' was not declared in this scope
dataTimer.start(0); // Interval 0 means to refresh as fast as possible
^

I've serched it anywhere! but no-one had this problem :(

thanks...

You have modified .h file and deleted declaration of dataTimer.
Redownload the example files or add QTimer dataTimer; in mainwindow.h private:

Thanks for your time...
I tried redownloading and replacing qcustomplot.h!
but nothing happened.
and about trying the your second solution,
I don't know how to add QTimer dataTimer; in mainwindow.h private.

thanks again

Be sure you have included the QTimer class in you mainwindow.h file like all other "includes":

#include <QTimer>

and then, in you mainwindow.h file, under private: just add:

QTimer dataTimer:

If you don't have any private section, just create it by adding :
private:
in you class definition.

Example with pseudo-code:

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
     explicit MainWindow(QWidget *parent = 0);  // Class Constructor
    ~MainWindow();                              // Class Destructor
     some other public_ variables or functions ;
     some other public_ variables or functions ;
...

private:
QTimer dataTimer;

};

Hope it helped you a bit!
Olivier