diff options
Diffstat (limited to 'doc/html/drawdemo-example.html')
-rw-r--r-- | doc/html/drawdemo-example.html | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/doc/html/drawdemo-example.html b/doc/html/drawdemo-example.html index d6dabc878..98fae3588 100644 --- a/doc/html/drawdemo-example.html +++ b/doc/html/drawdemo-example.html @@ -47,13 +47,13 @@ You can easily add you own drawing functions. ** *****************************************************************************/ -#include <<a href="qwidget-h.html">qwidget.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qprinter-h.html">qprinter.h</a>> -#include <<a href="qpushbutton-h.html">qpushbutton.h</a>> -#include <<a href="qradiobutton-h.html">qradiobutton.h</a>> -#include <<a href="qbuttongroup-h.html">qbuttongroup.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> +#include <<a href="qwidget-h.html">ntqwidget.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qprinter-h.html">ntqprinter.h</a>> +#include <<a href="qpushbutton-h.html">ntqpushbutton.h</a>> +#include <<a href="qradiobutton-h.html">ntqradiobutton.h</a>> +#include <<a href="qbuttongroup-h.html">ntqbuttongroup.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> #include <math.h> // @@ -66,29 +66,29 @@ You can easily add you own drawing functions. // The coordinate system x=(0..500), y=(0..500) spans the paint device. // -void drawColorWheel( <a href="qpainter.html">TQPainter</a> *p ) +void drawColorWheel( <a href="ntqpainter.html">TQPainter</a> *p ) { - <a href="qfont.html">TQFont</a> f( "times", 18, TQFont::Bold ); -<a name="x1075"></a> p-><a href="qpainter.html#setFont">setFont</a>( f ); -<a name="x1076"></a> p-><a href="qpainter.html#setPen">setPen</a>( TQt::black ); -<a name="x1077"></a> p-><a href="qpainter.html#setWindow">setWindow</a>( 0, 0, 500, 500 ); // defines coordinate system + <a href="ntqfont.html">TQFont</a> f( "times", 18, TQFont::Bold ); +<a name="x1075"></a> p-><a href="ntqpainter.html#setFont">setFont</a>( f ); +<a name="x1076"></a> p-><a href="ntqpainter.html#setPen">setPen</a>( TQt::black ); +<a name="x1077"></a> p-><a href="ntqpainter.html#setWindow">setWindow</a>( 0, 0, 500, 500 ); // defines coordinate system for ( int i=0; i<36; i++ ) { // draws 36 rotated rectangles - <a href="qwmatrix.html">TQWMatrix</a> matrix; -<a name="x1097"></a> matrix.<a href="qwmatrix.html#translate">translate</a>( 250.0F, 250.0F ); // move to center -<a name="x1096"></a> matrix.<a href="qwmatrix.html#shear">shear</a>( 0.0F, 0.3F ); // twist it -<a name="x1095"></a> matrix.<a href="qwmatrix.html#rotate">rotate</a>( (float)i*10 ); // rotate 0,10,20,.. degrees -<a name="x1078"></a> p-><a href="qpainter.html#setWorldMatrix">setWorldMatrix</a>( matrix ); // use this world matrix + <a href="ntqwmatrix.html">TQWMatrix</a> matrix; +<a name="x1097"></a> matrix.<a href="ntqwmatrix.html#translate">translate</a>( 250.0F, 250.0F ); // move to center +<a name="x1096"></a> matrix.<a href="ntqwmatrix.html#shear">shear</a>( 0.0F, 0.3F ); // twist it +<a name="x1095"></a> matrix.<a href="ntqwmatrix.html#rotate">rotate</a>( (float)i*10 ); // rotate 0,10,20,.. degrees +<a name="x1078"></a> p-><a href="ntqpainter.html#setWorldMatrix">setWorldMatrix</a>( matrix ); // use this world matrix - <a href="qcolor.html">TQColor</a> c; -<a name="x1063"></a> c.<a href="qcolor.html#setHsv">setHsv</a>( i*10, 255, 255 ); // rainbow effect -<a name="x1074"></a> p-><a href="qpainter.html#setBrush">setBrush</a>( c ); // solid fill with color c -<a name="x1070"></a> p-><a href="qpainter.html#drawRect">drawRect</a>( 70, -10, 80, 10 ); // draw the rectangle + <a href="ntqcolor.html">TQColor</a> c; +<a name="x1063"></a> c.<a href="ntqcolor.html#setHsv">setHsv</a>( i*10, 255, 255 ); // rainbow effect +<a name="x1074"></a> p-><a href="ntqpainter.html#setBrush">setBrush</a>( c ); // solid fill with color c +<a name="x1070"></a> p-><a href="ntqpainter.html#drawRect">drawRect</a>( 70, -10, 80, 10 ); // draw the rectangle - <a href="qstring.html">TQString</a> n; - n.<a href="qstring.html#sprintf">sprintf</a>( "H=%d", i*10 ); -<a name="x1072"></a> p-><a href="qpainter.html#drawText">drawText</a>( 80+70+5, 0, n ); // draw the hue number + <a href="ntqstring.html">TQString</a> n; + n.<a href="ntqstring.html#sprintf">sprintf</a>( "H=%d", i*10 ); +<a name="x1072"></a> p-><a href="ntqpainter.html#drawText">drawText</a>( 80+70+5, 0, n ); // draw the hue number } } @@ -97,7 +97,7 @@ void drawColorWheel( <a href="qpainter.html">TQPainter</a> *p ) // This function draws a few lines of text using different fonts. // -void drawFonts( <a href="qpainter.html">TQPainter</a> *p ) +void drawFonts( <a href="ntqpainter.html">TQPainter</a> *p ) { static const char *fonts[] = { "Helvetica", "Courier", "Times", 0 }; static int sizes[] = { 10, 12, 18, 24, 36, 0 }; @@ -106,12 +106,12 @@ void drawFonts( <a href="qpainter.html">TQPainter</a> *p ) while ( fonts[f] ) { int s = 0; while ( sizes[s] ) { - <a href="qfont.html">TQFont</a> font( fonts[f], sizes[s] ); - p-><a href="qpainter.html#setFont">setFont</a>( font ); -<a name="x1073"></a> <a href="qfontmetrics.html">TQFontMetrics</a> fm = p-><a href="qpainter.html#fontMetrics">fontMetrics</a>(); -<a name="x1064"></a> y += fm.<a href="qfontmetrics.html#ascent">ascent</a>(); - p-><a href="qpainter.html#drawText">drawText</a>( 10, y, "Quartz Glyph Job Vex'd Cwm Finks" ); -<a name="x1065"></a> y += fm.<a href="qfontmetrics.html#descent">descent</a>(); + <a href="ntqfont.html">TQFont</a> font( fonts[f], sizes[s] ); + p-><a href="ntqpainter.html#setFont">setFont</a>( font ); +<a name="x1073"></a> <a href="ntqfontmetrics.html">TQFontMetrics</a> fm = p-><a href="ntqpainter.html#fontMetrics">fontMetrics</a>(); +<a name="x1064"></a> y += fm.<a href="ntqfontmetrics.html#ascent">ascent</a>(); + p-><a href="ntqpainter.html#drawText">drawText</a>( 10, y, "Quartz Glyph Job Vex'd Cwm Finks" ); +<a name="x1065"></a> y += fm.<a href="ntqfontmetrics.html#descent">descent</a>(); s++; } f++; @@ -123,22 +123,22 @@ void drawFonts( <a href="qpainter.html">TQPainter</a> *p ) // This function draws some shapes // -void drawShapes( <a href="qpainter.html">TQPainter</a> *p ) +void drawShapes( <a href="ntqpainter.html">TQPainter</a> *p ) { - <a href="qbrush.html">TQBrush</a> b1( TQt::blue ); - <a href="qbrush.html">TQBrush</a> b2( TQt::green, TQt::Dense6Pattern ); // green 12% fill - <a href="qbrush.html">TQBrush</a> b3( TQt::NoBrush ); // void brush - <a href="qbrush.html">TQBrush</a> b4( TQt::CrossPattern ); // black cross pattern - - p-><a href="qpainter.html#setPen">setPen</a>( TQt::red ); - p-><a href="qpainter.html#setBrush">setBrush</a>( b1 ); - p-><a href="qpainter.html#drawRect">drawRect</a>( 10, 10, 200, 100 ); - p-><a href="qpainter.html#setBrush">setBrush</a>( b2 ); -<a name="x1071"></a> p-><a href="qpainter.html#drawRoundRect">drawRoundRect</a>( 10, 150, 200, 100, 20, 20 ); - p-><a href="qpainter.html#setBrush">setBrush</a>( b3 ); -<a name="x1068"></a> p-><a href="qpainter.html#drawEllipse">drawEllipse</a>( 250, 10, 200, 100 ); - p-><a href="qpainter.html#setBrush">setBrush</a>( b4 ); -<a name="x1069"></a> p-><a href="qpainter.html#drawPie">drawPie</a>( 250, 150, 200, 100, 45*16, 90*16 ); + <a href="ntqbrush.html">TQBrush</a> b1( TQt::blue ); + <a href="ntqbrush.html">TQBrush</a> b2( TQt::green, TQt::Dense6Pattern ); // green 12% fill + <a href="ntqbrush.html">TQBrush</a> b3( TQt::NoBrush ); // void brush + <a href="ntqbrush.html">TQBrush</a> b4( TQt::CrossPattern ); // black cross pattern + + p-><a href="ntqpainter.html#setPen">setPen</a>( TQt::red ); + p-><a href="ntqpainter.html#setBrush">setBrush</a>( b1 ); + p-><a href="ntqpainter.html#drawRect">drawRect</a>( 10, 10, 200, 100 ); + p-><a href="ntqpainter.html#setBrush">setBrush</a>( b2 ); +<a name="x1071"></a> p-><a href="ntqpainter.html#drawRoundRect">drawRoundRect</a>( 10, 150, 200, 100, 20, 20 ); + p-><a href="ntqpainter.html#setBrush">setBrush</a>( b3 ); +<a name="x1068"></a> p-><a href="ntqpainter.html#drawEllipse">drawEllipse</a>( 250, 10, 200, 100 ); + p-><a href="ntqpainter.html#setBrush">setBrush</a>( b4 ); +<a name="x1069"></a> p-><a href="ntqpainter.html#drawPie">drawPie</a>( 250, 150, 200, 100, 45*16, 90*16 ); } @@ -168,7 +168,7 @@ DrawThing ourDrawFunctions[] = { -class DrawView : public <a href="qwidget.html">TQWidget</a> +class DrawView : public <a href="ntqwidget.html">TQWidget</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: @@ -178,13 +178,13 @@ public slots: void updateIt( int ); void printIt(); protected: - void drawIt( <a href="qpainter.html">TQPainter</a> * ); + void drawIt( <a href="ntqpainter.html">TQPainter</a> * ); void paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> * ); void resizeEvent( <a href="qresizeevent.html">TQResizeEvent</a> * ); private: - <a href="qprinter.html">TQPrinter</a> *printer; - <a href="qbuttongroup.html">TQButtonGroup</a> *bgroup; - <a href="qpushbutton.html">TQPushButton</a> *print; + <a href="ntqprinter.html">TQPrinter</a> *printer; + <a href="ntqbuttongroup.html">TQButtonGroup</a> *bgroup; + <a href="ntqpushbutton.html">TQPushButton</a> *print; int drawindex; int maxindex; }; @@ -196,27 +196,27 @@ private: <a name="f367"></a>DrawView::DrawView() { - <a href="qwidget.html#setCaption">setCaption</a>( "TQt Draw Demo Application" ); - <a href="qwidget.html#setBackgroundMode">setBackgroundMode</a>(PaletteBase); + <a href="ntqwidget.html#setCaption">setCaption</a>( "TQt Draw Demo Application" ); + <a href="ntqwidget.html#setBackgroundMode">setBackgroundMode</a>(PaletteBase); // Create a button group to contain all buttons - bgroup = new <a href="qbuttongroup.html">TQButtonGroup</a>( this ); -<a name="x1088"></a> bgroup-><a href="qwidget.html#resize">resize</a>( 200, 200 ); -<a name="x1062"></a> <a href="qobject.html#connect">connect</a>( bgroup, SIGNAL(<a href="qbuttongroup.html#clicked">clicked</a>(int)), SLOT(updateIt(int)) ); + bgroup = new <a href="ntqbuttongroup.html">TQButtonGroup</a>( this ); +<a name="x1088"></a> bgroup-><a href="ntqwidget.html#resize">resize</a>( 200, 200 ); +<a name="x1062"></a> <a href="ntqobject.html#connect">connect</a>( bgroup, SIGNAL(<a href="ntqbuttongroup.html#clicked">clicked</a>(int)), SLOT(updateIt(int)) ); // Calculate the size for the radio buttons int maxwidth = 80; int maxheight = 10; int i; const char *n; -<a name="x1084"></a> <a href="qfontmetrics.html">TQFontMetrics</a> fm = bgroup-><a href="qwidget.html#fontMetrics">fontMetrics</a>(); +<a name="x1084"></a> <a href="ntqfontmetrics.html">TQFontMetrics</a> fm = bgroup-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>(); // Find out the longest function description. // Here we make use of the last "0,0"-entry in the // ourDrawFunctions-array. for ( i=0; (n=ourDrawFunctions[i].name) != 0; i++ ) { -<a name="x1066"></a> int w = fm.<a href="qfontmetrics.html#width">width</a>( n ); - maxwidth = TQMAX(w,maxwidth); // TQMAX is a macro defined in qglobal.h +<a name="x1066"></a> int w = fm.<a href="ntqfontmetrics.html#width">width</a>( n ); + maxwidth = TQMAX(w,maxwidth); // TQMAX is a macro defined in ntqglobal.h // and returns the biggest of to values. // Due to its macro nature one should use it with care and with // constant parameters only. @@ -225,13 +225,13 @@ private: maxwidth = maxwidth + 30; // allow 30 pixels for radiobuttons for ( i=0; (n=ourDrawFunctions[i].name) != 0; i++ ) { - <a href="qradiobutton.html">TQRadioButton</a> *rb = new <a href="qradiobutton.html">TQRadioButton</a>( n, bgroup ); -<a name="x1091"></a> rb-><a href="qwidget.html#setGeometry">setGeometry</a>( 10, i*30+10, maxwidth, 30 ); + <a href="ntqradiobutton.html">TQRadioButton</a> *rb = new <a href="ntqradiobutton.html">TQRadioButton</a>( n, bgroup ); +<a name="x1091"></a> rb-><a href="ntqwidget.html#setGeometry">setGeometry</a>( 10, i*30+10, maxwidth, 30 ); maxheight += 30; if ( i == 0 ) -<a name="x1082"></a> rb-><a href="qradiobutton.html#setChecked">setChecked</a>( TRUE ); +<a name="x1082"></a> rb-><a href="ntqradiobutton.html#setChecked">setChecked</a>( TRUE ); } maxheight += 10; // maxheight is now 10 pixels upper margin @@ -244,7 +244,7 @@ private: maxwidth += 20; // add some margin, this results in the // final width of bgroup - bgroup-><a href="qwidget.html#resize">resize</a>( maxwidth, maxheight ); // resize bgroup to its final size + bgroup-><a href="ntqwidget.html#resize">resize</a>( maxwidth, maxheight ); // resize bgroup to its final size // when no printersupport is provided @@ -253,20 +253,20 @@ private: #ifndef QT_NO_PRINTER - printer = new <a href="qprinter.html">TQPrinter</a>; + printer = new <a href="ntqprinter.html">TQPrinter</a>; // Create and setup the print button - print = new <a href="qpushbutton.html">TQPushButton</a>( "Print...", bgroup ); -<a name="x1081"></a> print-><a href="qwidget.html#resize">resize</a>( 80, 30 ); -<a name="x1093"></a><a name="x1080"></a> print-><a href="qwidget.html#move">move</a>( maxwidth/2 - print-><a href="qwidget.html#width">width</a>()/2, maxindex*30+20 ); - <a href="qobject.html#connect">connect</a>( print, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), SLOT(printIt()) ); + print = new <a href="ntqpushbutton.html">TQPushButton</a>( "Print...", bgroup ); +<a name="x1081"></a> print-><a href="ntqwidget.html#resize">resize</a>( 80, 30 ); +<a name="x1093"></a><a name="x1080"></a> print-><a href="ntqwidget.html#move">move</a>( maxwidth/2 - print-><a href="ntqwidget.html#width">width</a>()/2, maxindex*30+20 ); + <a href="ntqobject.html#connect">connect</a>( print, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), SLOT(printIt()) ); // Resize bgroup to its final size when printersupport is given. -<a name="x1094"></a><a name="x1085"></a> bgroup-><a href="qwidget.html#resize">resize</a>( maxwidth, print-><a href="qwidget.html#y">y</a>()+print-><a href="qwidget.html#height">height</a>()+10 ); +<a name="x1094"></a><a name="x1085"></a> bgroup-><a href="ntqwidget.html#resize">resize</a>( maxwidth, print-><a href="ntqwidget.html#y">y</a>()+print-><a href="ntqwidget.html#height">height</a>()+10 ); #endif - <a href="qwidget.html#resize">resize</a>( 640,300 ); + <a href="ntqwidget.html#resize">resize</a>( 640,300 ); } // @@ -287,7 +287,7 @@ void <a name="f368"></a>DrawView::updateIt( int index ) { if ( index < maxindex ) { drawindex = index; - <a href="qwidget.html#update">update</a>(); + <a href="ntqwidget.html#update">update</a>(); } } @@ -295,7 +295,7 @@ void <a name="f368"></a>DrawView::updateIt( int index ) // Calls the drawing function as specified by the radio buttons. // -void <a name="f369"></a>DrawView::drawIt( <a href="qpainter.html">TQPainter</a> *p ) +void <a name="f369"></a>DrawView::drawIt( <a href="ntqpainter.html">TQPainter</a> *p ) { (*ourDrawFunctions[drawindex].f)(p); } @@ -306,9 +306,9 @@ void <a name="f369"></a>DrawView::drawIt( <a href="qpainter.html">TQPainter</a> void <a name="f370"></a>DrawView::printIt() { -<a name="x1079"></a> if ( printer-><a href="qprinter.html#setup">setup</a>( this ) ) { - <a href="qpainter.html">TQPainter</a> paint; -<a name="x1067"></a> if( !paint.<a href="qpainter.html#begin">begin</a>( printer ) ) +<a name="x1079"></a> if ( printer-><a href="ntqprinter.html#setup">setup</a>( this ) ) { + <a href="ntqpainter.html">TQPainter</a> paint; +<a name="x1067"></a> if( !paint.<a href="ntqpainter.html#begin">begin</a>( printer ) ) return; drawIt( &paint ); } @@ -318,9 +318,9 @@ void <a name="f370"></a>DrawView::printIt() // Called when the widget needs to be updated. // -void DrawView::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) +void DrawView::<a href="ntqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) { - <a href="qpainter.html">TQPainter</a> paint( this ); + <a href="ntqpainter.html">TQPainter</a> paint( this ); drawIt( &paint ); } @@ -329,9 +329,9 @@ void DrawView::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaint // Moves the button group to the upper right corner // of the widget. -<a name="x1089"></a>void DrawView::<a href="qwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) +<a name="x1089"></a>void DrawView::<a href="ntqwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) { -<a name="x1086"></a> bgroup-><a href="qwidget.html#move">move</a>( <a href="qwidget.html#width">width</a>()-bgroup-><a href="qwidget.html#width">width</a>(), 0 ); +<a name="x1086"></a> bgroup-><a href="ntqwidget.html#move">move</a>( <a href="ntqwidget.html#width">width</a>()-bgroup-><a href="ntqwidget.html#width">width</a>(), 0 ); } @@ -343,12 +343,12 @@ void DrawView::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaint int main( int argc, char **argv ) { - <a href="qapplication.html">TQApplication</a> app( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); DrawView draw; - app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &draw ); - draw.<a href="qwidget.html#setCaption">setCaption</a>("TQt Example - Drawdemo"); - draw.<a href="qwidget.html#show">show</a>(); - return app.<a href="qapplication.html#exec">exec</a>(); + app.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &draw ); + draw.<a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - Drawdemo"); + draw.<a href="ntqwidget.html#show">show</a>(); + return app.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |