Changeset View
Changeset View
Standalone View
Standalone View
src/activities/analog_electricity/Wire.qml
- This file was added.
1 | /* GCompris - Wire.qml | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright (C) 2019 Deepak Kumar <deepakdk2431@gmail.com> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or modify | ||||
6 | * it under the terms of the GNU General Public License as published by | ||||
7 | * the Free Software Foundation; either version 3 of the License, or | ||||
8 | * (at your option) any later version. | ||||
9 | * | ||||
10 | * This program is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
13 | * GNU General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU General Public License | ||||
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. | ||||
17 | */ | ||||
18 | import QtQuick 2.6 | ||||
19 | import GCompris 1.0 | ||||
20 | | ||||
21 | import "analog_electricity.js" as Activity | ||||
22 | | ||||
23 | Rectangle { | ||||
24 | id: wire | ||||
25 | | ||||
26 | property QtObject from | ||||
27 | property QtObject to | ||||
28 | property bool destructible | ||||
29 | | ||||
30 | height: 5 * ApplicationInfo.ratio | ||||
31 | color: from.value == 0 ? "#d21818" : "#6ce76c" | ||||
32 | radius: height / 2 | ||||
33 | transformOrigin: Item.Left | ||||
34 | | ||||
35 | MouseArea { | ||||
36 | id: mouseArea | ||||
37 | enabled: destructible | ||||
38 | width: parent.width | ||||
39 | height: parent.height * 3 | ||||
40 | anchors.centerIn: parent | ||||
41 | onPressed: { | ||||
42 | if(Activity.toolDelete) { | ||||
43 | Activity.removeWire(wire) | ||||
44 | } | ||||
45 | } | ||||
46 | } | ||||
47 | } |