#include "widget.h"
{
xplayer->setText("X");
oplayer->setText("O");
grid->addWidget(btn1, 0,1);
grid->addWidget(btn2, 0,2);
grid->addWidget(btn3,0,3);
grid->addWidget(btn4,1,1);
grid->addWidget(btn5,1,2);
grid->addWidget(btn6,1,3);
grid->addWidget(btn7,2,1);
grid->addWidget(btn8,2,2);
grid->addWidget(btn9,2,3);
grid->addWidget(xplayer, 3,1);
grid->addWidget(radx1,3,2);
grid->addWidget(oplayer, 4,1);
grid->addWidget(rado2,4,2);
grid->addWidget(result,5,1);
connect(btn1, SIGNAL(clicked(bool)), this, SLOT(btn1Slot()));
connect(btn2, SIGNAL(clicked(bool)), this, SLOT(btn2Slot()));
connect(btn3, SIGNAL(clicked(bool)), this, SLOT(btn3Slot()));
connect(btn4, SIGNAL(clicked(bool)), this, SLOT(btn4Slot()));
connect(btn5, SIGNAL(clicked(bool)), this, SLOT(btn5Slot()));
connect(btn6, SIGNAL(clicked(bool)), this, SLOT(btn6Slot()));
connect(btn7, SIGNAL(clicked(bool)), this, SLOT(btn7Slot()));
connect(btn8, SIGNAL(clicked(bool)), this, SLOT(btn8Slot()));
connect(btn9, SIGNAL(clicked(bool)), this, SLOT(btn9Slot()));
connect(btn1, SIGNAL(clicked(bool)), this, SLOT(btn1oSlot()));
connect(btn2, SIGNAL(clicked(bool)), this, SLOT(btn2oSlot()));
connect(btn3, SIGNAL(clicked(bool)), this, SLOT(btn3oSlot()));
connect(btn4, SIGNAL(clicked(bool)), this, SLOT(btn4oSlot()));
connect(btn5, SIGNAL(clicked(bool)), this, SLOT(btn5oSlot()));
connect(btn6, SIGNAL(clicked(bool)), this, SLOT(btn6oSlot()));
connect(btn7, SIGNAL(clicked(bool)), this, SLOT(btn7oSlot()));
connect(btn8, SIGNAL(clicked(bool)), this, SLOT(btn8oSlot()));
connect(btn9, SIGNAL(clicked(bool)), this, SLOT(btn9oSlot()));
setLayout(grid);
}
Widget::~Widget()
{
}
void Widget::btn1Slot()
{
btn1->setText("X");
}
void Widget::btn2Slot()
{
btn2->setText("X");
}
void Widget::btn3Slot()
{
btn3->setText("X");
}
void Widget::btn4Slot()
{
btn4->setText("X");
}
void Widget::btn5Slot()
{
btn5->setText("X");
}
void Widget::btn6Slot()
{
btn6->setText("X");
}
void Widget::btn7Slot()
{
btn7->setText("X");
}
void Widget::btn8Slot()
{
btn8->setText("X");
}
void Widget::btn9Slot()
{
btn9->setText("X");
}
void Widget::btn1oSlot()
{
btn1->setText("O");
}
void Widget::btn2oSlot()
{
btn2->setText("O");
}
void Widget::btn3oSlot()
{
btn3->setText("O");
}
void Widget::btn4oSlot()
{
btn4->setText("O");
}
void Widget::btn5oSlot()
{
btn5->setText("O");
}
void Widget::btn6oSlot()
{
btn6->setText("O");
}
void Widget::btn7oSlot()
{
btn7->setText("O");
}
void Widget::btn8oSlot()
{
btn8->setText("O");
}
void Widget::btn9oSlot()
{
btn9->setText("O");
}
#include "widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
grid= new QGridLayout;
btn1= new QPushButton;
btn2= new QPushButton;
btn3= new QPushButton;
btn4= new QPushButton;
btn5= new QPushButton;
btn6= new QPushButton;
btn7= new QPushButton;
btn8= new QPushButton;
btn9= new QPushButton;
xplayer =new QLabel;
radx1= new QRadioButton;
oplayer=new QLabel;
rado2= new QRadioButton;
result= new QLabel;
xplayer->setText("X");
oplayer->setText("O");
grid->addWidget(btn1, 0,1);
grid->addWidget(btn2, 0,2);
grid->addWidget(btn3,0,3);
grid->addWidget(btn4,1,1);
grid->addWidget(btn5,1,2);
grid->addWidget(btn6,1,3);
grid->addWidget(btn7,2,1);
grid->addWidget(btn8,2,2);
grid->addWidget(btn9,2,3);
grid->addWidget(xplayer, 3,1);
grid->addWidget(radx1,3,2);
grid->addWidget(oplayer, 4,1);
grid->addWidget(rado2,4,2);
grid->addWidget(result,5,1);
connect(btn1, SIGNAL(clicked(bool)), this, SLOT(btn1Slot()));
connect(btn2, SIGNAL(clicked(bool)), this, SLOT(btn2Slot()));
connect(btn3, SIGNAL(clicked(bool)), this, SLOT(btn3Slot()));
connect(btn4, SIGNAL(clicked(bool)), this, SLOT(btn4Slot()));
connect(btn5, SIGNAL(clicked(bool)), this, SLOT(btn5Slot()));
connect(btn6, SIGNAL(clicked(bool)), this, SLOT(btn6Slot()));
connect(btn7, SIGNAL(clicked(bool)), this, SLOT(btn7Slot()));
connect(btn8, SIGNAL(clicked(bool)), this, SLOT(btn8Slot()));
connect(btn9, SIGNAL(clicked(bool)), this, SLOT(btn9Slot()));
connect(btn1, SIGNAL(clicked(bool)), this, SLOT(btn1oSlot()));
connect(btn2, SIGNAL(clicked(bool)), this, SLOT(btn2oSlot()));
connect(btn3, SIGNAL(clicked(bool)), this, SLOT(btn3oSlot()));
connect(btn4, SIGNAL(clicked(bool)), this, SLOT(btn4oSlot()));
connect(btn5, SIGNAL(clicked(bool)), this, SLOT(btn5oSlot()));
connect(btn6, SIGNAL(clicked(bool)), this, SLOT(btn6oSlot()));
connect(btn7, SIGNAL(clicked(bool)), this, SLOT(btn7oSlot()));
connect(btn8, SIGNAL(clicked(bool)), this, SLOT(btn8oSlot()));
connect(btn9, SIGNAL(clicked(bool)), this, SLOT(btn9oSlot()));
setLayout(grid);
}
Widget::~Widget()
{
}
void Widget::btn1Slot()
{
btn1->setText("X");
}
void Widget::btn2Slot()
{
btn2->setText("X");
}
void Widget::btn3Slot()
{
btn3->setText("X");
}
void Widget::btn4Slot()
{
btn4->setText("X");
}
void Widget::btn5Slot()
{
btn5->setText("X");
}
void Widget::btn6Slot()
{
btn6->setText("X");
}
void Widget::btn7Slot()
{
btn7->setText("X");
}
void Widget::btn8Slot()
{
btn8->setText("X");
}
void Widget::btn9Slot()
{
btn9->setText("X");
}
void Widget::btn1oSlot()
{
btn1->setText("O");
}
void Widget::btn2oSlot()
{
btn2->setText("O");
}
void Widget::btn3oSlot()
{
btn3->setText("O");
}
void Widget::btn4oSlot()
{
btn4->setText("O");
}
void Widget::btn5oSlot()
{
btn5->setText("O");
}
void Widget::btn6oSlot()
{
btn6->setText("O");
}
void Widget::btn7oSlot()
{
btn7->setText("O");
}
void Widget::btn8oSlot()
{
btn8->setText("O");
}
void Widget::btn9oSlot()
{
btn9->setText("O");
}
To copy to clipboard, switch view to plain text mode
Bookmarks