Answer the question
In order to leave comments, you need to log in
How to place components on the same form?
The bottom line is: there is a class
class GameButton : public QPushButton
{
public:
GameButton(QWidget *parent = 0) : QPushButton(parent) {}
protected:
bool player;
};
class GameButton;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
GameButton *but;
QHBoxLayout *one, *two, *three, *mainLayout;
};
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
one = new QHBoxLayout;
but = new GameButton[9];
setFixedSize(875, 444);
one->addWidget(btn);
one->addWidget(&but[0]);
one->addWidget(&but[1]);
setLayout(one);
}
Answer the question
In order to leave comments, you need to log in
Where do you work with GroupBoxes? You didn't even use them anywhere.
When placed on a Layout, all buttons open in separate windows.Have you tried to act not only by the poke method, but also read a book on Qt?
I agree with the previous speaker.
I gave you the link in my last post . Read until enlightened. Elementary things. I don't know, look at the video on YouTube or something ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question