Support Qt 5.
[autotroll.git] / gui / qt_main.cpp
blob5fc4ddcefeb153ab01be299a7101e55ea72fbd66
1 /****************************************************************************
2 **
3 ** Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
4 **
5 ** This file is part of the example classes of the Qt Toolkit.
6 **
7 ** This file may be used under the terms of the GNU General Public
8 ** License version 2.0 as published by the Free Software Foundation
9 ** and appearing in the file LICENSE.GPL included in the packaging of
10 ** this file. Please review the following information to ensure GNU
11 ** General Public Licensing requirements will be met:
12 ** http://www.trolltech.com/products/qt/opensource.html
14 ** If you are unsure which license is appropriate for your use, please
15 ** review the following information:
16 ** http://www.trolltech.com/products/qt/licensing.html or contact the
17 ** sales department at sales@trolltech.com.
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 ****************************************************************************/
24 #include <QApplication>
25 #include <QFont>
26 #include <QGridLayout>
27 #include <QPushButton>
28 #include <QWidget>
30 #include "lcdrange.h"
32 class MyWidget : public QWidget
34 public:
35 MyWidget(QWidget *parent = 0);
38 MyWidget::MyWidget(QWidget *parent)
39 : QWidget(parent)
41 QPushButton *quit = new QPushButton(tr("Quit"));
42 quit->setFont(QFont("Times", 18, QFont::Bold));
44 connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
46 QGridLayout *grid = new QGridLayout;
47 LCDRange *previousRange = 0;
49 for (int row = 0; row < 3; ++row) {
50 for (int column = 0; column < 3; ++column) {
51 LCDRange *lcdRange = new LCDRange;
52 grid->addWidget(lcdRange, row, column);
53 if (previousRange)
54 connect(lcdRange, SIGNAL(valueChanged(int)),
55 previousRange, SLOT(setValue(int)));
56 previousRange = lcdRange;
59 QVBoxLayout *layout = new QVBoxLayout;
60 layout->addWidget(quit);
61 layout->addLayout(grid);
62 setLayout(layout);
65 int qt_main(int argc, char *argv[])
67 QApplication app(argc, argv);
68 MyWidget widget;
69 widget.show();
70 return app.exec();