summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-30 01:02:41 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-30 01:02:41 (GMT)
commit81b73d11e3d147f97d20af220721617bcf3c412f (patch)
treedf276c607e34a8e6c6146fc21b05762788ebe35d /demos
parent2a2d872a57d8cd913775af66f56a0250c157ee16 (diff)
parent130cf33cdc1a1f7c2a0b33fcef0ac63b8163306d (diff)
downloadQt-81b73d11e3d147f97d20af220721617bcf3c412f.zip
Qt-81b73d11e3d147f97d20af220721617bcf3c412f.tar.gz
Qt-81b73d11e3d147f97d20af220721617bcf3c412f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Some tweaks on the QML-enhanced QtDemo
Diffstat (limited to 'demos')
-rw-r--r--demos/qtdemo/menumanager.cpp25
-rw-r--r--demos/qtdemo/menumanager.h1
-rw-r--r--demos/qtdemo/qmlShell.qml1
3 files changed, 17 insertions, 10 deletions
diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp
index 9e2ba6b..a2ceb0e 100644
--- a/demos/qtdemo/menumanager.cpp
+++ b/demos/qtdemo/menumanager.cpp
@@ -378,13 +378,19 @@ void MenuManager::launchQmlExample(const QString &name)
return;
}
}
+ if(!Colors::noBlur){
+ QImage qmlBgImage(this->window->rect().size(), QImage::Format_ARGB32_Premultiplied);
+ QPainter painter(&qmlBgImage);
+ if(Colors::showFps)
+ this->window->fpsLabel->setOpacity(0);
+ this->window->render(&painter);
+ if(Colors::showFps)
+ this->window->fpsLabel->setOpacity(1.0);
+ Qt::ImageConversionFlags convFlags = Qt::AvoidDither | Qt::NoOpaqueDetection;
+ this->declarativeEngine->rootContext()->setContextProperty("bgAppPixmap", QVariant(QPixmap::fromImage(qmlBgImage, convFlags)));
+ }
- QPainter painter(qmlBgImage);
- this->window->fpsLabel->setOpacity(0);
- this->window->render(&painter);
- this->window->fpsLabel->setOpacity(1.0);
- Qt::ImageConversionFlags convFlags = Qt::AvoidDither | Qt::NoOpaqueDetection;
- this->declarativeEngine->rootContext()->setContextProperty("bgAppPixmap", QVariant(QPixmap::fromImage(*qmlBgImage, convFlags)));
+ qmlRoot->setProperty("qmlFile", QVariant(""));//unload component
qmlRoot->setProperty("show", QVariant(true));
qmlRoot->setProperty("qmlFile", QUrl::fromLocalFile(file.fileName()));
}
@@ -439,10 +445,11 @@ void MenuManager::init(MainWindow *window)
// Note that we paint the background into a static image for a theorized performance improvement when blurring
// It has not yet been determined what, if any, speed up this gives (but is left in 'cause the QML expects it now)
- this->qmlBgImage = new QImage(window->sceneRect().size().toSize(), QImage::Format_ARGB32);
- this->qmlBgImage->fill(0);
declarativeEngine->rootContext()->setContextProperty("useBlur", !Colors::noBlur);
- declarativeEngine->rootContext()->setContextProperty("bgAppPixmap", QVariant(QPixmap::fromImage(*qmlBgImage)));
+ QImage qmlBgImage(this->window->rect().size(), QImage::Format_ARGB32_Premultiplied);
+ qmlBgImage.fill(0);
+ this->declarativeEngine->rootContext()->setContextProperty("bgAppPixmap", QVariant(QPixmap::fromImage(qmlBgImage)));
+
QDeclarativeComponent component(declarativeEngine, QUrl("qrc:qml/qmlShell.qml"), this);
qmlRoot = 0;
if(component.isReady())
diff --git a/demos/qtdemo/menumanager.h b/demos/qtdemo/menumanager.h
index e90e02c..5e14204 100644
--- a/demos/qtdemo/menumanager.h
+++ b/demos/qtdemo/menumanager.h
@@ -85,7 +85,6 @@ public:
QDeclarativeEngine* declarativeEngine;
QDeclarativeItem *qmlRoot;
- QImage *qmlBgImage;
private slots:
void exampleFinished();
diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml
index b9021e8..b1ee79a 100644
--- a/demos/qtdemo/qmlShell.qml
+++ b/demos/qtdemo/qmlShell.qml
@@ -167,6 +167,7 @@ Item {
SequentialAnimation{
PropertyAction { target: bg; property: useBlur?"y":"opacity";}//fade in blurred background only if blurred
NumberAnimation{ properties: "opacity"; easing.type: Easing.InQuad; duration: 500}
+ PropertyAction { target: loader; property: "focus"; value: true}//Might be needed to ensure the focus stays with us
}
}
]