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

0001 /* GCompris - MoveBar.qml
0002  *
0003  * SPDX-FileCopyrightText: 2021 Harsh Kumar <hadron43@yahoo.com>
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 import QtQuick 2.12
0008 import GCompris 1.0
0009 import QtQml.Models 2.12
0010 
0011 import "path.js" as Activity
0012 
0013 Rectangle {
0014     id: moveBar
0015     color: "#55000000"
0016     border.color: "white"
0017     border.width: 4
0018     radius: ApplicationInfo.ratio * 10
0019 
0020     property double buttonWidth: Math.min(height * 0.9, width / 9)
0021     property int spacing: 0.15 * buttonWidth
0022 
0023     property alias movesGridView: movesGridView
0024 
0025     DelegateModel {
0026         id: movesDelegateModel
0027         model: movesListModel
0028         delegate:
0029         Item {
0030             id: box
0031             width: movesGridView.cellWidth
0032             height: movesGridView.cellHeight
0033             Rectangle {
0034                 width: buttonWidth
0035                 height: width
0036                 anchors.horizontalCenter: box.horizontalCenter
0037                 anchors.verticalCenter: box.verticalCenter
0038                 // orange, gray, blue
0039                 color: (active) ? "#E99E33" : (faded) ? "#B4B4B4" : "#1DB2E3"
0040                 border.color: "#F2F2F2"
0041                 border.width: (active) ? 8 : 4
0042                 radius: width / 2
0043 
0044                 Image {
0045                     source: "qrc:/gcompris/src/activities/path_encoding/resource/arrow.svg"
0046                     anchors.fill: parent
0047                     sourceSize.width: width
0048                     height: width
0049                     rotation: [Activity.Directions.RIGHT, Activity.Directions.DOWN, Activity.Directions.LEFT, Activity.Directions.UP].indexOf(direction) * 90
0050                 }
0051             }
0052         }
0053     }
0054 
0055     GridView {
0056         id: movesGridView
0057         anchors.fill: parent
0058         anchors.margins: moveBar.border.width
0059         model: movesDelegateModel
0060         clip: true
0061         cellWidth: buttonWidth + spacing
0062         cellHeight: cellWidth
0063     }
0064 }