Changed: #1193 Update example plugin. Rendering should stop when the widget becomes invisible

This commit is contained in:
dnk-88 2011-03-08 19:11:47 +02:00
parent 76cf53b389
commit 30105c52ce
2 changed files with 9 additions and 7 deletions

View file

@ -122,13 +122,14 @@ void QNLWidget::updateRender()
void QNLWidget::showEvent(QShowEvent *showEvent)
{
QWidget::showEvent(showEvent);
if (isVisible())
{
m_driver->activate();
m_mainTimer->start(m_interval);
}
else
m_mainTimer->stop();
m_driver->activate();
m_mainTimer->start(m_interval);
}
void QNLWidget::hideEvent(QHideEvent *hideEvent)
{
m_mainTimer->stop();
QWidget::hideEvent(hideEvent);
}
#if defined(NL_OS_WINDOWS)

View file

@ -96,6 +96,7 @@ private Q_SLOTS:
protected:
virtual void showEvent(QShowEvent *showEvent);
virtual void hideEvent(QHideEvent *hideEvent);
#if defined(NL_OS_WINDOWS)
virtual bool winEvent(MSG *message, long *result);