summaryrefslogtreecommitdiffstats
path: root/demos/qtdemo/mainwindow.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-06-02 18:16:37 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-06-03 13:00:19 +0200
commit259b65c2f5d736dd7f6d81b6390f54464dd5f183 (patch)
tree418962f9d87bfee08e0df78934c240232c9b679c /demos/qtdemo/mainwindow.cpp
parentae5b1555676cef4058157431c3af2e7ff9ead8ce (diff)
BT: qt demo takes 100% of the cpu on X11
The tick timer is always active, even if the moving gree Qt logo is not visible. But the code that is supposed to pause it when the app loose the focus doesn't works if the moving Qt logo is not visible. Also the call to syncX makes Xorg takes lot of cpu. It doesn't fix the fact that the timer is still running while the green logo is not visible, but at least doesn't take the cpu anymore if qtdemo loose the focus. Task-number: 255020 Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'demos/qtdemo/mainwindow.cpp')
-rw-r--r--demos/qtdemo/mainwindow.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp
index 8723823526..16ca95fbe8 100644
--- a/demos/qtdemo/mainwindow.cpp
+++ b/demos/qtdemo/mainwindow.cpp
@@ -190,7 +190,6 @@ void MainWindow::switchTimerOnOff(bool on)
if (on && !Colors::noTimerUpdate){
this->useTimer = true;
- this->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
this->fpsTime = QTime::currentTime();
this->updateTimer.start(int(1000 / Colors::fps));
}
@@ -262,10 +261,6 @@ void MainWindow::tick()
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->tick();
- this->viewport()->update();
- if (Colors::softwareRendering)
- QApplication::syncX();
-
if (this->useTimer)
this->updateTimer.start(int(1000 / Colors::fps));
}
@@ -435,9 +430,7 @@ void MainWindow::focusInEvent(QFocusEvent *)
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->pause(false);
- int code = MenuManager::instance()->currentMenuCode;
- if (code == MenuManager::ROOT || code == MenuManager::MENU1)
- this->switchTimerOnOff(true);
+ this->switchTimerOnOff(true);
this->pausedLabel->setRecursiveVisible(false);
}
@@ -450,9 +443,7 @@ void MainWindow::focusOutEvent(QFocusEvent *)
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->pause(true);
- int code = MenuManager::instance()->currentMenuCode;
- if (code == MenuManager::ROOT || code == MenuManager::MENU1)
- this->switchTimerOnOff(false);
+ this->switchTimerOnOff(false);
this->pausedLabel->setRecursiveVisible(true);
}