import Qt 4.6 Rectangle { id: root width: 800; height: 480 property int coffee_count: 0 property int coffee_total: 12 function add_one() { if (coffee_count < coffee_total) { root.coffee_count += 1, counter_toGo.state = "add_count", counter_cupsDown.state = "add_count", cup.state = "less_one", tray.add_cup(coffee_count) } } function remove_one() { if (coffee_count > 0) { root.coffee_count -= 1, counter_toGo.state = "remove_count", counter_cupsDown.state = "remove_count", tray.remove_cup(coffee_count) } } Image { source: "images/bg.png" } Taskbar { anchors.top: root.top } Counter_toGo { id: counter_toGo x: 130; y: 120; } Counter_cupsDown { id: counter_cupsDown x: 260; y: 86; } Text { id: toGo; y: 120; x: 345; text: "to go"; font.pixelSize: 100; font.letterSpacing: 90; color: "#FFF" } Text { id: cupsDown y: 86; x: 390; text: "cups down"; font.pixelSize: 50; font.letterSpacing: 90; color: "#999" } Tray { id: tray x: 335; y: 280; } Tray_model{ id: traymodel } Cup { id: cup x: 175; y: 0; } Add { id: add_btn x: -7; y: 200 onAddClicked: add_one() } Remove { id: remove_btn x: 619; y: 200 onRemoveClicked: remove_one() } }