source:
trunk/tutorial/t4/main.cpp@
95
| Last change on this file since 95 was 2, checked in by , 20 years ago | |
|---|---|
|
|
| File size: 948 bytes | |
| Line | |
|---|---|
| 1 | /**************************************************************** |
| 2 | ** |
| 3 | ** Qt tutorial 4 |
| 4 | ** |
| 5 | ****************************************************************/ |
| 6 | |
| 7 | #include <qapplication.h> |
| 8 | #include <qpushbutton.h> |
| 9 | #include <qfont.h> |
| 10 | |
| 11 | |
| 12 | class MyWidget : public QWidget |
| 13 | { |
| 14 | public: |
| 15 | MyWidget( QWidget *parent=0, const char *name=0 ); |
| 16 | }; |
| 17 | |
| 18 | |
| 19 | MyWidget::MyWidget( QWidget *parent, const char *name ) |
| 20 | : QWidget( parent, name ) |
| 21 | { |
| 22 | setMinimumSize( 200, 120 ); |
| 23 | setMaximumSize( 200, 120 ); |
| 24 | |
| 25 | QPushButton *quit = new QPushButton( "Quit", this, "quit" ); |
| 26 | quit->setGeometry( 62, 40, 75, 30 ); |
| 27 | quit->setFont( QFont( "Times", 18, QFont::Bold ) ); |
| 28 | |
| 29 | connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) ); |
| 30 | } |
| 31 | |
| 32 | |
| 33 | int main( int argc, char **argv ) |
| 34 | { |
| 35 | QApplication a( argc, argv ); |
| 36 | |
| 37 | MyWidget w; |
| 38 | w.setGeometry( 100, 100, 200, 120 ); |
| 39 | a.setMainWidget( &w ); |
| 40 | w.show(); |
| 41 | return a.exec(); |
| 42 | } |
Note:
See TracBrowser
for help on using the repository browser.
