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
|
/////////////////////////////////////////////////////////////////
Construct_GAME_View::Construct_GAME_View()
{
}
Construct_GAME_View::Construct_GAME_View(QWidget *WidgetGV,int a) : QObject()
{
InfoGameView(WidgetGV);
Player_Buttons(WidgetGV);
}
void Construct_GAME_View::Player_Buttons(QWidget *infoPlayers)
{
playButton = new QPushButton("ENTER",infoPlayers);
playButton->setGeometry(760, 330, 240, 30);
Construct_GAME_View *test = new Construct_GAME_View();
QObject::connect(playButton, SIGNAL(clicked()),test, SLOT(EditTable()));
}
void Construct_GAME_View::InfoGameTable(QWidget *info)
{
tabInfoView = new QTabWidget(info);
tabInfoView->setGeometry(760 , 100, 240, 220);
tabInfoView->setStyleSheet(set1.Pacifique_View_Style(6));
// 2 : Créer les pages, en utilisant un widget parent pour contenir chacune des pages
//InfoPlayersSitView = new QWidget;
InfoPlayersWaitingView = new QWidget;
// 3 : Créer le contenu des pages de widgets
tableIView1 = new QTableView(InfoPlayersSitView);
Construct_InfoGameTable(tableIView1);
tableIView2 = new QTableView(InfoPlayersWaitingView);
Construct_InfoGameTable(tableIView2);
// 4 : ajouter les onglets au QTabWidget, en indiquant la page qu'ils contiennent
tabInfoView->addTab(InfoPlayersSitView, "Player Info");
tabInfoView->addTab(InfoPlayersWaitingView, "Players Waiting");
}
QTableView *Construct_GAME_View::Construct_InfoGameTable(My_Table_Model*mon_modele,QTableView*tableIView)
{
int i,j;
modele2 = new QStandardItemModel(11,2);
for(i=0;i<=10;i++){
for(j=0;j<=1 ;j++){
QStandardItem *standarditem1 = new QStandardItem(QStandardItem::UserType);
standarditem1->setText("---");
standarditem1->setTextAlignment(Qt::AlignCenter);
modele2->setItem (i, j, standarditem1);
}
}
tableIView->setShowGrid (false);
tableIView->setSelectionMode(QAbstractItemView::SingleSelection);
tableIView->setSelectionBehavior ( QAbstractItemView::SelectRows);
tableIView->setModel(modele2);
}
void Construct_GAME_View::EditTable()
{
QDialog dialog1;
QMessageBox::information(&dialog1, tr("Editable Ok"), "OKKKKK");
tableIView1->setShowGrid (true);
} |
Partager