From edd306f681d3c53d00c0a99c68775615cc0a2d5e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 11 Nov 2009 12:56:47 +1000 Subject: Fix minehunt demo --- demos/declarative/minehunt/main.cpp | 1 + demos/declarative/minehunt/minehunt | Bin 0 -> 302213 bytes demos/declarative/minehunt/minehunt.qml | 5 +++-- demos/declarative/minehunt/test.qml | 13 +++++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100755 demos/declarative/minehunt/minehunt create mode 100644 demos/declarative/minehunt/test.qml diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 5e67cc1..895648f 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -174,6 +174,7 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags QmlContext *ctxt = canvas->rootContext(); ctxt->addDefaultObject(this); + ctxt->setContextProperty("tiles", QVariant::fromValue*>(&_tiles));//QTBUG-5675 canvas->execute(); } diff --git a/demos/declarative/minehunt/minehunt b/demos/declarative/minehunt/minehunt new file mode 100755 index 0000000..94584a9 Binary files /dev/null and b/demos/declarative/minehunt/minehunt differ diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 596e82d..ff00d83 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -107,8 +107,8 @@ Item { onPressed: { field.clickx = flipable.parent.x; field.clicky = flipable.parent.y; - row = Math.floor(index/9); - col = index - (Math.floor(index/9) * 9); + var row = Math.floor(index/9); + var col = index - (Math.floor(index/9) * 9); if (mouse.button==undefined || mouse.button==Qt.RightButton) { flag(row,col); } else { @@ -131,6 +131,7 @@ Item { anchors.verticalCenter: parent.verticalCenter } Repeater { + id: repeater model: tiles x: 1 y: 1 diff --git a/demos/declarative/minehunt/test.qml b/demos/declarative/minehunt/test.qml new file mode 100644 index 0000000..11ed182 --- /dev/null +++ b/demos/declarative/minehunt/test.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + + Image { + source: "pics/front.png" + width: 40 + height: 40 + Image { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + source: "pics/flag.png" + opacity: 1 + } + } -- cgit v0.12