2009-11-17 07:45:06 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QWidget>
|
|
|
|
#include "mainpage.h"
|
|
|
|
|
|
|
|
// This class implement a basic RS functionality which is that widgets displayign info
|
|
|
|
// should update regularly. They also should update only when visible, to save CPU time.
|
|
|
|
//
|
|
|
|
// Using this class simply needs to derive your widget from RsAutoUpdateWidget
|
|
|
|
// and oveload the update() function with the actual code that updates the
|
|
|
|
// widget.
|
|
|
|
//
|
|
|
|
class QTimer ;
|
|
|
|
|
|
|
|
class RsAutoUpdatePage: public MainPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
RsAutoUpdatePage(int ms_update_period = 1000,QWidget *parent=NULL) ;
|
|
|
|
|
|
|
|
virtual void updateDisplay() {}
|
2010-04-19 17:50:03 -04:00
|
|
|
|
|
|
|
static void lockAllEvents() ;
|
|
|
|
static void unlockAllEvents() ;
|
|
|
|
static bool eventsLocked() ;
|
2009-11-17 07:45:06 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *e) ;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void timerUpdate() ;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QTimer *_timer ;
|
2010-04-19 17:50:03 -04:00
|
|
|
|
|
|
|
static bool _locked ;
|
2009-11-17 07:45:06 -05:00
|
|
|
};
|
2010-04-19 17:50:03 -04:00
|
|
|
|