Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Momomotus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pouchet Pierre
Momomotus
Commits
89f79863
Commit
89f79863
authored
1 month ago
by
Massies Alexandre
Browse files
Options
Downloads
Patches
Plain Diff
Orga relative fenetre réglée et ça ercit dans les cases
parent
48d49951
Loading
Loading
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Motus/CMakeLists.txt
+1
-0
1 addition, 0 deletions
Motus/CMakeLists.txt
Motus/Main.qml
+75
-90
75 additions, 90 deletions
Motus/Main.qml
Motus/qtquickcontrols2.conf
+2
-0
2 additions, 0 deletions
Motus/qtquickcontrols2.conf
with
78 additions
and
90 deletions
Motus/CMakeLists.txt
+
1
−
0
View file @
89f79863
...
...
@@ -47,6 +47,7 @@ qt_add_qml_module(appMotus
QML_FILES
QML_FILES MotusTimer.qml
QML_FILES NumberLetterButton.qml
RESOURCES qtquickcontrols2.conf
)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
...
...
This diff is collapsed.
Click to expand it.
Motus/Main.qml
+
75
−
90
View file @
89f79863
import
QtQuick
import
QtQuick
2.12
import
QtQuick
.
Window
2.12
import
QtQuick
.
Controls
2.12
// Optionnel : utilisez un style non natif pour autoriser la personnalisation
// import QtQuick.Controls.Material 2.12
Window
{
id
:
mainWindow
width
:
Screen
.
width
height
:
Screen
.
height
visible
:
true
visibility
:
Window
.
Maximized
title
:
qsTr
(
"
Motus
"
)
property
var
caseArray
:
[
_case_1_1
,
_case_1_2
,
_case_1_3
,
_case_1_4
,
_case_1_5
,
_case_2_1
,
_case_2_2
,
_case_2_3
,
_case_2_4
,
_case_2_5
,
_case_3_1
,
_case_3_2
,
_case_3_3
,
_case_3_4
,
_case_3_5
,
_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
]
// Suppression de la déclaration initiale de caseArray car _case_1_1 etc. ne sont pas définis.
property
int
indice_case
:
0
property
var
caseArray
:
[]
// sera rempli après création de la grille
property
var
case_focus
:
null
property
var
case_focus
:
caseArray
[
0
]
// L'élément Rectangle ci-dessous couvre toute la fenêtre et gère les touches
Rectangle
{
id
:
mainRect
anchors.fill
:
parent
color
:
"
#323232
"
focus
:
true
// Gestion des touches (attachée à un Item, pas à Window)
Keys.onPressed
:
{
// Vérifi
er que l'élément qui a le focus
possède la propriété _textText
// Vérifi
cation que case_focus existe et
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
;
indice_case
++
;
if
(
indice_case
<
caseArray
.
length
)
{
case_focus
=
caseArray
[
indice_case
];
}
else
if
(
event
.
key
===
Qt
.
Key_Backspace
)
{
console
.
log
(
"
Backspace a été pressée
"
);
event
.
accepted
=
true
;
}
else
if
(
event
.
key
===
Qt
.
Key_Backspace
)
{
if
(
case_focus
&&
case_focus
.
_textText
!==
undefined
)
case_focus
.
_textText
=
""
;
if
(
indice_case
!=
0
){
indice_case
-=
1
;
if
(
indice_case
>
0
)
{
indice_case
--
;
case_focus
=
caseArray
[
indice_case
];
}
// Ajoutez ici le code pour effacer le contenu ou réaliser l'action souhaitée
event
.
accepted
=
true
;
}
}
Rectangle
{
id
:
rectangle
anchors.fill
:
parent
color
:
"
#323232
"
focus
:
true
// Bouton "Générer un mot"
Choosebutton
{
id
:
choosebutton
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.topMargin
:
height
*
0.2
anchors.leftMargin
:
width
*
0.2
anchors.topMargin
:
parent
.
height
*
0.2
anchors.leftMargin
:
parent
.
width
*
0.2
_textText
:
"
Générer un mot
"
Case
{
...
...
@@ -72,8 +70,6 @@ Window {
}
}
// Choix du nombre de lettres (en haut à droite)
// Fenêtre pour les langages (en dessous du bouton générer)
Rectangle
{
id
:
big_rectangle_langue
...
...
@@ -81,7 +77,7 @@ Window {
height
:
parent
.
height
*
0.35
anchors.top
:
choosebutton
.
bottom
anchors.left
:
choosebutton
.
left
anchors.topMargin
:
height
*
0.3
anchors.topMargin
:
parent
.
height
*
0.3
color
:
"
#323232
"
radius
:
10
border.color
:
"
#ffffff
"
...
...
@@ -91,48 +87,37 @@ Window {
anchors.fill
:
parent
anchors.margins
:
10
spacing
:
10
anchors.horizontalCenter
:
parent
.
horizontalCenter
// Ne pas utiliser d'anchors conflictuels sur les enfants du Column
Text
{
text
:
qsTr
(
"
Language/Langage
"
)
font.pixelSize
:
25
color
:
"
white
"
horizontalAlignment
:
Text
.
AlignHCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
LangageButton
{
_textText
:
"
Français
"
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.topMargin
:
parent
.
height
*
0.6
// Utilisez par exemple Layout.alignment si nécessaire
MouseArea
{
anchors.fill
:
parent
cursorShape
:
Qt
.
PointingHandCursor
onClicked
:
motusGame
.
dictionnaryChoosed
=
"
Motus
\\
mots_francais.txt
"
onClicked
:
{
motusGame
.
dictionnaryChoosed
=
"
Motus
\\
mots_francais.txt
"
;
}
}
}
LangageButton
{
_textText
:
"
English
"
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.top
:
parent
.
top
anchors.topMargin
:
parent
.
height
*
0.2
MouseArea
{
anchors.fill
:
parent
cursorShape
:
Qt
.
PointingHandCursor
onClicked
:
motusGame
.
dictionnaryChoosed
=
"
Motus
\\
words_alpha.txt
"
onClicked
:
{
motusGame
.
dictionnaryChoosed
=
"
Motus
\\
words_alpha.txt
"
;
}
}
}
}
...
...
@@ -149,14 +134,14 @@ Window {
horizontalAlignment
:
Text
.
AlignHCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.top
:
parent
.
top
anchors.topMargin
:
height
*
0.2
anchors.topMargin
:
parent
.
height
*
0.2
}
// Grille de jeu
juste en dessous de MOTUS
// Grille de jeu
(les cases seront créées dynamiquement)
Grid
{
id
:
grid
anchors.top
:
_text2
.
bottom
anchors.topMargin
:
height
*
0.02
anchors.topMargin
:
parent
.
height
*
0.02
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
parent
.
width
*
0.25
height
:
parent
.
height
*
0.3
...
...
@@ -165,8 +150,26 @@ Window {
columns
:
5
Repeater
{
id
:
caseRepeater
model
:
30
delegate
:
Case
{}
delegate
:
Case
{
// Afin d'identifier chaque instance, on peut donner un objectName
objectName
:
"
caseDelegate
"
}
}
}
// Au chargement, remplir caseArray à partir des enfants de la grille
Component.onCompleted
:
{
caseArray
=
[];
for
(
var
i
=
0
;
i
<
grid
.
children
.
length
;
i
++
)
{
// On ajoute uniquement les instances générées par le Repeater
if
(
grid
.
children
[
i
].
objectName
===
"
caseDelegate
"
)
{
caseArray
.
push
(
grid
.
children
[
i
]);
}
}
if
(
caseArray
.
length
>
0
)
{
case_focus
=
caseArray
[
0
];
}
}
...
...
@@ -177,7 +180,7 @@ Window {
height
:
parent
.
height
*
0.28
anchors.bottom
:
parent
.
bottom
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.bottomMargin
:
height
*
0.2
anchors.bottomMargin
:
parent
.
height
*
0.2
color
:
"
#323232
"
radius
:
10
border.color
:
"
#ffffff
"
...
...
@@ -186,16 +189,6 @@ Window {
Column
{
anchors.fill
:
parent
anchors.margins
:
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
{
...
...
@@ -220,22 +213,17 @@ Window {
}
}
}
// Timer en bas à droite
// Timer à droite du mot MOTUS
}
// Combobox pour le nombre de lettres
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
width
:
parent
.
width
*
0.2
height
:
parent
.
height
*
0.2
anchors.topMargin
:
parent
.
height
*
0.13
anchors.rightMargin
:
parent
.
width
*
0.6
color
:
"
#323232
"
radius
:
10
border.color
:
"
#ffffff
"
...
...
@@ -256,11 +244,10 @@ Window {
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.bottom
:
parent
.
bottom
anchors.bottomMargin
:
16
anchors.left
:
parent
.
left
}
}
// Timer
MotusTimer
{
id
:
motusTimer
anchors.top
:
parent
.
top
...
...
@@ -268,7 +255,5 @@ Window {
anchors.topMargin
:
parent
.
height
*
0.07
anchors.rightMargin
:
parent
.
width
*
0.25
}
}
}
This diff is collapsed.
Click to expand it.
Motus/qtquickcontrols2.conf
0 → 100644
+
2
−
0
View file @
89f79863
[
Controls
]
Style
=
Material
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment