Warning, /education/gcompris/src/activities/simplepaint/PaintItem.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - PaintItem.qml 0002 * 0003 * SPDX-FileCopyrightText: 2014 Bruno Coudoin <bruno.coudoin@gcompris.net> 0004 * 0005 * Authors: 0006 * Christof Petig and Ingo Konrad (GTK+ version) 0007 * Bruno Coudoin <bruno.coudoin@gcompris.net> (Qt Quick port) 0008 * 0009 * SPDX-License-Identifier: GPL-3.0-or-later 0010 */ 0011 import QtQuick 2.12 0012 import "simplepaint.js" as Activity 0013 import GCompris 1.0 0014 0015 Item { 0016 id: paint 0017 property alias color: rectangle.color 0018 property int ix 0019 property int iy 0020 property int nbx 0021 property int nby 0022 property int initialX 0023 // Warning testing parent here, just to avoid an error at deletion time 0024 property int r: parent ? Math.min(Math.floor((parent.width - initialX) / nbx / 2), Math.floor((parent.height - bar.height) / nby / 2)) : 0 0025 property int offsetX: parent ? Math.floor((initialX + parent.width % (width * nbx)) / 2) : 0 0026 property int offsetY: parent ? 10 : 0 0027 x: width * ix + offsetX 0028 y: height * iy + offsetY 0029 width: r * 2 0030 height: r * 2 0031 0032 Rectangle { 0033 id: rectangle 0034 anchors.fill: parent 0035 border.width: bar.level == 1 ? 1 : 0 0036 border.color: "black" 0037 } 0038 0039 function touched() { 0040 paint.color = Activity.getColor() 0041 } 0042 }