diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-05-24 19:02:51 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-05-24 19:26:34 (GMT) |
commit | 3af5a362a034fe7f9085a202adfdf13252de1715 (patch) | |
tree | de73840eb45305dbc20f7185549eb163d1e900b9 /demos/qtdemo/mainwindow.cpp | |
parent | 3003f1d885e732e7cc19f73f9733aa8102b70717 (diff) | |
download | Qt-3af5a362a034fe7f9085a202adfdf13252de1715.zip Qt-3af5a362a034fe7f9085a202adfdf13252de1715.tar.gz Qt-3af5a362a034fe7f9085a202adfdf13252de1715.tar.bz2 |
Integrate some QML examples and demos into qtdemo
Includes minor changes and additions to the existing doc and examples,
so that they follow Qt conventions better.
Note that while blurring the background was part of the plan for the
embedded QML viewer I could not get it to perform well enough. In the
future, when blur is fast enough (or someone else can get it to
perform better than I) -use-blur should become the default, and
-no-blur the option.
Task-number: QTBUG-10582
Diffstat (limited to 'demos/qtdemo/mainwindow.cpp')
-rw-r--r-- | demos/qtdemo/mainwindow.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp index a679c4f..45ec9a6 100644 --- a/demos/qtdemo/mainwindow.cpp +++ b/demos/qtdemo/mainwindow.cpp @@ -270,8 +270,10 @@ void MainWindow::setupSceneItems() this->fpsLabel->setPos(Colors::stageStartX, 600 - QFontMetricsF(Colors::buttonFont()).height() - 5); } - this->companyLogo = new ImageItem(QImage(":/images/trolltech-logo.png"), 1000, 1000, this->scene, 0, true, 0.5f); - this->qtLogo = new ImageItem(QImage(":/images/qtlogo_small.png"), 1000, 1000, this->scene, 0, true, 0.5f); + this->mainSceneRoot = new QGraphicsWidget(); + this->scene->addItem(mainSceneRoot); + this->companyLogo = new ImageItem(QImage(":/images/trolltech-logo.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f); + this->qtLogo = new ImageItem(QImage(":/images/qtlogo_small.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f); this->companyLogo->setZValue(100); this->qtLogo->setZValue(100); this->pausedLabel = new DemoTextItem(QString("PAUSED"), Colors::buttonFont(), Qt::white, -1, this->scene, 0); @@ -308,6 +310,20 @@ void MainWindow::checkAdapt() qDebug() << "- benchmark adaption: removed ticker (fps < 30)"; } + //Note: Because we don't adapt later in the program, if blur makes FPS plummet then we won't catch it + if (!Colors::noBlur && MenuManager::instance()->mainSceneBlur && this->mainSceneRoot){ + Colors::noBlur = true; + this->mainSceneRoot->setGraphicsEffect(0); + MenuManager::instance()->mainSceneBlur = 0; + if(MenuManager::instance()->qmlRoot){ + MenuManager::instance()->qmlRoot->setGraphicsEffect(0); + MenuManager::instance()->declarativeEngine->rootContext()->setContextProperty("realBlur", 0); + } + MenuManager::instance()->qmlShadow = 0; + if (Colors::verbose) + qDebug() << "- benchmark adaption: removed blur (fps < 30)"; + } + if (this->fpsMedian < 20){ Colors::noAnimations = true; if (Colors::verbose) @@ -376,7 +392,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) this->loop = false; QApplication::quit(); } - else if (event->key() == Qt::Key_1){ + else if (event->key() == Qt::Key_F1){ QString s(""); s += "Rendering system: "; if (Colors::openGlRendering) @@ -415,6 +431,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) s += Colors::noScreenSync ? "no" : "yes"; QMessageBox::information(0, QString("Current configuration"), s); } + QGraphicsView::keyPressEvent(event); } void MainWindow::focusInEvent(QFocusEvent *) |