diff options
Diffstat (limited to 'doc/html/aclock-example.html')
-rw-r--r-- | doc/html/aclock-example.html | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/doc/html/aclock-example.html b/doc/html/aclock-example.html index c7c95a236..42fa56c37 100644 --- a/doc/html/aclock-example.html +++ b/doc/html/aclock-example.html @@ -49,15 +49,15 @@ This example displays an analog clock widget. #ifndef ACLOCK_H #define ACLOCK_H -#include <<a href="qwidget-h.html">qwidget.h</a>> -#include <<a href="qdatetime-h.html">qdatetime.h</a>> +#include <<a href="qwidget-h.html">ntqwidget.h</a>> +#include <<a href="qdatetime-h.html">ntqdatetime.h</a>> class TQTimer; -class AnalogClock : public <a href="qwidget.html">TQWidget</a> // analog clock widget +class AnalogClock : public <a href="ntqwidget.html">TQWidget</a> // analog clock widget { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - AnalogClock( <a href="qwidget.html">TQWidget</a> *parent=0, const char *name=0 ); + AnalogClock( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); void setAutoMask(bool b); protected: @@ -65,7 +65,7 @@ protected: void paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> *); void mousePressEvent( <a href="qmouseevent.html">TQMouseEvent</a> *); void mouseMoveEvent( <a href="qmouseevent.html">TQMouseEvent</a> *); - void drawClock( <a href="qpainter.html">TQPainter</a>* ); + void drawClock( <a href="ntqpainter.html">TQPainter</a>* ); private slots: void timeout(); @@ -74,9 +74,9 @@ public slots: void setTime( const <a href="qtime.html">TQTime</a> & t ); private: - <a href="qpoint.html">TQPoint</a> clickPos; + <a href="ntqpoint.html">TQPoint</a> clickPos; <a href="qtime.html">TQTime</a> time; - <a href="qtimer.html">TQTimer</a> *internalTimer; + <a href="ntqtimer.html">TQTimer</a> *internalTimer; }; @@ -96,33 +96,33 @@ private: *****************************************************************************/ #include "aclock.h" -#include <<a href="qtimer-h.html">qtimer.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qbitmap-h.html">qbitmap.h</a>> +#include <<a href="qtimer-h.html">ntqtimer.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qbitmap-h.html">ntqbitmap.h</a>> // // Constructs an analog clock widget that uses an internal TQTimer. // -<a name="f384"></a>AnalogClock::AnalogClock( <a href="qwidget.html">TQWidget</a> *parent, const char *name ) - : <a href="qwidget.html">TQWidget</a>( parent, name ) +<a name="f384"></a>AnalogClock::AnalogClock( <a href="ntqwidget.html">TQWidget</a> *parent, const char *name ) + : <a href="ntqwidget.html">TQWidget</a>( parent, name ) { <a name="x1201"></a> time = TQTime::<a href="qtime.html#currentTime">currentTime</a>(); // get current time - internalTimer = new <a href="qtimer.html">TQTimer</a>( this ); // create internal timer -<a name="x1205"></a> <a href="qobject.html#connect">connect</a>( internalTimer, SIGNAL(<a href="qtimer.html#timeout">timeout</a>()), SLOT(timeout()) ); -<a name="x1204"></a> internalTimer-><a href="qtimer.html#start">start</a>( 5000 ); // emit signal every 5 seconds + internalTimer = new <a href="ntqtimer.html">TQTimer</a>( this ); // create internal timer +<a name="x1205"></a> <a href="ntqobject.html#connect">connect</a>( internalTimer, SIGNAL(<a href="ntqtimer.html#timeout">timeout</a>()), SLOT(timeout()) ); +<a name="x1204"></a> internalTimer-><a href="ntqtimer.html#start">start</a>( 5000 ); // emit signal every 5 seconds } -void AnalogClock::<a href="qwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +void AnalogClock::<a href="ntqwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { - if(<a href="qwidget.html#isTopLevel">isTopLevel</a>()) - clickPos = e-><a href="qmouseevent.html#pos">pos</a>() + TQPoint(<a href="qwidget.html#geometry">geometry</a>().topLeft() - frameGeometry().topLeft()); + if(<a href="ntqwidget.html#isTopLevel">isTopLevel</a>()) + clickPos = e-><a href="qmouseevent.html#pos">pos</a>() + TQPoint(<a href="ntqwidget.html#geometry">geometry</a>().topLeft() - frameGeometry().topLeft()); } -<a name="x1206"></a>void AnalogClock::<a href="qwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<a name="x1206"></a>void AnalogClock::<a href="ntqwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { - if(<a href="qwidget.html#isTopLevel">isTopLevel</a>()) -<a name="x1181"></a> <a href="qwidget.html#move">move</a>( e-><a href="qmouseevent.html#globalPos">globalPos</a>() - clickPos ); + if(<a href="ntqwidget.html#isTopLevel">isTopLevel</a>()) +<a name="x1181"></a> <a href="ntqwidget.html#move">move</a>( e-><a href="qmouseevent.html#globalPos">globalPos</a>() - clickPos ); } // @@ -136,11 +136,11 @@ void AnalogClock::<a href="qwidget.html#mousePressEvent">mousePressEvent</a>( <a void <a name="f385"></a>AnalogClock::setTime( const <a href="qtime.html">TQTime</a> & t ) { time = t; - <a href="qobject.html#disconnect">disconnect</a>( internalTimer, SIGNAL(<a href="qtimer.html#timeout">timeout</a>()), this, SLOT(timeout()) ); - if (<a href="qwidget.html#autoMask">autoMask</a>()) - <a href="qwidget.html#updateMask">updateMask</a>(); + <a href="ntqobject.html#disconnect">disconnect</a>( internalTimer, SIGNAL(<a href="ntqtimer.html#timeout">timeout</a>()), this, SLOT(timeout()) ); + if (<a href="ntqwidget.html#autoMask">autoMask</a>()) + <a href="ntqwidget.html#updateMask">updateMask</a>(); else - <a href="qwidget.html#update">update</a>(); + <a href="ntqwidget.html#update">update</a>(); } @@ -150,20 +150,20 @@ void <a name="f386"></a>AnalogClock::timeout() time = TQTime::<a href="qtime.html#currentTime">currentTime</a>(); <a name="x1203"></a> if ( old_time.<a href="qtime.html#minute">minute</a>() != time.minute() <a name="x1202"></a> || old_time.<a href="qtime.html#hour">hour</a>() != time.hour() ) { // minute or hour has changed - if (<a href="qwidget.html#autoMask">autoMask</a>()) - <a href="qwidget.html#updateMask">updateMask</a>(); + if (<a href="ntqwidget.html#autoMask">autoMask</a>()) + <a href="ntqwidget.html#updateMask">updateMask</a>(); else - <a href="qwidget.html#update">update</a>(); + <a href="ntqwidget.html#update">update</a>(); } } -void AnalogClock::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) +void AnalogClock::<a href="ntqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) { - if ( <a href="qwidget.html#autoMask">autoMask</a>() ) + if ( <a href="ntqwidget.html#autoMask">autoMask</a>() ) return; - <a href="qpainter.html">TQPainter</a> paint( this ); -<a name="x1190"></a> paint.<a href="qpainter.html#setBrush">setBrush</a>( <a href="qwidget.html#colorGroup">colorGroup</a>().foreground() ); + <a href="ntqpainter.html">TQPainter</a> paint( this ); +<a name="x1190"></a> paint.<a href="ntqpainter.html#setBrush">setBrush</a>( <a href="ntqwidget.html#colorGroup">colorGroup</a>().foreground() ); drawClock( &paint ); } @@ -172,18 +172,18 @@ void AnalogClock::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpa void AnalogClock::updateMask() // paint clock mask { - <a href="qbitmap.html">TQBitmap</a> bm( <a href="qwidget.html#size">size</a>() ); - bm.<a href="qpixmap.html#fill">fill</a>( color0 ); //transparent + <a href="ntqbitmap.html">TQBitmap</a> bm( <a href="ntqwidget.html#size">size</a>() ); + bm.<a href="ntqpixmap.html#fill">fill</a>( color0 ); //transparent - <a href="qpainter.html">TQPainter</a> paint; -<a name="x1183"></a> paint.<a href="qpainter.html#begin">begin</a>( &bm, this ); - paint.<a href="qpainter.html#setBrush">setBrush</a>( color1 ); // use non-transparent color - paint.<a href="qpainter.html#setPen">setPen</a>( color1 ); + <a href="ntqpainter.html">TQPainter</a> paint; +<a name="x1183"></a> paint.<a href="ntqpainter.html#begin">begin</a>( &bm, this ); + paint.<a href="ntqpainter.html#setBrush">setBrush</a>( color1 ); // use non-transparent color + paint.<a href="ntqpainter.html#setPen">setPen</a>( color1 ); drawClock( &paint ); -<a name="x1186"></a> paint.<a href="qpainter.html#end">end</a>(); - <a href="qwidget.html#setMask">setMask</a>( bm ); +<a name="x1186"></a> paint.<a href="ntqpainter.html#end">end</a>(); + <a href="ntqwidget.html#setMask">setMask</a>( bm ); } // @@ -191,47 +191,47 @@ void AnalogClock::updateMask() // paint clock mask // the a centered square, as big as possible. The painter's pen and // brush colors are used. // -void <a name="f387"></a>AnalogClock::drawClock( <a href="qpainter.html">TQPainter</a> *paint ) +void <a name="f387"></a>AnalogClock::drawClock( <a href="ntqpainter.html">TQPainter</a> *paint ) { -<a name="x1189"></a> paint-><a href="qpainter.html#save">save</a>(); +<a name="x1189"></a> paint-><a href="ntqpainter.html#save">save</a>(); -<a name="x1193"></a> paint-><a href="qpainter.html#setWindow">setWindow</a>( -500,-500, 1000,1000 ); +<a name="x1193"></a> paint-><a href="ntqpainter.html#setWindow">setWindow</a>( -500,-500, 1000,1000 ); -<a name="x1194"></a> <a href="qrect.html">TQRect</a> v = paint-><a href="qpainter.html#viewport">viewport</a>(); - int d = TQMIN( v.<a href="qrect.html#width">width</a>(), v.<a href="qrect.html#height">height</a>() ); -<a name="x1198"></a><a name="x1192"></a> paint-><a href="qpainter.html#setViewport">setViewport</a>( v.<a href="qrect.html#left">left</a>() + (v.<a href="qrect.html#width">width</a>()-d)/2, -<a name="x1199"></a> v.<a href="qrect.html#top">top</a>() + (v.<a href="qrect.html#height">height</a>()-d)/2, d, d ); +<a name="x1194"></a> <a href="ntqrect.html">TQRect</a> v = paint-><a href="ntqpainter.html#viewport">viewport</a>(); + int d = TQMIN( v.<a href="ntqrect.html#width">width</a>(), v.<a href="ntqrect.html#height">height</a>() ); +<a name="x1198"></a><a name="x1192"></a> paint-><a href="ntqpainter.html#setViewport">setViewport</a>( v.<a href="ntqrect.html#left">left</a>() + (v.<a href="ntqrect.html#width">width</a>()-d)/2, +<a name="x1199"></a> v.<a href="ntqrect.html#top">top</a>() + (v.<a href="ntqrect.html#height">height</a>()-d)/2, d, d ); - <a href="qpointarray.html">TQPointArray</a> pts; + <a href="ntqpointarray.html">TQPointArray</a> pts; - paint-><a href="qpainter.html#save">save</a>(); -<a name="x1188"></a> paint-><a href="qpainter.html#rotate">rotate</a>( 30*(time.hour()%12-3) + time.minute()/2 ); + paint-><a href="ntqpainter.html#save">save</a>(); +<a name="x1188"></a> paint-><a href="ntqpainter.html#rotate">rotate</a>( 30*(time.hour()%12-3) + time.minute()/2 ); <a name="x1196"></a> pts.setPoints( 4, -20,0, 0,-20, 300,0, 0,20 ); -<a name="x1184"></a> paint-><a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>( pts ); -<a name="x1187"></a> paint-><a href="qpainter.html#restore">restore</a>(); +<a name="x1184"></a> paint-><a href="ntqpainter.html#drawConvexPolygon">drawConvexPolygon</a>( pts ); +<a name="x1187"></a> paint-><a href="ntqpainter.html#restore">restore</a>(); - paint-><a href="qpainter.html#save">save</a>(); - paint-><a href="qpainter.html#rotate">rotate</a>( (time.minute()-15)*6 ); + paint-><a href="ntqpainter.html#save">save</a>(); + paint-><a href="ntqpainter.html#rotate">rotate</a>( (time.minute()-15)*6 ); pts.setPoints( 4, -10,0, 0,-10, 400,0, 0,10 ); - paint-><a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>( pts ); - paint-><a href="qpainter.html#restore">restore</a>(); + paint-><a href="ntqpainter.html#drawConvexPolygon">drawConvexPolygon</a>( pts ); + paint-><a href="ntqpainter.html#restore">restore</a>(); for ( int i=0; i<12; i++ ) { -<a name="x1185"></a> paint-><a href="qpainter.html#drawLine">drawLine</a>( 440,0, 460,0 ); - paint-><a href="qpainter.html#rotate">rotate</a>( 30 ); +<a name="x1185"></a> paint-><a href="ntqpainter.html#drawLine">drawLine</a>( 440,0, 460,0 ); + paint-><a href="ntqpainter.html#rotate">rotate</a>( 30 ); } - paint-><a href="qpainter.html#restore">restore</a>(); + paint-><a href="ntqpainter.html#restore">restore</a>(); } -<a name="x1209"></a>void AnalogClock::<a href="qwidget.html#setAutoMask">setAutoMask</a>(bool b) +<a name="x1209"></a>void AnalogClock::<a href="ntqwidget.html#setAutoMask">setAutoMask</a>(bool b) { if (b) - <a href="qwidget.html#setBackgroundMode">setBackgroundMode</a>( PaletteForeground ); + <a href="ntqwidget.html#setBackgroundMode">setBackgroundMode</a>( PaletteForeground ); else - <a href="qwidget.html#setBackgroundMode">setBackgroundMode</a>( PaletteBackground ); - TQWidget::<a href="qwidget.html#setAutoMask">setAutoMask</a>(b); + <a href="ntqwidget.html#setBackgroundMode">setBackgroundMode</a>( PaletteBackground ); + TQWidget::<a href="ntqwidget.html#setAutoMask">setAutoMask</a>(b); } </pre> @@ -248,20 +248,20 @@ void <a name="f387"></a>AnalogClock::drawClock( <a href="qpainter.html">TQPainte *****************************************************************************/ #include "aclock.h" -#include <<a href="qapplication-h.html">qapplication.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> int main( int argc, char **argv ) { - <a href="qapplication.html">TQApplication</a> a( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); AnalogClock *clock = new AnalogClock; if ( argc == 2 && strcmp( argv[1], "-transparent" ) == 0 ) -<a name="x1213"></a> clock-><a href="qwidget.html#setAutoMask">setAutoMask</a>( TRUE ); -<a name="x1212"></a> clock-><a href="qwidget.html#resize">resize</a>( 100, 100 ); - a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( clock ); -<a name="x1214"></a> clock-><a href="qwidget.html#setCaption">setCaption</a>("TQt Example - Analog Clock"); -<a name="x1215"></a> clock-><a href="qwidget.html#show">show</a>(); - int result = a.<a href="qapplication.html#exec">exec</a>(); +<a name="x1213"></a> clock-><a href="ntqwidget.html#setAutoMask">setAutoMask</a>( TRUE ); +<a name="x1212"></a> clock-><a href="ntqwidget.html#resize">resize</a>( 100, 100 ); + a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( clock ); +<a name="x1214"></a> clock-><a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - Analog Clock"); +<a name="x1215"></a> clock-><a href="ntqwidget.html#show">show</a>(); + int result = a.<a href="ntqapplication.html#exec">exec</a>(); delete clock; return result; } |