Bonjour,
je vais essayer de faire cours concernant mon pb, et je tiens à préciser que je ne suis pas très expérimenter en Qt/Qml.
Application : sudoku
IDE: Qt Creator
Plateforme: Symbian (emulator Qt)
Alors pour représenter le sudoku j'ai donc une grille de 9 x 9 rectangles contenant chacun un TextInput (limité a 1 charactere). Je ve donc pouvoir recupérer dans un container la totalité des TextInputs, pour ensuite lancer mon alog en cpp pour verifier le sudoku.
Il me faut donc un container dans lequel je mets tous les textinputs, et qu'il soit réutilisable dans du code cpp.
Voici mon fichier contenant la page du sudoku.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125 import QtQuick 1.0 import "testjs.js" as JS import com.nokia.symbian 1.0 Page { id:root function slotRefresh() {box.width += 5; box.height += 5;} Flickable { width: parent.width height: parent.height contentWidth: sudoGrid.width contentHeight: sudoGrid.height clip: true Rectangle { id: sudoGrid width: root.width height: root.height * 2 anchors.centerIn: parent color: "yellow" Rectangle { id: top width: root.width height: root.height/5 radius: 10 gradient: Gradient { GradientStop {position: 0.0; color: "lightsteelblue"} GradientStop {position: 1.0; color: "steelblue"} } Grid { anchors.top: top.bottom anchors.topMargin: 20 anchors.horizontalCenter: parent.horizontalCenter columns: 3 rows: 3 Repeater { model:9 Rectangle { id:casetoto width: 35 * 3 height: 35 * 3 color: "green" border.color: "red" border.width: 3 Grid { anchors.fill: parent columns: 3 rows: 3 Repeater { model: 9 Rectangle { id: box width: 35 height: 35 color: "green" border.color: "red" border.width: 1 Rectangle { id : background anchors.centerIn : parent width: 35 height: 35 color : "#CCCCCC"; opacity : 0.6 radius : 4 Text { id: texteArriere anchors.fill: parent font.italic : true font.pointSize : 9 color : "black" //couleur de texte height :30 Behavior on opacity {NumberAnimation {duration: 200 }} text: " ." opacity: {zoneText.text == "" ? 1 : 0} } TextInput { id: zoneText anchors {left: parent.left; top: parent.top; topMargin: 1; leftMargin: 10;} width: parent.width - 12 height: 30 font.pointSize : 9 maximumLength: 1 activeFocusOnPress: true MouseArea { anchors.fill: parent onClicked: { zoneText.text= ""; if (!zoneText.activeFocus) { zoneText.forceActiveFocus() zoneText.openSoftwareInputPanel(); } else { zoneText.focus = false; } } onPressAndHold: zoneText.closeSoftwareInputPanel(); } } } } } } } } } } } } }
Partager