Commit 48354a27 authored by vikram's avatar vikram
Browse files

created objects dynamically so that they can be destroyed instead of hiding in case of reset

parent 5c49f2fb
......@@ -20,7 +20,8 @@ Item {
DropArea {
id : mainWin
width: parent.width
height: parent.height
anchors{
fill: parent
}
......@@ -122,7 +123,7 @@ Item {
volArea.reset()
densityArea.reset()
if(activeImageObject !== null) {
activeImageObject.opacity = 0
activeImageObject.destroy()
}
}
......
......@@ -50,11 +50,7 @@ Item {
onPressed: {
if(objImgId.state == "inGrid") {
parentReset()
var newObj = Qt.createQmlObject( getQmlObjectString(),
objImgId.parent,
"objImgId"
);
drag.source = newObj
drag.source = getDuplicateObject()
}
}
......@@ -80,9 +76,6 @@ Item {
visible: imgText.textVisible
text : imgName
wrapMode: Text.WordWrap
}
}
......@@ -157,8 +150,8 @@ Item {
PropertyAnimation { duration: 400; }
}
function getQmlObjectString() {
var str = "import QtQuick 2.0; ObjImage { " + "\n" +
function getDuplicateObject() {
var qmlStr = "import QtQuick 2.0; ObjImage { " + "\n" +
"width: " + objImgId.width + "\n" +
"height: " + objImgId.height + "\n" +
"imgSource : \"" + objImgId.imgSource + "\"\n" +
......@@ -169,7 +162,8 @@ Item {
"x : " + x + "\n" +
"y : " + y + "\n" +
"z : " + z + "\n }" + "\n"
return str
return objImgId.parent.getNewObject(qmlStr)
}
......
......@@ -17,29 +17,37 @@ Item {
rows: 1
columns: 12
spacing: 5
property int cellWidth : objectCollWin.width/columns
property int cellHeight: objectCollWin.height/rows
Repeater {
model: objGrid.rows * objGrid.columns
ObjImage {
width: objGrid.cellWidth - objList.getHorizontalSpacing(index, 5)
height: objGrid.cellHeight - objList.getVerticalSpacing(index, 5)
imgSource : objList.getSource(index, "")
imgName : objList.getName(index, "")
weight : objList.getWeight(index, "00.00")
density: objList.getDensity(index, "00.00")
opacity : objList.validIndex(index) ? 1 : 0
}
Item {
Component.onCompleted: objGrid.getNewObject(
"import QtQuick 2.0; ObjImage { " + "\n" +
"width: " + (objGrid.cellWidth - objList.getHorizontalSpacing(index, 5)) + "\n" +
"height: " + (objGrid.cellHeight - objList.getVerticalSpacing(index, 5)) + "\n" +
"imgSource : \"" + objList.getSource(index, "") + "\"\n" +
"imgName : \"" + objList.getName(index, "") + "\"\n" +
"weight : " + objList.getWeight(index, "00.00") + "\n" +
"density: " + objList.getDensity(index, "00.00") + "\n" +
"opacity : " + (objList.validIndex(index) ? 1 : 0) + "\n" +
" }" + "\n"
)
}
}
function parentReset() {
objGrid.parent.parentReset()
}
function getNewObject(qmlDynamicObj) {
return Qt.createQmlObject( qmlDynamicObj,
objGrid,
"objImgId"
);
}
}
function parentReset() {
......
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