Witam,
czy jest jakiś sposób aby wywołać konstruktor Dialog::Dialog() w funkcji?
Robię Tic-Tac-Toe w Qt i chcę dodać funcje resetującą "od nowa". W jaki sposób mogę użyć kodu w konstruktora w funkcji?
ui->setupUi(this);
ui->box-blockSignals(false);
ui->box2->blockSignals(false);
ui->box3->blockSignals(false);
ui->box4->blockSignals(false);
ui->box5->blockSignals(false);
ui->box6->blockSignals(false);
ui->box7->blockSignals(false);
ui->box8->blockSignals(false);
ui->box9->blockSignals(false);
////////////////////////////////////////////
/////////ustawianie ikon x, o
////////////////////////////////////////////
pixmap[0].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[0].addPixmap(pixmap[0]);
ui->box->setIcon(ButtonIcon[0]);
ui->box->setIconSize(pixmap[0].rect().size());
// ------------------------------------------
pixmap[1].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[1].addPixmap(pixmap[1]);
ui->box2->setIcon(ButtonIcon[1]);
ui->box2->setIconSize(pixmap[1].rect().size());
// --------------------------------------------
pixmap[2].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[2].addPixmap(pixmap[2]);
ui->box3->setIcon(ButtonIcon[2]);
ui->box3->setIconSize(pixmap[2].rect().size());
//----------------------------------------------
pixmap[3].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[3].addPixmap(pixmap[3]);
ui->box4->setIcon(ButtonIcon[3]);
ui->box4->setIconSize(pixmap[3].rect().size());
//----------------------------------------------
pixmap[4].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[4].addPixmap(pixmap[4]);
ui->box5->setIcon(ButtonIcon[4]);
ui->box5->setIconSize(pixmap[4].rect().size());
// ----------------------------------------------
pixmap[5].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[5].addPixmap(pixmap[5]);
ui->box6->setIcon(ButtonIcon[5]);
ui->box6->setIconSize(pixmap[5].rect().size());
// --------------------------------------------
pixmap[6].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[6].addPixmap(pixmap[6]);
ui->box7->setIcon(ButtonIcon[6]);
ui->box7->setIconSize(pixmap[6].rect().size());
// --------------------------------------------
pixmap[7].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[7].addPixmap(pixmap[7]);
ui->box8->setIcon(ButtonIcon[7]);
ui->box8->setIconSize(pixmap[7].rect().size());
// --------------------------------------------
pixmap[8].load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/nic.bmp");
ButtonIcon[8].addPixmap(pixmap[8]);
ui->box9->setIcon(ButtonIcon[8]);
ui->box9->setIconSize(pixmap[8].rect().size());
/////////////////////////////////////////////////
//ustawienie ikonki informującej o turze gracza
m_logo_pic.load("C:/Users/HP/Documents/PROGRAMOWANIE/C++/Qt projects/TicTacToe/osmall.bmp");
ui->tura_obrazek->setPixmap(m_logo_pic);
t = 'o';
// przypisanie char'om 'n'
for(int i=0; i<9; i++)
boxs_char[i] = 'n';
}