source: trunk/doc/html/t7-main-cpp.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 3.6 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/tutorial.doc:668 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>t7/main.cpp Example File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>t7/main.cpp Example File</h1>
33
34
35<pre>/****************************************************************
36**
37** Qt tutorial 7
38**
39****************************************************************/
40
41#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;
42#include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;
43#include &lt;<a href="qlcdnumber-h.html">qlcdnumber.h</a>&gt;
44#include &lt;<a href="qfont-h.html">qfont.h</a>&gt;
45#include &lt;<a href="qvbox-h.html">qvbox.h</a>&gt;
46#include &lt;<a href="qgrid-h.html">qgrid.h</a>&gt;
47
48#include "lcdrange.h"
49
50
51class MyWidget : public <a href="qvbox.html">QVBox</a>
52{
53public:
54 MyWidget( <a href="qwidget.html">QWidget</a> *parent=0, const char *name=0 );
55};
56
57
58<a name="f29"></a>MyWidget::MyWidget( <a href="qwidget.html">QWidget</a> *parent, const char *name )
59 : <a href="qvbox.html">QVBox</a>( parent, name )
60{
61 <a href="qpushbutton.html">QPushButton</a> *quit = new <a href="qpushbutton.html">QPushButton</a>( "Quit", this, "quit" );
62 quit-&gt;<a href="qwidget.html#setFont">setFont</a>( QFont( "Times", 18, QFont::Bold ) );
63
64 <a href="qobject.html#connect">connect</a>( quit, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), qApp, SLOT(<a href="qapplication.html#quit">quit</a>()) );
65
66 <a href="qgrid.html">QGrid</a> *grid = new <a href="qgrid.html">QGrid</a>( 4, this );
67
68 LCDRange *previous = 0;
69 for( int r = 0 ; r &lt; 4 ; r++ ) {
70 for( int c = 0 ; c &lt; 4 ; c++ ) {
71 LCDRange* lr = new LCDRange( grid );
72 if ( previous )
73 <a href="qobject.html#connect">connect</a>( lr, SIGNAL(valueChanged(int)),
74 previous, SLOT(setValue(int)) );
75 previous = lr;
76 }
77 }
78}
79
80
81int main( int argc, char **argv )
82{
83 <a href="qapplication.html">QApplication</a> a( argc, argv );
84
85 MyWidget w;
86 a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &amp;w );
87 w.<a href="qwidget.html#show">show</a>();
88 return a.<a href="qapplication.html#exec">exec</a>();
89}
90</pre><!-- eof -->
91<p><address><hr><div align=center>
92<table width=100% cellspacing=0 border=0><tr>
93<td>Copyright &copy; 2007
94<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
95<td align=right><div align=right>Qt 3.3.8</div>
96</table></div></address></body>
97</html>
Note: See TracBrowser for help on using the repository browser.