Commit 603b94b5 authored by vikram's avatar vikram
Browse files

improving icon look.

parent d744745c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.1.2, 2014-10-20T16:41:39. -->
<!-- Written by QtCreator 3.1.2, 2014-10-22T11:48:12. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
......
......@@ -15,8 +15,8 @@ Item {
source: "images/background.jpeg"
}
property int firstRowHeight: mainWin.height/7
property int secondRowHeight: (mainWin.height - firstRowHeight)/1.1
property int firstRowHeight: mainWin.height/15
property int secondRowHeight: (mainWin.height - 2*firstRowHeight)/1.1
/*first row, only one column*/
ObjectCollectionWin {
......@@ -30,6 +30,19 @@ Item {
}
z:2
}
//invisible height after the object grid
Rectangle {
id: emptyAreaBelowObjs
visible : false
height : firstRowHeight
width: mainWin.width
anchors {
top: objectArea.bottom
left: objectArea.left
}
z:2
}
/*second row, first column*/
WeightWin {
......@@ -39,7 +52,7 @@ Item {
anchors {
left: mainWin.left
top: objectArea.bottom
top: emptyAreaBelowObjs.bottom
}
}
......@@ -62,7 +75,7 @@ Item {
width: mainWin.width/2
anchors {
left: volArea.right
top: objectArea.bottom
top: emptyAreaBelowObjs.bottom
}
}
......
import QtQuick 2.0
Flickable {
Item {
id : objectCollWin
topMargin: objectCollWin.height*0.03
leftMargin: objectCollWin.width*0.01
z : 5
anchors {
topMargin: objectCollWin.height * 0.1
}
ObjectList{
id : objList
}
z : 5
Grid {
id : objGrid
property bool dragEnabled : true
......@@ -15,15 +18,15 @@ Flickable {
columns: 12
spacing: 5
property int cellWidth : (objectCollWin.width-(spacing*columns))/columns
property int cellHeight: (objectCollWin.height-(spacing*columns))/rows
property int cellWidth : objectCollWin.width/columns
property int cellHeight: objectCollWin.height/rows
Repeater {
model: objGrid.rows * objGrid.columns
ObjImage {
width: objGrid.cellWidth
height: objGrid.cellHeight
width: objGrid.cellWidth - objList.getHorizontalSpacing(index, 5)
height: objGrid.cellHeight - objList.getVerticalSpacing(index, 5)
imgSource : objList.getSource(index, "")
imgName : objList.getName(index, "")
......@@ -49,12 +52,13 @@ Flickable {
id : dropArea
anchors{
fill : parent
fill : objectCollWin
}
onDropped: {
reset(drag.source)
}
}
function reset(imageObject) {
objGrid.enableDragging()
......
......@@ -4,55 +4,87 @@ import QtQuick 2.0
Item {
property list<Rectangle> objPropertiesList: [
//left empty cell for easy dragging of first object
Rectangle { property string imgSource: "";
property string imgName: "";
property double weight: 00.00
property double density: 1.00
property int horizontalSpacing: 0
property int verticalSpacing: 0
},
Rectangle { property string imgSource: "images/iron-ball.png";
property string imgName: "Iron Ball";
property double weight: 100.00
property double density: 7.86
property int horizontalSpacing: 20
property int verticalSpacing: 10
},
Rectangle { property string imgSource: "images/golf-ball.png";
property string imgName: "Golf Ball";
property double weight: 40.96
property double density: 1.15
property int horizontalSpacing: 20
property int verticalSpacing: 10
},
Rectangle { property string imgSource: "images/cotton-ball.png";
property string imgName: "Cotton Ball";
property double weight: 70.00
property double density: 1.54
property int horizontalSpacing: 12
property int verticalSpacing: 12
},
Rectangle { property string imgSource: "images/pingpong-ball.png";
property string imgName: "Pingpong Ball";
property double weight: 2.413
property double density: 0.084
property int horizontalSpacing: 20
property int verticalSpacing: 10
},
Rectangle { property string imgSource: "images/gold-nugget.png";
property string imgName: "Gold Nugget";
property double weight: 500.00
property double density: 19.30
property int horizontalSpacing: 5
property int verticalSpacing: 7
},
Rectangle { property string imgSource: "images/egg.png";
property string imgName: "Egg";
property double weight: 58
property double density: 1.094
property int horizontalSpacing: 40
property int verticalSpacing: 5
},
Rectangle { property string imgSource: "images/wooden-block.png";
property string imgName: "Wooden Block";
property double weight: 45.00
property double density: 0.8
property int horizontalSpacing: 20
property int verticalSpacing: 5
},
Rectangle { property string imgSource: "images/apple-slice.png";
property string imgName: "Apple Slice";
property double weight: 50.00
property double density: 0.86
property int horizontalSpacing: 10
property int verticalSpacing: 5
},
Rectangle { property string imgSource: "images/golden-crown.png";
property string imgName: "Golden Crown";
property double weight: 110.00
property double density: 11
property int horizontalSpacing: 5
property int verticalSpacing: 5
},
Rectangle { property string imgSource: "images/coin.png";
property string imgName: "coin";
property double weight: 2.5
property double density: 7.18
property int horizontalSpacing: 10
property int verticalSpacing: 5
}
]
......@@ -88,6 +120,23 @@ import QtQuick 2.0
}
}
function getHorizontalSpacing(index, defaultValue) {
if(index < objPropertiesList.length ) {
return objPropertiesList[index].horizontalSpacing
}else{
return defaultValue
}
}
function getVerticalSpacing(index, defaultValue) {
if(index < objPropertiesList.length ) {
return objPropertiesList[index].verticalSpacing
}else{
return defaultValue
}
}
function validIndex(index) {
if(index < objPropertiesList.length ) {
return true
......
......@@ -28,6 +28,7 @@ Item {
}
onDropped: {
drag.source.opacity = 1
droppedObject = drag.source
droppedObject.changePosition(droppedObject.x, droppedObject.y + (height - drag.y) - droppedObject.height)
droppedObject.setState("inWeight")
......@@ -36,6 +37,14 @@ Item {
setImageObject(droppedObject)
setWeight(droppedObject.weight)
}
onEntered: {
drag.source.opacity = 0.5
}
onExited: {
drag.source.opacity = 1
}
}
......
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