Warning, /education/gcompris/src/activities/guesscount/Tile.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - Tile.qml
0002  *
0003  * SPDX-FileCopyrightText: 2016 RAHUL YADAV <rahulyadav170923@gmail.com>
0004  *
0005  * Authors:
0006  *   Pascal Georges <pascal.georges1@free.fr> (GTK+ version)
0007  *   RAHUL YADAV <rahulyadav170923@gmail.com> (Qt Quick port)
0008  *
0009  *   SPDX-License-Identifier: GPL-3.0-or-later
0010  */
0011 import QtQuick 2.12
0012 import "guesscount.js" as Activity
0013 import "../../core"
0014 
0015 MouseArea {
0016     id: mouseArea
0017     property alias tile: tile
0018     property alias datavalue: tile.datavalue
0019     property var reparent: root
0020     width: root.width
0021     height: root.height
0022     anchors.centerIn: parent
0023     drag.target: tile
0024     enabled: !items.solved
0025     onReleased: {
0026         parent = tile.Drag.target != null ? tile.Drag.target : root
0027         tile.Drag.drop()
0028     }
0029     onParentChanged: {
0030         if(parent.children.length>2 && root.type == "operators")
0031             mouseArea.destroy()
0032     }
0033 
0034     onClicked: {
0035         if(items.warningDialog.visible)
0036             items.warningDialog.visible = false
0037     }
0038     Rectangle {
0039         id: tile
0040         width: parent.width
0041         height: parent.height
0042         anchors.verticalCenter: parent.verticalCenter
0043         anchors.horizontalCenter: parent.horizontalCenter
0044         property var datavalue: modelData
0045         radius: 10
0046         //opacity: 0.7
0047         //color: root.type == "operators" ? "red" : "green"
0048         color: "#E8E8E8"
0049         Drag.keys: [ type ]
0050         Drag.active: mouseArea.drag.active
0051         Drag.hotSpot.x: parent.width/2
0052         Drag.hotSpot.y: parent.height/2
0053         
0054         Rectangle {
0055             id: typeLine
0056             width: parent.width - anchors.margins
0057             height: parent.height - anchors.margins
0058             anchors.verticalCenter: parent.verticalCenter
0059             anchors.horizontalCenter: parent.horizontalCenter
0060             anchors.margins: parent.height/8
0061             radius: 10
0062             color: root.type == "operators" ? "#E16F6F" : "#75D21B" // red or green
0063         }
0064         
0065         Rectangle {
0066             id: insideFill
0067             width: parent.width - anchors.margins
0068             height: parent.height - anchors.margins
0069             anchors.verticalCenter: parent.verticalCenter
0070             anchors.horizontalCenter: parent.horizontalCenter
0071             anchors.margins: parent.height/4
0072             radius: 10
0073             color: "#E8E8E8" //paper white
0074         }
0075         
0076         
0077         GCText {
0078             anchors.horizontalCenter: parent.horizontalCenter
0079             anchors.verticalCenter: parent.verticalCenter
0080             text: modelData
0081             fontSize: mediumSize
0082         }
0083         states: [
0084             State {
0085                 when: mouseArea.drag.active
0086                 ParentChange { target: tile; parent: root }
0087                 AnchorChanges { target: tile; anchors.verticalCenter: undefined; anchors.horizontalCenter: undefined }
0088             },
0089             State {
0090                 when: items.warningDialog.visible
0091                 PropertyChanges {
0092                     target: mouseArea
0093                     enabled: false
0094                 }
0095             }
0096         ]
0097     }
0098 }