Created
October 31, 2014 09:47
-
-
Save ynonp/c7a48a85c2d102250599 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mainwindow.h" | |
#include <QApplication> | |
#include <QtWidgets> | |
void createFirstRow(QVBoxLayout *top) | |
{ | |
QGroupBox *box = new QGroupBox(); | |
QPushButton *b1 = new QPushButton("One", box); | |
QPushButton *b2 = new QPushButton("Two", box); | |
QPushButton *b3 = new QPushButton("Three", box); | |
QHBoxLayout *layout = new QHBoxLayout(box); | |
layout->addWidget(b1); | |
layout->addWidget(b2); | |
layout->addWidget(b3); | |
top->addWidget(box); | |
} | |
void createSecondRow(QVBoxLayout *top) | |
{ | |
QGroupBox *box = new QGroupBox(); | |
QPushButton *b1 = new QPushButton("One", box); | |
QPushButton *b2 = new QPushButton("Two", box); | |
QPushButton *b3 = new QPushButton("Three", box); | |
QHBoxLayout *layout = new QHBoxLayout(box); | |
layout->addWidget(b1); | |
layout->addWidget(b2); | |
layout->addWidget(b3); | |
top->addWidget(box); | |
} | |
void createThirdRow(QVBoxLayout *top) | |
{ | |
QGroupBox *box = new QGroupBox(); | |
QPushButton *b1 = new QPushButton("One", box); | |
QPushButton *b2 = new QPushButton("Two", box); | |
QPushButton *b3 = new QPushButton("Three", box); | |
QHBoxLayout *layout = new QHBoxLayout(box); | |
layout->addWidget(b1); | |
layout->addWidget(b2); | |
layout->addWidget(b3); | |
top->addWidget(box); | |
} | |
void createFourthRow(QVBoxLayout *top) | |
{ | |
QGroupBox *box = new QGroupBox(); | |
QPushButton *b1 = new QPushButton("One", box); | |
QPushButton *b2 = new QPushButton("Two", box); | |
QPushButton *b3 = new QPushButton("Three", box); | |
QHBoxLayout *layout = new QHBoxLayout(box); | |
layout->addWidget(b1); | |
layout->addWidget(b2); | |
layout->addWidget(b3); | |
top->addWidget(box); | |
} | |
void createFifthRow(QVBoxLayout *top) | |
{ | |
QGroupBox *box = new QGroupBox(); | |
QPushButton *b1 = new QPushButton("One", box); | |
QPushButton *b2 = new QPushButton("Two", box); | |
QPushButton *b3 = new QPushButton("Three", box); | |
QHBoxLayout *layout = new QHBoxLayout(box); | |
layout->addWidget(b1); | |
layout->addWidget(b2); | |
layout->addWidget(b3); | |
top->addWidget(box); | |
} | |
int main(int argc, char *argv[]) | |
{ | |
QApplication a(argc, argv); | |
QWidget w; | |
QVBoxLayout *layout = new QVBoxLayout(&w); | |
createFirstRow(layout); | |
createSecondRow(layout); | |
createThirdRow(layout); | |
createFourthRow(layout); | |
createFifthRow(layout); | |
w.show(); | |
return a.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment