|
Last change
on this file since 94 was 2, checked in by dmik, 20 years ago |
|
Imported xplatform parts of the official release 3.3.1 from Trolltech
|
-
Property svn:keywords
set to
Id
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | /****************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Qt tutorial 7
|
|---|
| 4 | **
|
|---|
| 5 | ****************************************************************/
|
|---|
| 6 |
|
|---|
| 7 | #include <qapplication.h>
|
|---|
| 8 | #include <qpushbutton.h>
|
|---|
| 9 | #include <qlcdnumber.h>
|
|---|
| 10 | #include <qfont.h>
|
|---|
| 11 | #include <qvbox.h>
|
|---|
| 12 | #include <qgrid.h>
|
|---|
| 13 |
|
|---|
| 14 | #include "lcdrange.h"
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | class MyWidget : public QVBox
|
|---|
| 18 | {
|
|---|
| 19 | public:
|
|---|
| 20 | MyWidget( QWidget *parent=0, const char *name=0 );
|
|---|
| 21 | };
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | MyWidget::MyWidget( QWidget *parent, const char *name )
|
|---|
| 25 | : QVBox( parent, name )
|
|---|
| 26 | {
|
|---|
| 27 | QPushButton *quit = new QPushButton( "Quit", this, "quit" );
|
|---|
| 28 | quit->setFont( QFont( "Times", 18, QFont::Bold ) );
|
|---|
| 29 |
|
|---|
| 30 | connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
|
|---|
| 31 |
|
|---|
| 32 | QGrid *grid = new QGrid( 4, this );
|
|---|
| 33 |
|
|---|
| 34 | LCDRange *previous = 0;
|
|---|
| 35 | for( int r = 0 ; r < 4 ; r++ ) {
|
|---|
| 36 | for( int c = 0 ; c < 4 ; c++ ) {
|
|---|
| 37 | LCDRange* lr = new LCDRange( grid );
|
|---|
| 38 | if ( previous )
|
|---|
| 39 | connect( lr, SIGNAL(valueChanged(int)),
|
|---|
| 40 | previous, SLOT(setValue(int)) );
|
|---|
| 41 | previous = lr;
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | int main( int argc, char **argv )
|
|---|
| 48 | {
|
|---|
| 49 | QApplication a( argc, argv );
|
|---|
| 50 |
|
|---|
| 51 | MyWidget w;
|
|---|
| 52 | a.setMainWidget( &w );
|
|---|
| 53 | w.show();
|
|---|
| 54 | return a.exec();
|
|---|
| 55 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.