Je n'arrives pas à remplir mon qtablewidget de 10x10 remplit avec le même element à des fins de tests

voici mon code :

main.cpp :
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
 
#include <QTranslator>
#include <QLocale>
#include "mycode.h"
 
int main(int argc, char *argv[])
{
 
	QApplication app(argc, argv);
 
	QString locale=QLocale::system().name().section('_',0,0);
	QTranslator translator;
	translator.load(QString("qt_")+locale,QLibraryInfo::location(QLibraryInfo::TranslationsPath));
	app.installTranslator(&translator);
 
	Mycode mycode;
 
	int largeur_ecran=QApplication::desktop()->width();
	int hauteur_ecran = QApplication::desktop()->height();
 
	mycode.setGeometry(largeur_ecran/4,hauteur_ecran/4,largeur_ecran*2/3,hauteur_ecran*2/3);
	mycode.setWindowTitle("test");
 
	mycode.show();
 
 
	return app.exec();
}
mycode.h :
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
 
#include <QApplication>
#include <QtGui>
#include <stdio.h>
#include <stdlib.h>
 
class Mycode : public QMainWindow
{
  Q_OBJECT
 
public:
QHBoxLayout* 	hboxlayout;
QTableWidgetItem *item;
QTableWidget*	tableau;
int		boucle;
 
	Mycode()
	{
	  hboxlayout=new QHBoxLayout;
	  QWidget *zonecentrale=new QWidget;
	  zonecentrale->setLayout(hboxlayout);
	  setCentralWidget(zonecentrale);
 
	  tableau=new QTableWidget();
	  tableau->setRowCount(10);
	  tableau->setColumnCount(10);
 
	  printf("test\n");
	  for (boucle=0;boucle==10;boucle++)
	  {
	    printf("boucle : %d\n",boucle);
	    item=new QTableWidgetItem();
	    item->setText("a");
	    tableau->setItem(0,boucle,item);
	  }
	  hboxlayout->addWidget(tableau);
	}
};
je pense que ma boucle for ne s’exécute pas ( pas d’affichage de boucle ) et je ne vois pas pourquoi.

Merci d'avance pour votre aide.