Avoid duplicate draw messages.

This commit is contained in:
leo 2014-09-14 22:41:22 +00:00
parent d95d0ac68a
commit 08631abe78
2 changed files with 7 additions and 2 deletions

View file

@ -20,9 +20,9 @@ void lcGLWidget::MakeCurrent()
void lcGLWidget::Redraw() void lcGLWidget::Redraw()
{ {
QGLWidget* Widget = (QGLWidget*)mWidget; lcQGLWidget* Widget = (lcQGLWidget*)mWidget;
QTimer::singleShot(0, Widget, SLOT(updateGL())); Widget->mUpdateTimer.start(0);
} }
void* lcGLWidget::GetExtensionAddress(const char* FunctionName) void* lcGLWidget::GetExtensionAddress(const char* FunctionName)
@ -119,6 +119,9 @@ lcQGLWidget::lcQGLWidget(QWidget *parent, lcQGLWidget *share, lcGLWidget *owner,
widget = owner; widget = owner;
widget->mWidget = this; widget->mWidget = this;
mUpdateTimer.setSingleShot(true);
connect(&mUpdateTimer, SIGNAL(timeout()), this, SLOT(updateGL()));
widget->MakeCurrent(); widget->MakeCurrent();
GL_InitializeSharedExtensions(widget); GL_InitializeSharedExtensions(widget);
widget->OnInitialUpdate(); widget->OnInitialUpdate();

View file

@ -25,6 +25,8 @@ public:
#endif #endif
} }
QTimer mUpdateTimer;
protected: protected:
void initializeGL(); void initializeGL();
void resizeGL(int x, int h); void resizeGL(int x, int h);