Bonjour,

Je rajoute des lignes de widgets comme ceci (avec un bouton) :

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
    def ajouter_un_mot_vocab(self) :
        '''
        '''
 
        # Dictionnaire des mots de vocabulaire    
        self.dico_vocab_mot = {}
        # Dictionnaire des définitions des mots de vocabulaire
        self.dico_vocab_def = {}
 
        # Liste pour chargement des données 
        # (écriture des textes par l'utilisateur)
        self.liste_mots_vocabulaire = []
 
        print
        print 'self.grille_3_stack_3.rowCount()', self.grille_3_stack_3.rowCount()
        print 
 
        #
        for r in range(self.grille_3_stack_3.rowCount()) :
            # Création des widgets et taille générique
            self.dico_vocab_mot[r] = QTextEdit()
            self.dico_vocab_def[r] = QTextEdit()
            self.dico_vocab_mot[r].setMaximumWidth(180)
            self.dico_vocab_mot[r].setMinimumWidth(180)
            self.dico_vocab_mot[r].setMaximumHeight(54)
            self.dico_vocab_mot[r].setMinimumHeight(54)
            self.dico_vocab_def[r].setMaximumHeight(54)
            self.dico_vocab_def[r].setMinimumHeight(54)
            print 'r', r
            # Conditions de redimensionnement
            if r > 5 :
                self.dico_vocab_mot[r].setMaximumHeight(34)
                self.dico_vocab_mot[r].setMinimumHeight(34)
                self.dico_vocab_def[r].setMaximumHeight(34)
                self.dico_vocab_def[r].setMinimumHeight(34)
            # Répartition dans la grille
            self.grille_3_stack_3.addWidget(self.dico_vocab_mot[r], r+1, 0)
            self.grille_3_stack_3.addWidget(self.dico_vocab_def[r], r+1, 1)
            # Ecriture des n°s de lignes dans la partie mots de vocabulaire
            self.grille_3_stack_3.addWidget(self.dico_vocab_mot[r].setText(str(r+1)+'. '), r+1, 0)
            # Les données sont introduites dans une liste
            self.liste_mots_vocabulaire.append([self.dico_vocab_mot[r], self.dico_vocab_def[r]])
            # =====================================================
            # Signaux
            self.dico_vocab_mot[r].textChanged.connect(self.changements_phase_3)
            self.dico_vocab_def[r].textChanged.connect(self.changements_phase_3)
            # =====================================================
 
            print 'self.dico_vocab_mot', self.dico_vocab_mot
            print 'self.dico_vocab_def', self.dico_vocab_def
 
        print self.liste_mots_vocabulaire
La suppression des lignes de widgets se fait comme ceci :

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
 
    def supprimer_un_mot_vocab(self) :
        '''
        '''
        index = len(self.liste_mots_vocabulaire)-1
        for r in reversed(range(self.grille_3_stack_3.rowCount())) :
            for c in reversed(range(self.grille_3_stack_3.columnCount())) :
                layout = self.grille_3_stack_3.itemAtPosition(r, c)
                if layout is not None :
                    layout.widget().deleteLater()
                    self.grille_3_stack_3.removeItem(layout)
                    #print "index", index
 
        self.liste_mots_vocabulaire.pop() 
        del self.dico_vocab_mot[index] 
        del self.dico_vocab_def[index] 
 
        print
        print self.dico_vocab_mot
        print self.dico_vocab_def
        print self.liste_mots_vocabulaire
        print
Tout fonctionne bien dans un 1er temps, rajout des lignes de widget (par exemple 5 lignes de widgets) puis suppression (par exemple 2 lignes de widgets), mais dès que je décide d'ajouter une ligne de nouveau (après suppression) et bien ça ne fonctionne plus bien, je me retrouve avec 6 lignes, alors que je devrais en avoir 3 (voir les copies d'écran jointes).

Nom : QStackedWidget_ajout_et_suppression_lignes_widgets_probleme_001.png
Affichages : 268
Taille : 23,4 KoNom : QStackedWidget_ajout_et_suppression_lignes_widgets_probleme_002.png
Affichages : 201
Taille : 22,6 KoNom : QStackedWidget_ajout_et_suppression_lignes_widgets_probleme_003.png
Affichages : 246
Taille : 23,9 Ko

Voilà le retour du terminal (fractionné) :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
...
 
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
 
self.grille_3_stack_3.rowCount() 1
 
r 0
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75050>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75050>]]
Ici au démarrage (à la création de la 1ère ligne, self.grille_3_stack_3.rowCount() est bien à 1.

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
self.grille_3_stack_3.rowCount() 2
 
r 0
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>}
r 1
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75218>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db752b0>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75218>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db752b0>]]
 
self.grille_3_stack_3.rowCount() 3
 
r 0
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75348>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db753e0>}
r 1
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75348>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db753e0>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>}
r 2
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75348>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db755a8>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db753e0>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75640>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75348>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db753e0>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db755a8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75640>]]
 
self.grille_3_stack_3.rowCount() 4
 
r 0
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db756d8>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75770>}
r 1
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db756d8>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75808>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75770>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db758a0>}
r 2
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db756d8>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75808>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75938>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75770>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db758a0>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db759d0>}
r 3
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db756d8>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75808>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75938>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75a68>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75770>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db758a0>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db759d0>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b00>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db756d8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75770>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75808>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db758a0>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75938>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db759d0>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75a68>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b00>]]
 
self.grille_3_stack_3.rowCount() 5
 
r 0
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>}
r 1
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>}
r 2
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>}
r 3
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db76050>}
r 4
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, 4: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db760e8>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db76050>, 4: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db76180>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db76050>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db760e8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db76180>]]
Quand les lignes sont ajoutées l'incrémentation se fait correctement (il me semble).

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
{0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>}
{0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db76050>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db76050>]]
 
{0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>}
{0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75b98>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75c30>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75cc8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75d60>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75df8>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75e90>]]
Au moment de la suppression des lignes, tout semble se passer correctement aussi (les 2 dictionnaires se vident, self.liste_mots_vocabulaire se vide aussi).

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
self.grille_3_stack_3.rowCount() 6
 
r 0
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>}
r 1
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>}
r 2
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>}
r 3
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db759d0>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75938>}
r 4
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db759d0>, 4: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75050>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75938>, 4: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75218>}
r 5
QLayout: Cannot add null widget to QGridLayout/
self.dico_vocab_mot {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db759d0>, 4: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75050>, 5: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db752b0>}
self.dico_vocab_def {0: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>, 1: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>, 2: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>, 3: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75938>, 4: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75218>, 5: <PyQt4.QtGui.QTextEdit object at 0x7fdb0db755a8>}
[[<PyQt4.QtGui.QTextEdit object at 0x7fdb0db9f510>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75f28>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75180>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db750e8>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75510>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75478>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db759d0>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75938>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db75050>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db75218>], [<PyQt4.QtGui.QTextEdit object at 0x7fdb0db752b0>, <PyQt4.QtGui.QTextEdit object at 0x7fdb0db755a8>]]
Mais ici (quand on veut ajouter de nouveau une ligne), self.grille_3_stack_3.rowCount() est à 6, alors qu'il devrait ^etre à 3, non ?

Comment dire à ce moment là qu'il doit ^etre positionné à 3 dans ce cas précis ?, comment faire pour que self.grille_3_stack_3.rowCount() se positionne correctement dans tous les cas ?

Merci d'avance.

A bient^ot.