Root/
Source at commit 1322 created 12 years 8 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | //␊ |
2 | // File: main.cpp␊ |
3 | //␊ |
4 | // A small Qt example application written by Troll Tech.␊ |
5 | //␊ |
6 | // It displays a text in a window and quits when you click␊ |
7 | // the mouse in the window.␊ |
8 | //␊ |
9 | ␊ |
10 | #include "hello.h"␊ |
11 | #include <qapp.h>␊ |
12 | ␊ |
13 | ␊ |
14 | /*␊ |
15 | The program starts here. It parses the command line and build a message␊ |
16 | string to be displayed by the Hello widget.␊ |
17 | */␊ |
18 | ␊ |
19 | int main( int argc, char **argv )␊ |
20 | {␊ |
21 | QApplication a(argc,argv);␊ |
22 | QString s;␊ |
23 | for ( int i=1; i<argc; i++ ) {␊ |
24 | ␉s += argv[i];␊ |
25 | ␉if ( i<argc-1 )␊ |
26 | ␉ s += " ";␊ |
27 | }␊ |
28 | if ( s.isEmpty() )␊ |
29 | ␉s = "Hello, World";␊ |
30 | Hello h( s );␊ |
31 | h.setCaption( "Qt says hello" );␊ |
32 | QObject::connect( &h, SIGNAL(clicked()), &a, SLOT(quit()) );␊ |
33 | h.setFont( QFont("times",32,QFont::Bold) );␉␉// default font␊ |
34 | h.setBackgroundColor( white );␉␉␉// default bg color␊ |
35 | a.setMainWidget( &h );␊ |
36 | h.show();␊ |
37 | return a.exec();␊ |
38 | }␊ |
39 |