mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 12:40:43 +00:00
QScrollArea Timer Hack #2
This commit is contained in:
parent
ff815b45ad
commit
3f207fcb37
16
daily.cpp
16
daily.cpp
@ -32,7 +32,8 @@ const int default_height=150;
|
|||||||
MyScrollArea::MyScrollArea(QWidget *parent, Daily * daily)
|
MyScrollArea::MyScrollArea(QWidget *parent, Daily * daily)
|
||||||
:QScrollArea(parent),m_daily(daily)
|
:QScrollArea(parent),m_daily(daily)
|
||||||
{
|
{
|
||||||
timer=new QTimer(parent);
|
timer=new QTimer(this);
|
||||||
|
m_time.start();
|
||||||
}
|
}
|
||||||
MyScrollArea::~MyScrollArea()
|
MyScrollArea::~MyScrollArea()
|
||||||
{
|
{
|
||||||
@ -44,13 +45,22 @@ void MyScrollArea::scrollContentsBy(int dx, int dy)
|
|||||||
|
|
||||||
//#ifdef Q_WS_MAC || Q_WS_WIN
|
//#ifdef Q_WS_MAC || Q_WS_WIN
|
||||||
if (timer->isActive()) timer->stop();
|
if (timer->isActive()) timer->stop();
|
||||||
timer->setInterval(100);
|
|
||||||
timer->setSingleShot(true);
|
timer->setSingleShot(true);
|
||||||
connect(timer,SIGNAL(timeout()),SLOT(RedrawGraphs()));
|
timer->setInterval(200);
|
||||||
|
connect(timer,SIGNAL(timeout()),SLOT(UpdateGraphs()));
|
||||||
timer->start();
|
timer->start();
|
||||||
|
m_time.start();
|
||||||
//m_daily->RedrawGraphs();
|
//m_daily->RedrawGraphs();
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
void MyScrollArea::UpdateGraphs()
|
||||||
|
{
|
||||||
|
if (m_time.elapsed()<200)
|
||||||
|
return;
|
||||||
|
m_time.start();
|
||||||
|
//qDebug() << "Foo!";
|
||||||
|
m_daily->RedrawGraphs();
|
||||||
|
}
|
||||||
|
|
||||||
Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
||||||
:QWidget(parent),mainwin(mw), ui(new Ui::Daily)
|
:QWidget(parent),mainwin(mw), ui(new Ui::Daily)
|
||||||
|
8
daily.h
8
daily.h
@ -29,13 +29,18 @@ namespace Ui {
|
|||||||
class Daily;
|
class Daily;
|
||||||
class MyScrollArea:public QScrollArea
|
class MyScrollArea:public QScrollArea
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MyScrollArea(QWidget * parent, Daily * daily);
|
MyScrollArea(QWidget * parent, Daily * daily);
|
||||||
virtual ~MyScrollArea();
|
virtual ~MyScrollArea();
|
||||||
|
protected slots:
|
||||||
|
void UpdateGraphs();
|
||||||
protected:
|
protected:
|
||||||
virtual void scrollContentsBy(int dx, int dy);
|
virtual void scrollContentsBy(int dx, int dy);
|
||||||
|
|
||||||
Daily *m_daily;
|
Daily *m_daily;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
|
QTime m_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@ -49,9 +54,8 @@ public:
|
|||||||
void ReloadGraphs();
|
void ReloadGraphs();
|
||||||
void ResetGraphLayout();
|
void ResetGraphLayout();
|
||||||
QGLWidget *SharedWidget() { return SF; }
|
QGLWidget *SharedWidget() { return SF; }
|
||||||
|
|
||||||
public slots:
|
|
||||||
void RedrawGraphs();
|
void RedrawGraphs();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_calendar_currentPageChanged(int year, int month);
|
void on_calendar_currentPageChanged(int year, int month);
|
||||||
|
Loading…
Reference in New Issue
Block a user