|
Last change
on this file since 176 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.2 KB
|
| 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 "hello.h"
|
|---|
| 12 | #include <qapplication.h>
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | /*
|
|---|
| 16 | The program starts here. It parses the command line and builds a message
|
|---|
| 17 | string to be displayed by the Hello widget.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | int main( int argc, char **argv )
|
|---|
| 21 | {
|
|---|
| 22 | QApplication a(argc,argv);
|
|---|
| 23 | QString s;
|
|---|
| 24 | for ( int i=1; i<argc; i++ ) {
|
|---|
| 25 | s += argv[i];
|
|---|
| 26 | if ( i<argc-1 )
|
|---|
| 27 | s += " ";
|
|---|
| 28 | }
|
|---|
| 29 | if ( s.isEmpty() )
|
|---|
| 30 | s = "Hello, World";
|
|---|
| 31 | Hello h( s );
|
|---|
| 32 | #ifndef QT_NO_WIDGET_TOPEXTRA // for Qt/Embedded minimal build
|
|---|
| 33 | h.setCaption( "Qt says hello" );
|
|---|
| 34 | #endif
|
|---|
| 35 | QObject::connect( &h, SIGNAL(clicked()), &a, SLOT(quit()) );
|
|---|
| 36 | h.setFont( QFont("times",32,QFont::Bold) ); // default font
|
|---|
| 37 | h.setBackgroundColor( Qt::white ); // default bg color
|
|---|
| 38 | a.setMainWidget( &h );
|
|---|
| 39 | h.show();
|
|---|
| 40 | return a.exec();
|
|---|
| 41 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.