QBoxLayout composition
-
One of widgets (playground) is invisible:
@ QHBoxLayout *colLayout = new QHBoxLayout;
colLayout->addWidget(colLabel);
colLayout->addWidget(colSlider);
colLayout->addWidget(colSpinBox);QHBoxLayout *rowLayout = new QHBoxLayout; rowLayout->addWidget(rowLabel); rowLayout->addWidget(rowSlider); rowLayout->addWidget(rowSpinBox); QHBoxLayout *genIntevalLayout = new QHBoxLayout; genIntevalLayout->addWidget(genIntervalSlider); genIntevalLayout->addWidget(genIntervalLineEdit); QVBoxLayout *editLayout = new QVBoxLayout; editLayout->addWidget(sizeLabel, 0, Qt::AlignCenter); editLayout->addLayout(colLayout); editLayout->addLayout(rowLayout); editLayout->addWidget(genIntervalLabel, 0, Qt::AlignCenter); editLayout->addLayout(genIntevalLayout); editLayout->addStretch(); editLayout->addLayout(buttonLayout); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addWidget(playground); mainLayout->addLayout(editLayout); QWidget *mainWidget = new QWidget; mainWidget->setLayout(mainLayout); setCentralWidget(mainWidget);
@
Please tell me, where is my mistake.
-
it's widget's son
here is the code:
@class Playground : public QWidget {
Q_OBJECTpublic:
Playground();
int cols(){return colCount;}
int rows(){return rowCount;}
private:
int colCount;
int rowCount;
int interval;
bool **table;
QColor lineColor;
QColor rectColor;
QTimer *timer;void paintEvent(QPaintEvent *); void mousePressEvent(QMouseEvent *event); void drawTable(QPainter &painter); void drawWorld(QPainter &painter);
private slots:
void newGeneration();
void startGame();
void pauseGame();
void resetGame();
signals:
void gameOver();
public:
bool isActive();
};@