So,I'm making a Tic Tac Toe game and I'd like to put my buttons,like: 3 rows of 3 buttons.
So far I have this:
Qt Code:
  1. win = new QWidget;
  2. btn[0] = new QPushButton(this);
  3. btn[1] = new QPushButton(this);
  4. btn[2] = new QPushButton(this);
  5. btn[3] = new QPushButton(this);
  6. btn[4] = new QPushButton(this);
  7. btn[5] = new QPushButton(this);
  8. btn[6] = new QPushButton(this);
  9. btn[7] = new QPushButton(this);
  10. btn[8] = new QPushButton(this);
  11. hl1 = new QHBoxLayout;
  12. hl2 = new QHBoxLayout;
  13. hl3 = new QHBoxLayout;
  14. vl1 = new QVBoxLayout;
  15.  
  16. hl1->addWidget(btn[0]);
  17. hl1->addWidget(btn[1]);
  18. hl1->addWidget(btn[2]);
  19.  
  20. hl2->addWidget(btn[3]);
  21. hl2->addWidget(btn[4]);
  22. hl2->addWidget(btn[5]);
  23.  
  24. hl3->addWidget(btn[6]);
  25. hl3->addWidget(btn[7]);
  26. hl3->addWidget(btn[8]);
  27.  
  28. vl1->addLayout(hl1);
  29. vl1->addLayout(hl2);
  30. vl1->addLayout(hl3);
  31.  
  32.  
  33. win->setLayout(vl1);
  34. TicTacToe::setCentralWidget(win);
To copy to clipboard, switch view to plain text mode 

But buttons here have the normal size..how can I make then be square?

Thank you.