Commit 4e938ec7 authored by Ganesh Katrapati's avatar Ganesh Katrapati
Browse files

New code

parent 729b7812
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.7.0, 2014-09-13T20:19:55. -->
<!-- Written by QtCreator 2.7.0, 2014-09-20T12:45:32. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
......
......@@ -9,32 +9,9 @@ int main(int argc, char *argv[])
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/Example1/main.qml"));
viewer.setMaximumSize(QSize(540,600));
viewer.setPosition(QPoint(500,100));
viewer.setMaximumSize(QSize(540,740));
viewer.showExpanded();
// QQuickItem *object = viewer.rootObject();
// QObject *childObject = object->findChild<QObject*>("maincanvas");
//QQmlEngine engine = viewer.engine();
//QQmlEngine *engine = new QQmlEngine;
// QQmlComponent component(viewer.engine(), QUrl::fromLocalFile("qml/Example1/apple_object.qml"));
// QObject *apple_object = component.create();
// QQuickItem *apple_q_object = qobject_cast<QQuickItem*>(apple_object);
// apple_q_object -> setParent(childObject);
//viewer.engine() -> context() -> setContextProperty("_apple", apple_object);
// object->children() << apple_object;
return app.exec();
}
void new_method (int a) {
printf("Hello");
}
......@@ -32,15 +32,14 @@ Rectangle {
var ldensity = beakerArea.objectDensity
if (ldensity > density) {
namerecttext.text = "It floats !!"
drag.source.sinkRate = (density/ldensity) * 1000
drag.source.state = "float"
} else {
namerecttext.text = "It sinks !!"
drag.source.sinkRate = (density/ldensity) * 1000
drag.source.state = "sink"
}
drag.source.state = "moved"
}
//onEntered: maincanvas.state = Qt.new_method(1)
......@@ -81,8 +80,8 @@ Rectangle {
id: objects_grid
x: 5
y: 111
width: 140
height: 140
width: 233
height: 95
cellWidth: 70
model : Qt.createComponent("objects.qml").createObject(null);
delegate: Item {
......@@ -127,15 +126,19 @@ Rectangle {
states: [
State {
name: "moved"
PropertyChanges { target: object_image; y: y+30 }
name: "sink"
PropertyChanges { target: object_image; y: y+40 }
},
State {
name: "float"
PropertyChanges { target: object_image; y: y-20 }
}
]
transitions: Transition {
NumberAnimation { duration: object_image.sinkRate; properties: "x,y"; easing.type: Easing.InOutQuad }
NumberAnimation { duration: object_image.sinkRate + 200; properties: "x,y"; easing.type: Easing.InOutQuad }
}
}
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
......@@ -159,15 +162,11 @@ Rectangle {
height: 100
source: "scale.png"
}
DropArea {
x: 25; y: 256
clip: true
width: 100; height: 37
//onEntered: maincanvas.state = Qt.new_method(1)
Rectangle {
x: 0
......@@ -177,7 +176,7 @@ Rectangle {
border.color: "red"
visible: parent.containsDrag
}
onEntered: {
onDropped: {
namerecttext.text = qsTr("You have moved a " + drag.source.objectName)
mass_text.text = qsTr("Mass :: " + drag.source.objectMass)
......@@ -201,7 +200,7 @@ Rectangle {
border.color: "red"
visible: parent.containsDrag
}
onEntered: {
onDropped: {
namerecttext.text = qsTr("You have moved a " + drag.source.objectName)
vol_text.text = qsTr("Volume :: " + drag.source.objectVolume)
......
......@@ -16,6 +16,11 @@ ListModel {
mass : 600
volume : 343
}
ListElement {
name: "Wood Board"
image : "wboard.jpg"
mass : 100
volume : 300
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment