diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-06-02 16:16:37 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-06-03 11:00:19 (GMT) |
commit | 259b65c2f5d736dd7f6d81b6390f54464dd5f183 (patch) | |
tree | 418962f9d87bfee08e0df78934c240232c9b679c /demos/qtdemo | |
parent | ae5b1555676cef4058157431c3af2e7ff9ead8ce (diff) | |
download | Qt-259b65c2f5d736dd7f6d81b6390f54464dd5f183.zip Qt-259b65c2f5d736dd7f6d81b6390f54464dd5f183.tar.gz Qt-259b65c2f5d736dd7f6d81b6390f54464dd5f183.tar.bz2 |
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')
-rw-r--r-- | demos/qtdemo/colors.cpp | 2 | ||||
-rw-r--r-- | demos/qtdemo/mainwindow.cpp | 13 |
2 files changed, 3 insertions, 12 deletions
diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp index 41bbfb3..883b0fb 100644 --- a/demos/qtdemo/colors.cpp +++ b/demos/qtdemo/colors.cpp @@ -97,7 +97,7 @@ bool Colors::noTickerMorph = false; bool Colors::adapted = false; bool Colors::verbose = false; bool Colors::pause = true; -int Colors::fps = 100; +int Colors::fps = 60; int Colors::menuCount = 18; float Colors::animSpeed = 1.0; float Colors::animSpeedButtons = 1.0; diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp index 8723823..16ca95f 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); } |