summaryrefslogtreecommitdiffstats
path: root/demos/declarative/minehunt
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-02-18 06:05:50 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-02-18 06:05:50 (GMT)
commitc8e266aaf21f470fd45ac61244466583b503fda2 (patch)
tree694c73b774cf77c590cecdfb1b6d14fcd5052a8b /demos/declarative/minehunt
parent635b329592f26d64eeb6212b6056249b15293dcf (diff)
downloadQt-c8e266aaf21f470fd45ac61244466583b503fda2.zip
Qt-c8e266aaf21f470fd45ac61244466583b503fda2.tar.gz
Qt-c8e266aaf21f470fd45ac61244466583b503fda2.tar.bz2
QmlView API review. See QmlChanges.txt for details.
Diffstat (limited to 'demos/declarative/minehunt')
-rw-r--r--demos/declarative/minehunt/main.cpp5
-rw-r--r--demos/declarative/minehunt/minehunt.qml14
2 files changed, 8 insertions, 11 deletions
diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp
index c756e66..ac01196 100644
--- a/demos/declarative/minehunt/main.cpp
+++ b/demos/declarative/minehunt/main.cpp
@@ -167,10 +167,7 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags
canvas->setFixedSize(width, height);
vbox->addWidget(canvas);
- QFile file(fileName);
- file.open(QFile::ReadOnly);
- QString qml = file.readAll();
- canvas->setQml(qml, fileName);
+ canvas->setSource(QUrl::fromLocalFile(fileName));
QmlContext *ctxt = canvas->rootContext();
ctxt->addDefaultObject(this);
diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml
index ff00d83..033a865 100644
--- a/demos/declarative/minehunt/minehunt.qml
+++ b/demos/declarative/minehunt/minehunt.qml
@@ -31,7 +31,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
source: "pics/flag.png"
- opacity: modelData.hasFlag
+ opacity: model.hasFlag
opacity: Behavior {
NumberAnimation {
property: "opacity"
@@ -47,16 +47,16 @@ Item {
Text {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
- text: modelData.hint
+ text: model.hint
color: "white"
font.bold: true
- opacity: !modelData.hasMine && modelData.hint > 0
+ opacity: !model.hasMine && model.hint > 0
}
Image {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
source: "pics/bomb.png"
- opacity: modelData.hasMine
+ opacity: model.hasMine
}
Explosion {
id: expl
@@ -65,7 +65,7 @@ Item {
states: [
State {
name: "back"
- when: modelData.flipped
+ when: model.flipped
PropertyChanges { target: flipable; angle: 180 }
}
]
@@ -81,7 +81,7 @@ Item {
else
ret = 0;
if (ret > 0) {
- if (modelData.hasMine && modelData.flipped) {
+ if (model.hasMine && model.flipped) {
ret*3;
} else {
ret;
@@ -96,7 +96,7 @@ Item {
matchProperties: "angle"
}
ScriptAction{
- script: if(modelData.hasMine && modelData.flipped){expl.explode = true;}
+ script: if(model.hasMine && model.flipped){expl.explode = true;}
}
}
}