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

0001 /* GCompris - ChildWidget.qml
0002  *
0003  * SPDX-FileCopyrightText: 2016 Stefan Toncu <stefan.toncu29@gmail.com>
0004  *
0005  *   SPDX-License-Identifier: GPL-3.0-or-later
0006  */
0007 
0008 import QtQuick 2.12
0009 import GCompris 1.0
0010 
0011 WidgetOption {
0012     id: widget
0013 
0014     src: "resource/images/" + name + ".svg"
0015     availableItems: (background.easyMode) ? widget.total - widget.current : ""
0016 
0017     property int placedInChild
0018 
0019     releaseElement: function() {
0020         var newCoordinate = widget.mapToItem(background, element.x, element.y)
0021         if (background.contains(newCoordinate.x, newCoordinate.y, grid)) {
0022             if (widget.current < widget.total) {
0023                 if (widget.canDrag) {
0024                     widget.current ++
0025                     listModel.append({countS: 0, nameS: widget.name});
0026 
0027                     // set the candies already "present"
0028                     repeaterDropAreas.itemAt(listModel.count-1).candyCount.text = placedInChild
0029                     listModel.setProperty(listModel.count-1, "countS", placedInChild)
0030 
0031                     if (widget.current === widget.total) {
0032                         widget.canDrag = false
0033                         element.opacity = 0.6
0034                     }
0035                 }
0036             }
0037             else {
0038                 widget.canDrag = false
0039             }
0040         }
0041     }
0042 }