Warning, /education/gcompris/src/activities/comparator/ComparatorLine.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - ComparatorLine.qml 0002 * 0003 * SPDX-FileCopyrightText: 2022 Johnny Jazeix <jazeix@gmail.com> 0004 * 0005 * Authors: 0006 * Johnny Jazeix <jazeix@gmail.com> 0007 * Timothée Giet <animtim@gmail.com> 0008 * SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 import QtQuick 2.12 0011 import GCompris 1.0 0012 0013 Rectangle { 0014 id: comparatorLine 0015 height: items.sizeOfElement 0016 width: parent.width 0017 0018 readonly property bool currentlySelected: index === items.selectedLine 0019 0020 color: items.selectedLine == index ? "#FFFFFF" : "transparent" 0021 border.color: "#9FB8E3" 0022 border.width: items.selectedLine == index ? 4 * ApplicationInfo.ratio : 0 0023 0024 readonly property string correctAnswerImage: "qrc:/gcompris/src/core/resource/apply.svg" 0025 readonly property string wrongAnswerImage: "qrc:/gcompris/src/core/resource/cancel.svg" 0026 0027 Rectangle { 0028 id: topLine 0029 width: parent.width 0030 height: 1 * ApplicationInfo.ratio 0031 color: parent.border.color 0032 anchors.verticalCenter: parent.top 0033 anchors.horizontalCenter: parent.horizontalCenter 0034 } 0035 0036 Rectangle { 0037 id: bottomLine 0038 width: parent.width 0039 height: topLine.height 0040 color: parent.border.color 0041 anchors.verticalCenter: parent.bottom 0042 anchors.horizontalCenter: parent.horizontalCenter 0043 } 0044 0045 ComparatorText { 0046 id: leftHandSideCharDisplay 0047 anchors.right: mathSymbolDisplayText.left 0048 anchors.rightMargin: items.sizeOfElement / (30 * ApplicationInfo.ratio) 0049 anchors.left: parent.left 0050 anchors.leftMargin: 8 * ApplicationInfo.ratio 0051 text: leftHandSide 0052 } 0053 0054 ComparatorText { 0055 id: mathSymbolDisplayText 0056 anchors.horizontalCenter: parent.horizontalCenter 0057 text: symbol 0058 } 0059 0060 ComparatorText { 0061 id: rightHandSideCharDisplay 0062 anchors.left: mathSymbolDisplayText.right 0063 anchors.leftMargin: leftHandSideCharDisplay.anchors.rightMargin 0064 anchors.right: parent.right 0065 anchors.rightMargin: leftHandSideCharDisplay.anchors.leftMargin 0066 text: rightHandSide 0067 } 0068 0069 Image { 0070 visible: isValidationImageVisible 0071 sourceSize.width: items.sizeOfElement * 0.95 0072 source: isCorrectAnswer ? correctAnswerImage : wrongAnswerImage 0073 anchors { 0074 left: comparatorLine.right 0075 leftMargin: 5 0076 verticalCenter: comparatorLine.verticalCenter 0077 } 0078 } 0079 0080 MouseArea { 0081 anchors.fill: parent 0082 onClicked: { 0083 items.selectedLine = index 0084 } 0085 } 0086 }