Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
projetcppqt
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
Durand Ulysse
projetcppqt
Commits
b166a730
Commit
b166a730
authored
1 month ago
by
Ulysse Durand
Browse files
Options
Downloads
Patches
Plain Diff
Ça marche:
parent
0a3fa25b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
motus/jeu.cpp
+1
-4
1 addition, 4 deletions
motus/jeu.cpp
motus/jeu.h
+1
-1
1 addition, 1 deletion
motus/jeu.h
motus/lettermodel.cpp
+3
-4
3 additions, 4 deletions
motus/lettermodel.cpp
motus/lettermodel.h
+1
-1
1 addition, 1 deletion
motus/lettermodel.h
motus/main.cpp
+4
-2
4 additions, 2 deletions
motus/main.cpp
with
10 additions
and
12 deletions
motus/jeu.cpp
+
1
−
4
View file @
b166a730
...
...
@@ -4,11 +4,8 @@
#include
<QQmlContext>
Jeu
::
Jeu
(
QQmlApplicationEngine
*
engine
,
QObject
*
parent
)
:
QObject
(
parent
),
engine
(
engine
)
{
Jeu
::
Jeu
(
QQmlApplicationEngine
*
engine
,
int
widht
,
int
height
,
QObject
*
parent
)
:
QObject
(
parent
),
width
(
width
),
height
(
height
),
engine
(
engine
)
{
brain
=
new
Brain
(
"./"
);
width
=
10
;
height
=
7
;
}
int
Jeu
::
getWidth
()
{
return
width
;}
...
...
This diff is collapsed.
Click to expand it.
motus/jeu.h
+
1
−
1
View file @
b166a730
...
...
@@ -14,7 +14,7 @@ class Jeu : public QObject {
Q_PROPERTY
(
QQuickItem
*
gameWindow
READ
getGameWindow
NOTIFY
gameWindowChanged
)
public:
explicit
Jeu
(
QQmlApplicationEngine
*
engine
,
QObject
*
parent
=
nullptr
);
explicit
Jeu
(
QQmlApplicationEngine
*
engine
,
int
width
,
int
height
,
QObject
*
parent
=
nullptr
);
QString
getMotAffiche
();
Q_INVOKABLE
void
onClavierClick
(
QString
lettre
);
Q_INVOKABLE
void
initGame
();
...
...
This diff is collapsed.
Click to expand it.
motus/lettermodel.cpp
+
3
−
4
View file @
b166a730
#include
"lettermodel.h"
LetterModel
::
LetterModel
(
QObject
*
parent
)
LetterModel
::
LetterModel
(
int
width
,
int
height
,
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{
// Initialiser 40 lettres avec "_"
m_letters
.
fill
(
"_"
,
40
);
m_states
.
fill
(
0
,
40
);
m_letters
.
fill
(
"_"
,
width
*
height
);
m_states
.
fill
(
0
,
width
*
height
);
}
int
LetterModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
...
...
This diff is collapsed.
Click to expand it.
motus/lettermodel.h
+
1
−
1
View file @
b166a730
...
...
@@ -13,7 +13,7 @@ public:
StateRole
};
explicit
LetterModel
(
QObject
*
parent
=
nullptr
);
explicit
LetterModel
(
int
width
,
int
height
,
QObject
*
parent
=
nullptr
);
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
override
;
...
...
This diff is collapsed.
Click to expand it.
motus/main.cpp
+
4
−
2
View file @
b166a730
...
...
@@ -13,9 +13,11 @@ int main(int argc, char *argv[]) {
qmlRegisterType
<
VraieCase
>
(
"motus"
,
1
,
0
,
"VraieCase"
);
int
width
=
10
;
int
height
=
8
;
// Charger l'interface utilisateur (QML)
LetterModel
letterModel
;
LetterModel
letterModel
(
width
,
height
)
;
engine
.
rootContext
()
->
setContextProperty
(
"letterModel"
,
&
letterModel
);
engine
.
loadFromModule
(
"motus"
,
"Main"
);
...
...
@@ -24,7 +26,7 @@ int main(int argc, char *argv[]) {
QQuickItem
*
parentItem
=
rootItem
;
Jeu
jeu
(
&
engine
);
Jeu
jeu
(
&
engine
,
width
,
height
);
jeu
.
setLetterModel
(
&
letterModel
);
engine
.
rootContext
()
->
setContextProperty
(
"jeu"
,
&
jeu
);
...
...
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