source: trunk/doc/html/qmag-example.html@ 190

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

reference documentation added

File size: 20.5 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/examples/qmag/qmag.doc:4 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QMag</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>QMag</h1>
33
34
35<p>
36This is a simple magnifier-type program. It shows how one can do
37some quite low-level operations in a portable way using Qt.
38<p> Run it, click in the magnifier window, then click where you want to
39magnify or drag out a rectangle. Two combo boxes let you select
40amplification and refresh frequency, a text label tells you the color
41of the pixel the cursor is on, and a button lets you save the
42magnified area as a .bmp file.
43<p> <hr>
44<p> Implementation:
45<p> <pre>/****************************************************************************
46** $Id: qmag-example.html 2051 2007-02-21 10:04:20Z chehrlic $
47**
48** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
49**
50** This file is part of an example program for Qt. This example
51** program may be used, distributed and modified without limitation.
52**
53*****************************************************************************/
54
55#include &lt;<a href="qcombobox-h.html">qcombobox.h</a>&gt;
56#include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;
57#include &lt;<a href="qpixmap-h.html">qpixmap.h</a>&gt;
58#include &lt;<a href="qimage-h.html">qimage.h</a>&gt;
59#include &lt;<a href="qlabel-h.html">qlabel.h</a>&gt;
60#include &lt;<a href="qfiledialog-h.html">qfiledialog.h</a>&gt;
61#include &lt;<a href="qregexp-h.html">qregexp.h</a>&gt;
62
63#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;
64#include &lt;<a href="qpainter-h.html">qpainter.h</a>&gt;
65#include &lt;<a href="qwmatrix-h.html">qwmatrix.h</a>&gt;
66
67
68class MagWidget : public <a href="qwidget.html">QWidget</a>
69{
70 <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
71public:
72 MagWidget( <a href="qwidget.html">QWidget</a> *parent=0, const char *name=0 );
73
74public slots:
75 void setZoom( int );
76 void setRefresh( int );
77 void save();
78 void multiSave();
79
80protected:
81 void paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * );
82 void mousePressEvent( <a href="qmouseevent.html">QMouseEvent</a> * );
83 void mouseReleaseEvent( <a href="qmouseevent.html">QMouseEvent</a> * );
84 void mouseMoveEvent( <a href="qmouseevent.html">QMouseEvent</a> * );
85 void focusOutEvent( <a href="qfocusevent.html">QFocusEvent</a> * );
86 void timerEvent( <a href="qtimerevent.html">QTimerEvent</a> * );
87 void resizeEvent( <a href="qresizeevent.html">QResizeEvent</a> * );
88
89private:
90 void grabAround(QPoint pos);
91 void grab();
92
93 <a href="qcombobox.html">QComboBox</a> *zoom;
94 <a href="qcombobox.html">QComboBox</a> *refresh;
95 <a href="qpushbutton.html">QPushButton</a> *saveButton;
96 <a href="qpushbutton.html">QPushButton</a> *multiSaveButton;
97 <a href="qpushbutton.html">QPushButton</a> *quitButton;
98 <a href="qpixmap.html">QPixmap</a> pm; // pixmap, magnified
99 <a href="qpixmap.html">QPixmap</a> p; // pixmap
100 <a href="qimage.html">QImage</a> image; // image of pixmap (for RGB)
101 <a href="qlabel.html">QLabel</a> *rgb;
102 int yoffset; // pixels in addition to the actual picture
103 int z; // magnification factor
104 int r; // autorefresh rate (index into refreshrates)
105 bool grabbing; // TRUE if qmag is currently grabbing
106 int grabx, graby;
107 <a href="qstring.html">QString</a> multifn; // filename for multisave
108};
109
110
111#ifdef COMPLEX_GUI
112static const char *zoomfactors[] = {
113 "100%", "200%", "300%", "400%", "500%",
114 "600%", "700%", "800%", "1600%", 0 };
115
116static const char *refreshrates[] = {
117 "No autorefresh", "50 per second", "4 per second", "3 per second", "2 per second",
118 "Every second", "Every two seconds", "Every three seconds",
119 "Every five seconds", "Every ten seconds", 0 };
120#endif
121
122static const int timer[] = {
123 0, 20, 250, 333, 500, 1000, 2000, 3000, 5000, 10000 };
124
125
126<a name="f484"></a>MagWidget::MagWidget( <a href="qwidget.html">QWidget</a> *parent, const char *name )
127 : <a href="qwidget.html">QWidget</a>( parent, name)
128{
129 z = 1; // default zoom (100%)
130 r = 0; // default refresh (none)
131
132#ifdef COMPLEX_GUI
133 int w=0, x=0, n;
134
135 zoom = new <a href="qcombobox.html">QComboBox</a>( FALSE, this );
136 <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(zoom);
137<a name="x1773"></a> zoom-&gt;<a href="qcombobox.html#insertStrList">insertStrList</a>( zoomfactors, 9 );
138<a name="x1772"></a> <a href="qobject.html#connect">connect</a>( zoom, SIGNAL(<a href="qcombobox.html#activated">activated</a>(int)), SLOT(setZoom(int)) );
139
140 refresh = new <a href="qcombobox.html">QComboBox</a>( FALSE, this );
141 <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(refresh);
142 refresh-&gt;<a href="qcombobox.html#insertStrList">insertStrList</a>( refreshrates, 9 );
143 <a href="qobject.html#connect">connect</a>( refresh, SIGNAL(<a href="qcombobox.html#activated">activated</a>(int)), SLOT(setRefresh(int)) );
144
145 for( n=0; n&lt;9; n++) {
146<a name="x1797"></a> int w2 = zoom-&gt;<a href="qwidget.html#fontMetrics">fontMetrics</a>().width( zoomfactors[n] );
147 w = QMAX(w2, w);
148 }
149<a name="x1807"></a> zoom-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( 2, 2, w+30, 20 );
150
151 x = w+34;
152 w = 0;
153 for( n=0; n&lt;9; n++) {
154 int w2 = refresh-&gt;<a href="qwidget.html#fontMetrics">fontMetrics</a>().width( refreshrates[n] );
155 w = QMAX(w2, w);
156 }
157 refresh-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( x, 2, w+30, 20 );
158
159 saveButton = new <a href="qpushbutton.html">QPushButton</a>( this );
160 <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(saveButton);
161 <a href="qobject.html#connect">connect</a>( saveButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), this, SLOT(save()) );
162<a name="x1771"></a> saveButton-&gt;<a href="qbutton.html#setText">setText</a>( "Save" );
163<a name="x1788"></a> saveButton-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( x+w+30+2, 2,
164 10+saveButton-&gt;<a href="qwidget.html#fontMetrics">fontMetrics</a>().width("Save"), 20 );
165
166 multiSaveButton = new <a href="qpushbutton.html">QPushButton</a>( this );
167<a name="x1790"></a> multiSaveButton-&gt;<a href="qpushbutton.html#setToggleButton">setToggleButton</a>(TRUE);
168 <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(multiSaveButton);
169 <a href="qobject.html#connect">connect</a>( multiSaveButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), this, SLOT(multiSave()) );
170 multiSaveButton-&gt;<a href="qbutton.html#setText">setText</a>( "MultiSave" );
171<a name="x1798"></a> multiSaveButton-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( saveButton-&gt;<a href="qwidget.html#geometry">geometry</a>().right() + 2, 2,
172 10+multiSaveButton-&gt;<a href="qwidget.html#fontMetrics">fontMetrics</a>().width("MultiSave"), 20 );
173
174 quitButton = new <a href="qpushbutton.html">QPushButton</a>( this );
175 <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(quitButton);
176 <a href="qobject.html#connect">connect</a>( quitButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), qApp, SLOT(<a href="qapplication.html#quit">quit</a>()) );
177 quitButton-&gt;<a href="qbutton.html#setText">setText</a>( "Quit" );
178 quitButton-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( multiSaveButton-&gt;<a href="qwidget.html#geometry">geometry</a>().right() + 2, 2,
179 10+quitButton-&gt;<a href="qwidget.html#fontMetrics">fontMetrics</a>().width("Quit"), 20 );
180#else
181 zoom = 0;
182 multiSaveButton = 0;
183#endif
184
185 setRefresh(1);
186 setZoom(5);
187
188 rgb = new <a href="qlabel.html">QLabel</a>( this );
189 <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( rgb );
190<a name="x1779"></a> rgb-&gt;<a href="qlabel.html#setText">setText</a>( "" );
191 rgb-&gt;<a href="qlabel.html#setAlignment">setAlignment</a>( AlignVCenter );
192 rgb-&gt;<a href="qwidget.html#resize">resize</a>( <a href="qwidget.html#width">width</a>(), rgb-&gt;<a href="qwidget.html#fontMetrics">fontMetrics</a>().height() + 4 );
193
194#ifdef COMPLEX_GUI
195<a name="x1799"></a> yoffset = zoom-&gt;<a href="qwidget.html#height">height</a>() // top buttons
196 + 4 // space around top buttons
197 + rgb-&gt;<a href="qwidget.html#height">height</a>(); // color-value text height
198<a name="x1804"></a> <a href="qwidget.html#setMinimumSize">setMinimumSize</a>( quitButton-&gt;<a href="qwidget.html#pos">pos</a>().x(), yoffset+20 );
199 <a href="qwidget.html#resize">resize</a>( quitButton-&gt;<a href="qwidget.html#geometry">geometry</a>().topRight().x() + 2, yoffset+60 );
200#else
201 yoffset = 0;
202 <a href="qwidget.html#resize">resize</a>(350,350);
203#endif
204
205 grabx = graby = -1;
206 grabbing = FALSE;
207
208 <a href="qwidget.html#setMouseTracking">setMouseTracking</a>( TRUE ); // and do let me know what pixel I'm at, eh?
209
210<a name="x1765"></a> grabAround( QPoint(grabx=qApp-&gt;<a href="qapplication.html#desktop">desktop</a>()-&gt;width()/2, graby=qApp-&gt;<a href="qapplication.html#desktop">desktop</a>()-&gt;height()/2) );
211}
212
213
214void <a name="f485"></a>MagWidget::setZoom( int index )
215{
216 if (index == 8)
217 z = 16;
218 else
219 z = index+1;
220 grab();
221}
222
223
224void <a name="f486"></a>MagWidget::setRefresh( int index )
225{
226 r = index;
227 <a href="qobject.html#killTimers">killTimers</a>();
228 if (index &amp;&amp; !grabbing)
229 <a href="qobject.html#startTimer">startTimer</a>( timer[r] );
230}
231
232
233void <a name="f487"></a>MagWidget::save()
234{
235<a name="x1785"></a> if ( !p.<a href="qpixmap.html#isNull">isNull</a>() ) {
236 <a href="qobject.html#killTimers">killTimers</a>();
237<a name="x1775"></a> <a href="qstring.html">QString</a> fn = QFileDialog::<a href="qfiledialog.html#getSaveFileName">getSaveFileName</a>();
238<a name="x1792"></a> if ( !fn.<a href="qstring.html#isEmpty">isEmpty</a>() )
239<a name="x1786"></a> p.<a href="qpixmap.html#save">save</a>( fn, "BMP" );
240 if ( r )
241 <a href="qobject.html#startTimer">startTimer</a>( timer[r] );
242 }
243}
244
245void <a name="f488"></a>MagWidget::multiSave()
246{
247 if ( !p.<a href="qpixmap.html#isNull">isNull</a>() ) {
248 multifn = ""; // stops saving
249 multifn = QFileDialog::<a href="qfiledialog.html#getSaveFileName">getSaveFileName</a>();
250 if ( multifn.<a href="qstring.html#isEmpty">isEmpty</a>() )
251<a name="x1789"></a> multiSaveButton-&gt;<a href="qpushbutton.html#setOn">setOn</a>(FALSE);
252 if ( !r )
253 p.<a href="qpixmap.html#save">save</a>( multifn, "BMP" );
254 } else {
255 multiSaveButton-&gt;<a href="qpushbutton.html#setOn">setOn</a>(FALSE);
256 }
257}
258
259
260void <a name="f489"></a>MagWidget::grab()
261{
262 if ( !isVisible() )
263 return; // don't eat resources when iconified
264
265 if ( grabx &lt; 0 || graby &lt; 0 )
266 return; // don't grab until the user has said to
267
268 int x,y, w,h;
269
270 w = (<a href="qwidget.html#width">width</a>()+z-1)/z;
271 h = (<a href="qwidget.html#height">height</a>()+z-1-yoffset)/z;
272 if ( w&lt;1 || h&lt;1 )
273 return; // don't ask too much from the window system :)
274
275 x = grabx-w/2; // find a suitable position to grab from
276 y = graby-h/2;
277 if ( x + w &gt; QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;width() )
278 x = QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;width()-w;
279 else if ( x &lt; 0 )
280 x = 0;
281 if ( y + h &gt; QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;height() )
282 y = QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;height()-h;
283 else if ( y &lt; 0 )
284 y = 0;
285
286<a name="x1784"></a> p = QPixmap::<a href="qpixmap.html#grabWindow">grabWindow</a>( QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;winId(), x, y, w, h );
287<a name="x1783"></a> image = p.<a href="qpixmap.html#convertToImage">convertToImage</a>();
288 <a href="qwmatrix.html">QWMatrix</a> m; // after getting it, scale it
289<a name="x1809"></a> m.<a href="qwmatrix.html#scale">scale</a>( (double)z, (double)z );
290<a name="x1787"></a> pm = p.<a href="qpixmap.html#xForm">xForm</a>( m );
291
292<a name="x1770"></a> if ( !multiSaveButton || !multiSaveButton-&gt;<a href="qbutton.html#isOn">isOn</a>() )
293 <a href="qwidget.html#repaint">repaint</a>( FALSE ); // and finally repaint, flicker-free
294}
295
296
297<a name="x1803"></a>void MagWidget::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">QPaintEvent</a> * )
298{
299 if ( !pm.<a href="qpixmap.html#isNull">isNull</a>() ) {
300 <a href="qpainter.html">QPainter</a> paint( this );
301<a name="x1782"></a> paint.<a href="qpainter.html#drawPixmap">drawPixmap</a>( 0, zoom ? zoom-&gt;<a href="qwidget.html#height">height</a>()+4 : 0, pm,
302 0,0, width(), height()-yoffset );
303 }
304}
305
306
307<a name="x1801"></a>void MagWidget::<a href="qwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">QMouseEvent</a> *e )
308{
309 if ( !grabbing ) { // prepare to grab...
310 grabbing = TRUE;
311 <a href="qobject.html#killTimers">killTimers</a>();
312 <a href="qwidget.html#grabMouse">grabMouse</a>( crossCursor );
313 grabx = -1;
314 graby = -1;
315 } else { // REALLY prepare to grab
316<a name="x1780"></a> grabx = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(e-&gt;<a href="qmouseevent.html#pos">pos</a>()).x();
317 graby = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(e-&gt;<a href="qmouseevent.html#pos">pos</a>()).y();
318 }
319}
320
321
322
323<a name="x1802"></a>void MagWidget::<a href="qwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">QMouseEvent</a> * e )
324{
325 if ( grabbing &amp;&amp; grabx &gt;= 0 &amp;&amp; graby &gt;= 0 ) {
326 grabbing = FALSE;
327 grabAround(e-&gt;<a href="qmouseevent.html#pos">pos</a>());
328 <a href="qwidget.html#releaseMouse">releaseMouse</a>();
329 }
330}
331
332void <a name="f490"></a>MagWidget::grabAround(QPoint pos)
333{
334 int rx, ry;
335 rx = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(pos).x();
336 ry = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(pos).y();
337 int w = QABS(rx-grabx);
338 int h = QABS(ry-graby);
339 if ( w &gt; 10 &amp;&amp; h &gt; 10 ) {
340 int pz;
341 pz = 1;
342 while ( w*pz*h*pz &lt; width()*(<a href="qwidget.html#height">height</a>()-yoffset) &amp;&amp;
343 w*pz &lt; QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;width() &amp;&amp;
344 h*pz &lt; QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;height() )
345 pz++;
346 if ( (w*pz*h*pz - width()*(<a href="qwidget.html#height">height</a>()-yoffset)) &gt;
347 (<a href="qwidget.html#width">width</a>()*(<a href="qwidget.html#height">height</a>()-yoffset) - w*(pz-1)*h*(pz-1)) )
348 pz--;
349 if ( pz &lt; 1 )
350 pz = 1;
351 if ( pz &gt; 8 )
352 pz = 8;
353 if ( zoom )
354<a name="x1774"></a> zoom-&gt;<a href="qcombobox.html#setCurrentItem">setCurrentItem</a>( pz-1 );
355
356 z = pz;
357 grabx = QMIN(rx, grabx) + w/2;
358 graby = QMIN(ry, graby) + h/2;
359 <a href="qwidget.html#resize">resize</a>( w*z, h*z+yoffset );
360 }
361 grab();
362 if ( r )
363 <a href="qobject.html#startTimer">startTimer</a>( timer[r] );
364}
365
366
367<a name="x1800"></a>void MagWidget::<a href="qwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">QMouseEvent</a> *e )
368{
369 if ( grabbing || pm.<a href="qpixmap.html#isNull">isNull</a>() ||
370 e-&gt;<a href="qmouseevent.html#pos">pos</a>().y() &gt; height() - (zoom ? zoom-&gt;<a href="qwidget.html#fontMetrics">fontMetrics</a>().height() - 4 : 0) ||
371 e-&gt;<a href="qmouseevent.html#pos">pos</a>().y() &lt; (zoom ? zoom-&gt;<a href="qwidget.html#height">height</a>()+4 : 4) ) {
372 rgb-&gt;<a href="qlabel.html#setText">setText</a>( "" );
373 } else {
374 int x,y;
375 x = e-&gt;<a href="qmouseevent.html#pos">pos</a>().x() / z;
376 y = (e-&gt;<a href="qmouseevent.html#pos">pos</a>().y() - ( zoom ? zoom-&gt;<a href="qwidget.html#height">height</a>() : 0 ) - 4) / z;
377 <a href="qstring.html">QString</a> pixelinfo;
378<a name="x1777"></a> if ( image.<a href="qimage.html#valid">valid</a>(x,y) )
379 {
380<a name="x1776"></a> QRgb px = image.<a href="qimage.html#pixel">pixel</a>(x,y);
381<a name="x1795"></a> pixelinfo.<a href="qstring.html#sprintf">sprintf</a>(" %3d,%3d,%3d #%02x%02x%02x",
382 <a href="qcolor.html#qRed">qRed</a>(px), qGreen(px), qBlue(px),
383 <a href="qcolor.html#qRed">qRed</a>(px), qGreen(px), qBlue(px));
384 }
385 <a href="qstring.html">QString</a> label;
386 label.<a href="qstring.html#sprintf">sprintf</a>( "x=%d, y=%d %s",
387 x+grabx, y+graby, (const char*)pixelinfo );
388 rgb-&gt;<a href="qlabel.html#setText">setText</a>( label );
389 }
390}
391
392
393<a name="x1796"></a>void MagWidget::<a href="qwidget.html#focusOutEvent">focusOutEvent</a>( <a href="qfocusevent.html">QFocusEvent</a> * )
394{
395 rgb-&gt;<a href="qlabel.html#setText">setText</a>( "" );
396}
397
398
399<a name="x1781"></a>void MagWidget::<a href="qobject.html#timerEvent">timerEvent</a>( <a href="qtimerevent.html">QTimerEvent</a> * )
400{
401 grab();
402/*
403 if ( multiSaveButton-&gt;<a href="qbutton.html#isOn">isOn</a>() &amp;&amp; !multifn.<a href="qstring.html#isEmpty">isEmpty</a>() ) {
404 <a href="qregexp.html">QRegExp</a> num("[0-9][0-9]*");
405 int start;
406 int len;
407<a name="x1791"></a> if ((start=num.<a href="qregexp.html#match">match</a>(multifn,0,&amp;len))&gt;=0)
408<a name="x1794"></a> multifn.<a href="qstring.html#replace">replace</a>(num,
409<a name="x1793"></a> QString().setNum(multifn.<a href="qstring.html#mid">mid</a>(start,len).toInt()+1)
410 );
411 p.<a href="qpixmap.html#save">save</a>( multifn, "BMP" );
412 }
413*/
414}
415
416
417<a name="x1806"></a>void MagWidget::<a href="qwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">QResizeEvent</a> * )
418{
419 rgb-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( 0, height() - rgb-&gt;<a href="qwidget.html#height">height</a>(), width(), rgb-&gt;<a href="qwidget.html#height">height</a>() );
420 grab();
421}
422
423
424#include "qmag.moc"
425
426
427int main( int argc, char **argv )
428{
429 <a href="qapplication.html">QApplication</a> a( argc, argv );
430 MagWidget m;
431 a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &amp;m );
432 m.<a href="qwidget.html#show">show</a>();
433 return a.<a href="qapplication.html#exec">exec</a>();
434}
435</pre>
436
437<p>See also <a href="examples.html">Examples</a>.
438
439<!-- eof -->
440<p><address><hr><div align=center>
441<table width=100% cellspacing=0 border=0><tr>
442<td>Copyright &copy; 2007
443<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
444<td align=right><div align=right>Qt 3.3.8</div>
445</table></div></address></body>
446</html>
Note: See TracBrowser for help on using the repository browser.