#include <QApplication>
#include <QPushButton>
#include <QFont>
#include <QGridLayout>
#include
"lcdrange.h"
#include
"mywidget.h"
//MyWidget類實現部分
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
//建立quit按鈕
QPushButton *quit =
new QPushButton(tr(
"Quit"));
quit->setFont(QFont(
"Times", 18, QFont::Bold));
connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
//網格佈局
QGridLayout *grid =
new QGridLayout;
for (
int row = 0; row < 3; ++row) {
for (
int column = 0; column < 3; ++column) {
LCDRange *lcdRange =
new LCDRange;
//建立LCD+Slider
grid->addWidget(lcdRange, row, column);
}
}
QVBoxLayout *layout =
new QVBoxLayout;
layout->addWidget(quit);
layout->addLayout(grid);
//子佈局
setLayout(layout);
//設置佈局
}