source:
trunk/examples/life/main.cpp
Last change on this file was 2, checked in by , 20 years ago | |
---|---|
|
|
File size: 1009 bytes |
Line | |
---|---|
1 | /**************************************************************************** |
2 | ** $Id: main.cpp 2 2005-11-16 15:49:26Z dmik $ |
3 | ** |
4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
5 | ** |
6 | ** This file is part of an example program for Qt. This example |
7 | ** program may be used, distributed and modified without limitation. |
8 | ** |
9 | *****************************************************************************/ |
10 | |
11 | #include "lifedlg.h" |
12 | #include <qapplication.h> |
13 | #include <stdlib.h> |
14 | |
15 | void usage() |
16 | { |
17 | qWarning( "Usage: life [-scale scale]" ); |
18 | } |
19 | |
20 | int main( int argc, char **argv ) |
21 | { |
22 | QApplication a( argc, argv ); |
23 | |
24 | int scale = 10; |
25 | |
26 | for ( int i = 1; i < argc; i++ ){ |
27 | QString arg = argv[i]; |
28 | if ( arg == "-scale" ) |
29 | scale = atoi( argv[++i] ); |
30 | else { |
31 | usage(); |
32 | exit(1); |
33 | } |
34 | } |
35 | |
36 | if ( scale < 2 ) |
37 | scale = 2; |
38 | |
39 | LifeDialog *life = new LifeDialog( scale ); |
40 | a.setMainWidget( life ); |
41 | life->setCaption("Qt Example - Life"); |
42 | life->show(); |
43 | |
44 | return a.exec(); |
45 | } |
Note:
See TracBrowser
for help on using the repository browser.