source: liacs/pm/qt_works/test.cpp@ 70

Last change on this file since 70 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1/****************************************************************
2**
3** Qt tutorial 6
4**
5****************************************************************/
6
7#include <qapplication.h>
8#include <qpushbutton.h>
9#include <qslider.h>
10#include <qlcdnumber.h>
11#include <qfont.h>
12#include <qvbox.h>
13#include <qgrid.h>
14
15class LCDRange : public QVBox
16{
17public:
18 LCDRange( QWidget *parent=0, const char *name=0 );
19};
20
21LCDRange::LCDRange( QWidget *parent, const char *name )
22 : QVBox( parent, name )
23{
24 QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
25 QSlider * slider = new QSlider( Horizontal, this, "slider" );
26 slider->setRange( 0, 99 );
27 slider->setValue( 0 );
28 connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)) );
29}
30
31class MyWidget : public QVBox
32{
33public:
34 MyWidget( QWidget *parent=0, const char *name=0 );
35};
36
37
38MyWidget::MyWidget( QWidget *parent, const char *name )
39 : QVBox( parent, name )
40{
41 QPushButton *quit = new QPushButton( "Quit", this, "quit" );
42 quit->setFont( QFont( "Times", 18, QFont::Bold ) );
43
44 connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
45
46 QGrid *grid = new QGrid( 4, this );
47
48 for( int r = 0 ; r < 4 ; r++ )
49 for( int c = 0 ; c < 4 ; c++ )
50 (void)new LCDRange( grid );
51}
52
53int main( int argc, char **argv )
54{
55 QApplication a( argc, argv );
56
57 MyWidget w;
58 a.setMainWidget( &w );
59 w.show();
60 return a.exec();
61}
Note: See TracBrowser for help on using the repository browser.