|
Last change
on this file since 130 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.1 KB
|
| Line | |
|---|
| 1 | /****************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Qt tutorial 5
|
|---|
| 4 | **
|
|---|
| 5 | ****************************************************************/
|
|---|
| 6 |
|
|---|
| 7 | #include <qapplication.h>
|
|---|
| 8 | #include <qpushbutton.h>
|
|---|
| 9 | #include <qslider.h>
|
|---|
| 10 | #include <qlcdnumber.h>
|
|---|
| 11 | #include <qfont.h>
|
|---|
| 12 |
|
|---|
| 13 | #include <qvbox.h>
|
|---|
| 14 |
|
|---|
| 15 | class MyWidget : public QVBox
|
|---|
| 16 | {
|
|---|
| 17 | public:
|
|---|
| 18 | MyWidget( QWidget *parent=0, const char *name=0 );
|
|---|
| 19 | };
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | MyWidget::MyWidget( QWidget *parent, const char *name )
|
|---|
| 23 | : QVBox( parent, name )
|
|---|
| 24 | {
|
|---|
| 25 | QPushButton *quit = new QPushButton( "Quit", this, "quit" );
|
|---|
| 26 | quit->setFont( QFont( "Times", 18, QFont::Bold ) );
|
|---|
| 27 |
|
|---|
| 28 | connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
|
|---|
| 29 |
|
|---|
| 30 | QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
|
|---|
| 31 |
|
|---|
| 32 | QSlider * slider = new QSlider( Horizontal, this, "slider" );
|
|---|
| 33 | slider->setRange( 0, 99 );
|
|---|
| 34 | slider->setValue( 0 );
|
|---|
| 35 |
|
|---|
| 36 | connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)) );
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | int main( int argc, char **argv )
|
|---|
| 40 | {
|
|---|
| 41 | QApplication a( argc, argv );
|
|---|
| 42 |
|
|---|
| 43 | MyWidget w;
|
|---|
| 44 | a.setMainWidget( &w );
|
|---|
| 45 | w.show();
|
|---|
| 46 | return a.exec();
|
|---|
| 47 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.