diff --git a/motus/.qtcreator/project.json b/motus/.qtcreator/project.json new file mode 100644 index 0000000000000000000000000000000000000000..6bdef878f10b1b72825baf2b675d697d7f9e6226 --- /dev/null +++ b/motus/.qtcreator/project.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://download.qt.io/official_releases/qtcreator/latest/installer_source/jsonschemas/project.json", + "files.exclude": [ + ".qtcreator/project.json.user" + ] +} diff --git a/motus/.qtcreator/project.json.user b/motus/.qtcreator/project.json.user new file mode 100644 index 0000000000000000000000000000000000000000..690183af1027f2dceed2936fc153929de6add43e --- /dev/null +++ b/motus/.qtcreator/project.json.user @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QtCreatorProject> +<!-- Written by QtCreator 15.0.1, 2025-04-11T13:41:56. --> +<qtcreator> + <data> + <variable>EnvironmentId</variable> + <value type="QByteArray">{eedf648a-fe20-4a10-9487-ab54d3ba9e5f}</value> + </data> + <data> + <variable>ProjectExplorer.Project.ActiveTarget</variable> + <value type="qlonglong">0</value> + </data> + <data> + <variable>ProjectExplorer.Project.EditorSettings</variable> + <valuemap type="QVariantMap"> + <value type="bool" key="EditorConfiguration.AutoIndent">true</value> + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> + <value type="QString" key="language">Cpp</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> + </valuemap> + </valuemap> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> + <value type="QString" key="language">QmlJS</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> + </valuemap> + </valuemap> + <value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value> + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> + <value type="int" key="EditorConfiguration.IndentSize">4</value> + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> + <value type="int" key="EditorConfiguration.LineEndingBehavior">0</value> + <value type="int" key="EditorConfiguration.MarginColumn">80</value> + <value type="bool" key="EditorConfiguration.MouseHiding">true</value> + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> + <value type="int" key="EditorConfiguration.PaddingMode">1</value> + <value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value> + <value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value> + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> + <value type="bool" key="EditorConfiguration.ShowMargin">false</value> + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">2</value> + <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> + <value type="int" key="EditorConfiguration.TabSize">8</value> + <value type="bool" key="EditorConfiguration.UseGlobal">true</value> + <value type="bool" key="EditorConfiguration.UseIndenter">false</value> + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> + <value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value> + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> + <value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value> + <value type="bool" key="EditorConfiguration.tintMarginArea">true</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.PluginSettings</variable> + <valuemap type="QVariantMap"> + <valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks"> + <value type="bool" key="AutoTest.Framework.Boost">true</value> + <value type="bool" key="AutoTest.Framework.CTest">false</value> + <value type="bool" key="AutoTest.Framework.Catch">true</value> + <value type="bool" key="AutoTest.Framework.GTest">true</value> + <value type="bool" key="AutoTest.Framework.QtQuickTest">true</value> + <value type="bool" key="AutoTest.Framework.QtTest">true</value> + </valuemap> + <value type="bool" key="AutoTest.ApplyFilter">false</value> + <valuemap type="QVariantMap" key="AutoTest.CheckStates"/> + <valuelist type="QVariantList" key="AutoTest.PathFilters"/> + <value type="int" key="AutoTest.RunAfterBuild">0</value> + <value type="bool" key="AutoTest.UseGlobal">true</value> + <valuemap type="QVariantMap" key="ClangTools"> + <value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value> + <value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value> + <value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value> + <value type="int" key="ClangTools.ParallelJobs">4</value> + <value type="bool" key="ClangTools.PreferConfigFile">true</value> + <valuelist type="QVariantList" key="ClangTools.SelectedDirs"/> + <valuelist type="QVariantList" key="ClangTools.SelectedFiles"/> + <valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/> + <value type="bool" key="ClangTools.UseGlobalSettings">true</value> + </valuemap> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.Target.0</variable> + <valuemap type="QVariantMap"> + <value type="QString" key="DeviceType">Desktop</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop (arm-darwin-generic-mach_o-32bit)</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop (arm-darwin-generic-mach_o-32bit)</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{7bea831e-d8ff-4088-9f38-39a43611ac87}</value> + <value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">-1</value> + <value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> + <value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> + <value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">0</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/> + <value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> + <value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> + <value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value> + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> + <valuelist type="QVariantList" key="CustomOutputParsers"/> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> + <value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value> + <value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> + <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value> + <value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value> + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.TargetCount</variable> + <value type="qlonglong">1</value> + </data> + <data> + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> + <value type="int">22</value> + </data> + <data> + <variable>Version</variable> + <value type="int">22</value> + </data> +</qtcreator> diff --git a/motus/Clavier.qml b/motus/Clavier.qml index 3c65c20cb5d544becb8b4152b081b060946cf666..a2f75157dd6c9e86f99903c0b95227555bc22a8e 100644 --- a/motus/Clavier.qml +++ b/motus/Clavier.qml @@ -1,268 +1,22 @@ -import QtQuick +import QtQuick 2.15 +import QtQuick.Controls 2.15 Item { - id: _item - width: 450 - height: 180 - - CaseClavierTest { - id: caseClavier - x: 0 - anchors.top: parent.top - anchors.topMargin: 0 - } - - CaseClavierTest { - id: caseClavier1 - y: 0 - anchors.left: caseClavier.right - anchors.leftMargin: 5 - _textText: qsTr("Z") - } - - CaseClavierTest { - id: caseClavier2 - y: 0 - anchors.left: caseClavier1.right - anchors.leftMargin: 5 - _textText: qsTr("E") - } - - CaseClavierTest { - id: caseClavier3 - y: 0 - anchors.left: caseClavier2.right - anchors.leftMargin: 5 - _textText: qsTr("R") - - } - - CaseClavierTest { - id: caseClavier4 - y: 0 - anchors.left: caseClavier3.right - anchors.leftMargin: 5 - _textText: qsTr("T") - } - - CaseClavierTest { - id: caseClavier5 - y: 0 - anchors.left: caseClavier4.right - anchors.leftMargin: 5 - _textText: qsTr("Y") - } - - CaseClavierTest { - id: caseClavier6 - y: 0 - anchors.left: caseClavier5.right - anchors.leftMargin: 5 - _textText: qsTr("U") - } - - CaseClavierTest { - id: caseClavier7 - y: 0 - anchors.left: caseClavier6.right - anchors.leftMargin: 5 - _textText: qsTr("I") - } - - CaseClavierTest { - id: caseClavier8 - y: 0 - anchors.left: caseClavier7.right - anchors.leftMargin: 5 - _textText: qsTr("O") - } - - CaseClavierTest { - id: caseClavier9 - y: 0 - anchors.left: caseClavier8.right - anchors.leftMargin: 5 - _textText: qsTr("P") - - } - - - CaseClavierTest { - id: caseClavier10 - x: 0 - anchors.top: caseClavier1.bottom - anchors.topMargin: 5 - _textText: qsTr("Q") - } - - CaseClavierTest { - id: caseClavier11 - anchors.left: caseClavier10.right - anchors.top: caseClavier1.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("S") - } - - CaseClavierTest { - id: caseClavier12 - anchors.left: caseClavier11.right - anchors.top: caseClavier2.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("D") - } - - CaseClavierTest { - id: caseClavier13 - anchors.left: caseClavier12.right - anchors.top: caseClavier3.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("F") - } - - CaseClavierTest { - id: caseClavier14 - anchors.left: caseClavier13.right - anchors.top: caseClavier4.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("G") + Grid { + id: keyboardGrid + columns: 10 + spacing: 5 + + property string letters: "AZERTYUIOPQSDFGHJKLMWXCVBN" + + Repeater { + model: keyboardGrid.letters.length + Button { + text: keyboardGrid.letters[index] + width: 40 + height: 40 + onClicked: jeu.onClavierClick(text) + } + } } - - CaseClavierTest { - id: caseClavier15 - anchors.left: caseClavier14.right - anchors.top: caseClavier5.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("H") - } - - CaseClavierTest { - id: caseClavier16 - anchors.left: caseClavier15.right - anchors.top: caseClavier6.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("J") - } - - CaseClavierTest { - id: caseClavier17 - anchors.left: caseClavier16.right - anchors.top: caseClavier7.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("K") - } - - CaseClavierTest { - id: caseClavier18 - anchors.left: caseClavier17.right - anchors.top: caseClavier8.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("L") - } - - CaseClavierTest { - id: caseClavier19 - anchors.left: caseClavier18.right - anchors.top: caseClavier9.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("M") - } - - CaseClavierTest { - id: caseClavier20 - x: 45 - anchors.top: caseClavier11.bottom - anchors.topMargin: 5 - _textText: qsTr(".") - } - - CaseClavierTest { - id: caseClavier21 - anchors.left: caseClavier20.right - anchors.top: caseClavier12.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("W") - - } - - CaseClavierTest { - id: caseClavier22 - anchors.left: caseClavier21.right - anchors.top: caseClavier13.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("X") - } - - CaseClavierTest { - id: caseClavier23 - anchors.left: caseClavier22.right - anchors.top: caseClavier14.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("C") - } - - CaseClavierTest { - id: caseClavier24 - anchors.left: caseClavier23.right - anchors.top: caseClavier15.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("V") - } - - CaseClavierTest { - id: caseClavier25 - anchors.left: caseClavier24.right - anchors.top: caseClavier16.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("B") - } - - CaseClavierTest { - id: caseClavier26 - anchors.left: caseClavier25.right - anchors.top: caseClavier17.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: qsTr("N") - } - - CaseClavierTest { - id: caseClavier27 - anchors.left: caseClavier26.right - anchors.top: caseClavier18.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - _textText: "" - imageSource:"assets/del.png" - - } - - CaseClavierTest { - id: caseClavier28 - anchors.left: caseClavier27.right - anchors.top: caseClavier19.bottom - anchors.leftMargin: 5 - anchors.topMargin: 5 - imageSource: "assets/enter.png" - _textText: "" - } - - - - - - } diff --git a/motus/jeu.cpp b/motus/jeu.cpp index 47e842336e820846729c9fdb400b9148f1222b5c..ab1b3eefb6ebf7ab6f0aa5970b3e9caa9f5c13dc 100644 --- a/motus/jeu.cpp +++ b/motus/jeu.cpp @@ -21,3 +21,7 @@ QString Jeu::getMotAffiche() { } return affichage; } + +void Jeu::onClavierClick(QString lettre) { + std::cout << lettre.toStdString() << " est appuyée"<< std::endl; +} diff --git a/motus/jeu.h b/motus/jeu.h index 6a765dc4ff27c744ec7bdcacce7d7ec321390d94..53c0005f17d693ce3daf0040d351265295034ddf 100644 --- a/motus/jeu.h +++ b/motus/jeu.h @@ -11,6 +11,7 @@ class Jeu : public QObject { public: explicit Jeu(QObject *parent = nullptr); QString getMotAffiche(); + Q_INVOKABLE void onClavierClick(QString lettre); signals: void motChanged();