diff --git a/Motus/Main.qml b/Motus/Main.qml index bd86eb827dfd5a3938857c20a8fff60bc7383340..6c4ae750064da180c5e7477e12758fcd8976257c 100644 --- a/Motus/Main.qml +++ b/Motus/Main.qml @@ -14,32 +14,32 @@ Window { _case_4_1, _case_4_2, _case_4_3, _case_4_4, _case_4_5, _case_5_1, _case_5_2, _case_5_3, _case_5_4, _case_5_5, _case_6_1, _case_6_2, _case_6_3, _case_6_4, _case_6_5 - ] + ] property int indice_case: 0 property var case_focus: caseArray[0] Keys.onPressed: { - // Vérifier que l'élément qui a le focus possède la propriété _textText - if (case_focus && case_focus._textText !== undefined && /^[a-zA-Z]$/.test(event.text)) { - case_focus._textText = event.text; - indice_case += 1; - case_focus = caseArray[indice_case] - console.log("Lettre pressée :", event.text); - event.accepted = true; + // Vérifier que l'élément qui a le focus possède la propriété _textText + if (case_focus && case_focus._textText !== undefined && /^[a-zA-Z]$/.test(event.text)) { + case_focus._textText = event.text; + indice_case += 1; + case_focus = caseArray[indice_case] + console.log("Lettre pressée :", event.text); + event.accepted = true; + } + else if (event.key === Qt.Key_Backspace) { + console.log("Backspace a été pressée"); + case_focus._textText = ""; + if (indice_case != 0){ + indice_case -= 1; + case_focus = caseArray[indice_case]; } - else if (event.key === Qt.Key_Backspace) { - console.log("Backspace a été pressée"); - case_focus._textText = ""; - if (indice_case != 0){ - indice_case -= 1; - case_focus = caseArray[indice_case]; - } - // Ajoutez ici le code pour effacer le contenu ou réaliser l'action souhaitée - } + // Ajoutez ici le code pour effacer le contenu ou réaliser l'action souhaitée } + } Rectangle { id: rectangle @@ -52,8 +52,8 @@ Window { id: choosebutton anchors.top: parent.top anchors.left: parent.left - anchors.topMargin: height * 0.03 - anchors.leftMargin: width * 0.03 + anchors.topMargin: height * 0.2 + anchors.leftMargin: width * 0.2 _textText: "Générer un mot" Case { @@ -73,48 +73,15 @@ Window { } // Choix du nombre de lettres (en haut à droite) - Rectangle { - id: rectangle_combobox - width: parent.width * 0.15 - height: parent.height * 0.15 - anchors.top: parent.top - anchors.right: parent.right - anchors.topMargin: height * 0.03 - anchors.rightMargin: width * 0.03 - color: "#323232" - radius: 10 - border.color: "#ffffff" - border.width: 3 - - Column { - anchors.fill: parent - anchors.margins: 10 - spacing: 10 - - Text { - text: qsTr("Nombre de lettres / \n Number of letters") - font.pixelSize: 18 - color: "white" - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - } - - NumberLetterButton { - width: parent.width * 0.9 - height: parent.height * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - } - } - } // Fenêtre pour les langages (en dessous du bouton générer) Rectangle { id: big_rectangle_langue width: parent.width * 0.15 - height: parent.height * 0.25 + height: parent.height * 0.35 anchors.top: choosebutton.bottom anchors.left: choosebutton.left - anchors.topMargin: height * 0.03 + anchors.topMargin: height * 0.3 color: "#323232" radius: 10 border.color: "#ffffff" @@ -124,10 +91,16 @@ Window { anchors.fill: parent anchors.margins: 10 spacing: 10 + anchors.horizontalCenter: parent.horizontalCenter + + + + + Text { text: qsTr("Language/Langage") - font.pixelSize: 20 + font.pixelSize: 25 color: "white" horizontalAlignment: Text.AlignHCenter anchors.horizontalCenter: parent.horizontalCenter @@ -135,6 +108,14 @@ Window { LangageButton { _textText: "Français" + + anchors.top: parent.top + anchors.right: parent.right + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: parent.height * 0.6 + + + MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor @@ -144,6 +125,10 @@ Window { LangageButton { _textText: "English" + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: parent.height * 0.2 + MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor @@ -188,11 +173,11 @@ Window { // Clavier en bas centré Rectangle { id: rectangle1 - width: parent.width * 0.9 - height: parent.height * 0.25 + width: parent.width * 0.4 + height: parent.height * 0.28 anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter - anchors.bottomMargin: height * 0.03 + anchors.bottomMargin: height * 0.2 color: "#323232" radius: 10 border.color: "#ffffff" @@ -201,16 +186,26 @@ Window { Column { anchors.fill: parent anchors.margins: 10 - spacing: 10 + + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.topMargin: 0 + anchors.rightMargin: 0 + anchors.leftMargin: 0 + anchors.bottomMargin: 0 + + spacing: parent.width*0.04 Repeater { model: [ ["A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P"], ["Q", "S", "D", "F", "G", "H", "J", "K", "L"], - ["Entrée", "W", "X", "C", "V", "B", "N", "M", "<"] + ["↑", "W", "X", "C", "V", "B", "N", "M", "<"] ] delegate: Row { - spacing: 5 + spacing: parent.width*0.005 anchors.horizontalCenter: parent.horizontalCenter Repeater { @@ -225,14 +220,55 @@ Window { } } } + + // Timer en bas à droite + // Timer à droite du mot MOTUS + + } + + Rectangle { + id: rectangle_combobox + x: 1299 + y: 4 + width: parent.width * 0.2 + height: parent.height * 0.2 + anchors.top: parent.top + anchors.right: parent.right + anchors.topMargin: height * 1.3 + anchors.rightMargin: width * 0.6 + color: "#323232" + radius: 10 + border.color: "#ffffff" + border.width: 3 + + Text { + text: qsTr("Nombre de lettres / \n Number of letters") + font.pixelSize: 22 + color: "white" + horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + } + + NumberLetterButton { + y: 49 + width: parent.width + height: parent.height *0.5 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 16 + anchors.left: parent.left + } + } - // Timer en bas à droite MotusTimer { id: motusTimer + anchors.top: parent.top anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 10 + anchors.topMargin: parent.height * 0.07 + anchors.rightMargin: parent.width * 0.25 } + + } }