diff options
Diffstat (limited to 'doc/html/canvas-example.html')
-rw-r--r-- | doc/html/canvas-example.html | 258 |
1 files changed, 129 insertions, 129 deletions
diff --git a/doc/html/canvas-example.html b/doc/html/canvas-example.html index 665b0f7e6..0c0726857 100644 --- a/doc/html/canvas-example.html +++ b/doc/html/canvas-example.html @@ -33,7 +33,7 @@ body { background: #ffffff; color: black; } <p> -This example shows a <a href="ntqcanvas.html">TQCanvas</a> and some <a href="qcanvasitem.html">TQCanvasItem</a>s in action. +This example shows a <a href="tqcanvas.html">TQCanvas</a> and some <a href="tqcanvasitem.html">TQCanvasItem</a>s in action. You can do a lot more with TQCanvas than we show here, but the example provides a taste of what can be done. <p> <hr> @@ -44,9 +44,9 @@ example provides a taste of what can be done. #include <<a href="qpopupmenu-h.html">ntqpopupmenu.h</a>> #include <<a href="qmainwindow-h.html">ntqmainwindow.h</a>> #include <<a href="qintdict-h.html">ntqintdict.h</a>> -#include <<a href="qcanvas-h.html">ntqcanvas.h</a>> +#include <<a href="tqcanvas-h.html">tqcanvas.h</a>> -class BouncyLogo : public <a href="qcanvassprite.html">TQCanvasSprite</a> { +class BouncyLogo : public <a href="tqcanvassprite.html">TQCanvasSprite</a> { void initPos(); void initSpeed(); public: @@ -56,7 +56,7 @@ public: }; -class FigureEditor : public <a href="qcanvasview.html">TQCanvasView</a> { +class FigureEditor : public <a href="tqcanvasview.html">TQCanvasView</a> { <a href="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> public: @@ -71,7 +71,7 @@ signals: void status(const <a href="ntqstring.html">TQString</a>&); private: - <a href="qcanvasitem.html">TQCanvasItem</a>* moving; + <a href="tqcanvasitem.html">TQCanvasItem</a>* moving; <a href="ntqpoint.html">TQPoint</a> moving_start; }; @@ -120,7 +120,7 @@ private slots: void toggleDoubleBuffer(); private: - <a href="ntqcanvas.html">TQCanvas</a>& canvas; + <a href="tqcanvas.html">TQCanvas</a>& canvas; FigureEditor *editor; <a href="ntqpopupmenu.html">TQPopupMenu</a>* options; @@ -156,7 +156,7 @@ static TQPen *tp = 0; class EdgeItem; class NodeItem; -class EdgeItem: public <a href="qcanvasline.html">TQCanvasLine</a> +class EdgeItem: public <a href="tqcanvasline.html">TQCanvasLine</a> { public: EdgeItem( NodeItem*, NodeItem*, TQCanvas *canvas ); @@ -171,7 +171,7 @@ private: static const int imageRTTI = 984376; -class ImageItem: public <a href="qcanvasrectangle.html">TQCanvasRectangle</a> +class ImageItem: public <a href="tqcanvasrectangle.html">TQCanvasRectangle</a> { public: ImageItem( <a href="ntqimage.html">TQImage</a> img, TQCanvas *canvas ); @@ -186,9 +186,9 @@ private: <a name="f623"></a>ImageItem::ImageItem( <a href="ntqimage.html">TQImage</a> img, TQCanvas *canvas ) - : <a href="qcanvasrectangle.html">TQCanvasRectangle</a>( canvas ), image(img) + : <a href="tqcanvasrectangle.html">TQCanvasRectangle</a>( canvas ), image(img) { -<a name="x2935"></a><a name="x2932"></a> <a href="qcanvasrectangle.html#setSize">setSize</a>( image.<a href="ntqimage.html#width">width</a>(), image.<a href="ntqimage.html#height">height</a>() ); +<a name="x2935"></a><a name="x2932"></a> <a href="tqcanvasrectangle.html#setSize">setSize</a>( image.<a href="ntqimage.html#width">width</a>(), image.<a href="ntqimage.html#height">height</a>() ); #if !defined(TQ_WS_QWS) <a name="x2943"></a> pixmap.<a href="ntqpixmap.html#convertFromImage">convertFromImage</a>(image, OrderedAlphaDither); @@ -196,31 +196,31 @@ private: } -<a name="x2925"></a>void ImageItem::<a href="qcanvasrectangle.html#drawShape">drawShape</a>( <a href="ntqpainter.html">TQPainter</a> &p ) +<a name="x2925"></a>void ImageItem::<a href="tqcanvasrectangle.html#drawShape">drawShape</a>( <a href="ntqpainter.html">TQPainter</a> &p ) { // On TQt/Embedded, we can paint a TQImage as fast as a TQPixmap, // but on other platforms, we need to use a TQPixmap. #if defined(TQ_WS_QWS) -<a name="x2941"></a> p.<a href="ntqpainter.html#drawImage">drawImage</a>( int(<a href="qcanvasitem.html#x">x</a>()), int(<a href="qcanvasitem.html#y">y</a>()), image, 0, 0, -1, -1, OrderedAlphaDither ); +<a name="x2941"></a> p.<a href="ntqpainter.html#drawImage">drawImage</a>( int(<a href="tqcanvasitem.html#x">x</a>()), int(<a href="tqcanvasitem.html#y">y</a>()), image, 0, 0, -1, -1, OrderedAlphaDither ); #else - p.<a href="ntqpainter.html#drawPixmap">drawPixmap</a>( int(<a href="qcanvasitem.html#x">x</a>()), int(<a href="qcanvasitem.html#y">y</a>()), pixmap ); + p.<a href="ntqpainter.html#drawPixmap">drawPixmap</a>( int(<a href="tqcanvasitem.html#x">x</a>()), int(<a href="tqcanvasitem.html#y">y</a>()), pixmap ); #endif } bool <a name="f624"></a>ImageItem::hit( const <a href="ntqpoint.html">TQPoint</a> &p ) const { -<a name="x2944"></a> int ix = p.<a href="ntqpoint.html#x">x</a>()-int(<a href="qcanvasitem.html#x">x</a>()); -<a name="x2945"></a> int iy = p.<a href="ntqpoint.html#y">y</a>()-int(<a href="qcanvasitem.html#y">y</a>()); +<a name="x2944"></a> int ix = p.<a href="ntqpoint.html#x">x</a>()-int(<a href="tqcanvasitem.html#x">x</a>()); +<a name="x2945"></a> int iy = p.<a href="ntqpoint.html#y">y</a>()-int(<a href="tqcanvasitem.html#y">y</a>()); <a name="x2934"></a> if ( !image.<a href="ntqimage.html#valid">valid</a>( ix , iy ) ) return FALSE; <a name="x2933"></a> TQRgb pixel = image.<a href="ntqimage.html#pixel">pixel</a>( ix, iy ); return tqAlpha( pixel ) != 0; } -class NodeItem: public <a href="qcanvasellipse.html">TQCanvasEllipse</a> +class NodeItem: public <a href="tqcanvasellipse.html">TQCanvasEllipse</a> { public: - NodeItem( <a href="ntqcanvas.html">TQCanvas</a> *canvas ); + NodeItem( <a href="tqcanvas.html">TQCanvas</a> *canvas ); ~NodeItem() {} void addInEdge( EdgeItem *edge ) { inList.<a href="ntqptrlist.html#append">append</a>( edge ); } @@ -238,20 +238,20 @@ private: int EdgeItem::c = 0; -<a name="x2916"></a>void EdgeItem::<a href="qcanvasitem.html#moveBy">moveBy</a>(double, double) +<a name="x2916"></a>void EdgeItem::<a href="tqcanvasitem.html#moveBy">moveBy</a>(double, double) { //nothing } <a name="f618"></a>EdgeItem::EdgeItem( NodeItem *from, NodeItem *to, TQCanvas *canvas ) - : <a href="qcanvasline.html">TQCanvasLine</a>( canvas ) + : <a href="tqcanvasline.html">TQCanvasLine</a>( canvas ) { c++; setPen( *tp ); setBrush( *tb ); from->addOutEdge( this ); to->addInEdge( this ); -<a name="x2921"></a><a name="x2920"></a> setPoints( int(from-><a href="qcanvasitem.html#x">x</a>()), int(from-><a href="qcanvasitem.html#y">y</a>()), int(to->x()), int(to->y()) ); +<a name="x2921"></a><a name="x2920"></a> setPoints( int(from-><a href="tqcanvasitem.html#x">x</a>()), int(from-><a href="tqcanvasitem.html#y">y</a>()), int(to->x()), int(to->y()) ); setZ( 127 ); } @@ -267,42 +267,42 @@ void <a name="f620"></a>EdgeItem::setToPoint( int x, int y ) -void NodeItem::<a href="qcanvasitem.html#moveBy">moveBy</a>(double dx, double dy) +void NodeItem::<a href="tqcanvasitem.html#moveBy">moveBy</a>(double dx, double dy) { - TQCanvasEllipse::<a href="qcanvasitem.html#moveBy">moveBy</a>( dx, dy ); + TQCanvasEllipse::<a href="tqcanvasitem.html#moveBy">moveBy</a>( dx, dy ); <a href="qptrlistiterator.html">TQPtrListIterator</a><EdgeItem> it1( inList ); EdgeItem *edge; <a name="x2949"></a> while (( edge = it1.<a href="qptrlistiterator.html#current">current</a>() )) { ++it1; - edge->setToPoint( int(<a href="ntqwidget.html#x">x</a>()), int(<a href="qcanvasitem.html#y">y</a>()) ); + edge->setToPoint( int(<a href="ntqwidget.html#x">x</a>()), int(<a href="tqcanvasitem.html#y">y</a>()) ); } <a href="qptrlistiterator.html">TQPtrListIterator</a><EdgeItem> it2( outList ); while (( edge = it2.<a href="qptrlistiterator.html#current">current</a>() )) { ++it2; - edge->setFromPoint( int(<a href="qcanvasitem.html#x">x</a>()), int(<a href="qcanvasitem.html#y">y</a>()) ); + edge->setFromPoint( int(<a href="tqcanvasitem.html#x">x</a>()), int(<a href="tqcanvasitem.html#y">y</a>()) ); } } -<a name="f655"></a>NodeItem::NodeItem( <a href="ntqcanvas.html">TQCanvas</a> *canvas ) - : <a href="qcanvasellipse.html">TQCanvasEllipse</a>( 6, 6, canvas ) +<a name="f655"></a>NodeItem::NodeItem( <a href="tqcanvas.html">TQCanvas</a> *canvas ) + : <a href="tqcanvasellipse.html">TQCanvasEllipse</a>( 6, 6, canvas ) { setPen( *tp ); setBrush( *tb ); - <a href="qcanvasitem.html#setZ">setZ</a>( 128 ); + <a href="tqcanvasitem.html#setZ">setZ</a>( 128 ); } <a name="f621"></a>FigureEditor::FigureEditor( - <a href="ntqcanvas.html">TQCanvas</a>& c, TQWidget* parent, + <a href="tqcanvas.html">TQCanvas</a>& c, TQWidget* parent, const char* name, WFlags f) : - <a href="qcanvasview.html">TQCanvasView</a>(&c,parent,name,f) + <a href="tqcanvasview.html">TQCanvasView</a>(&c,parent,name,f) { } <a name="x2951"></a>void FigureEditor::<a href="ntqscrollview.html#contentsMousePressEvent">contentsMousePressEvent</a>(TQMouseEvent* e) { <a href="ntqpoint.html">TQPoint</a> p = inverseWorldMatrix().map(e->pos()); - <a href="qcanvasitemlist.html">TQCanvasItemList</a> l=<a href="qcanvasitem.html#canvas">canvas</a>()->collisions(p); + <a href="tqcanvasitemlist.html">TQCanvasItemList</a> l=<a href="tqcanvasitem.html#canvas">canvas</a>()->collisions(p); <a name="x2953"></a><a name="x2952"></a> for (TQCanvasItemList::Iterator it=l.<a href="ntqvaluelist.html#begin">begin</a>(); it!=l.<a href="ntqvaluelist.html#end">end</a>(); ++it) { if ( (*it)->rtti() == imageRTTI ) { ImageItem *item= (ImageItem*)(*it); @@ -318,7 +318,7 @@ void NodeItem::<a href="qcanvasitem.html#moveBy">moveBy</a>(double dx, double dy void <a name="f622"></a>FigureEditor::clear() { - <a href="qcanvasitemlist.html">TQCanvasItemList</a> list = <a href="qcanvasitem.html#canvas">canvas</a>()->allItems(); + <a href="tqcanvasitemlist.html">TQCanvasItemList</a> list = <a href="tqcanvasitem.html#canvas">canvas</a>()->allItems(); TQCanvasItemList::Iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>(); for (; it != list.<a href="ntqvaluelist.html#end">end</a>(); ++it) { if ( *it ) @@ -333,25 +333,25 @@ void <a name="f622"></a>FigureEditor::clear() moving->moveBy(p.<a href="ntqpoint.html#x">x</a>() - moving_start.x(), p.<a href="ntqpoint.html#y">y</a>() - moving_start.y()); moving_start = p; - <a href="qcanvasitem.html#canvas">canvas</a>()->update(); + <a href="tqcanvasitem.html#canvas">canvas</a>()->update(); } } <a name="f615"></a>BouncyLogo::BouncyLogo(TQCanvas* canvas) : - <a href="qcanvassprite.html">TQCanvasSprite</a>(0,canvas) + <a href="tqcanvassprite.html">TQCanvasSprite</a>(0,canvas) { static TQCanvasPixmapArray logo("qt-trans.xpm"); - <a href="qcanvassprite.html#setSequence">setSequence</a>(&logo); - <a href="qcanvasitem.html#setAnimated">setAnimated</a>(TRUE); + <a href="tqcanvassprite.html#setSequence">setSequence</a>(&logo); + <a href="tqcanvasitem.html#setAnimated">setAnimated</a>(TRUE); initPos(); } const int logo_rtti = 1234; -<a name="x2928"></a>int BouncyLogo::<a href="qcanvassprite.html#rtti">rtti</a>() const +<a name="x2928"></a>int BouncyLogo::<a href="tqcanvassprite.html#rtti">rtti</a>() const { return logo_rtti; } @@ -361,7 +361,7 @@ void <a name="f616"></a>BouncyLogo::initPos() initSpeed(); int trial=1000; do { - <a href="qcanvassprite.html#move">move</a>(rand()%canvas()->width(),rand()%canvas()->height()); + <a href="tqcanvassprite.html#move">move</a>(rand()%canvas()->width(),rand()%canvas()->height()); advance(0); } while (trial-- && xVelocity()==0.0 && yVelocity()==0.0); } @@ -373,7 +373,7 @@ void <a name="f617"></a>BouncyLogo::initSpeed() setVelocity( d*speed*2-speed, (1-d)*speed*2-speed ); } -<a name="x2927"></a>void BouncyLogo::<a href="qcanvassprite.html#advance">advance</a>(int stage) +<a name="x2927"></a>void BouncyLogo::<a href="tqcanvassprite.html#advance">advance</a>(int stage) { switch ( stage ) { case 0: { @@ -396,10 +396,10 @@ void <a name="f617"></a>BouncyLogo::initSpeed() vy = -vy; for (int bounce=0; bounce<4; bounce++) { - <a href="qcanvasitemlist.html">TQCanvasItemList</a> l=collisions(FALSE); + <a href="tqcanvasitemlist.html">TQCanvasItemList</a> l=collisions(FALSE); for (TQCanvasItemList::Iterator it=l.<a href="ntqvaluelist.html#begin">begin</a>(); it!=l.<a href="ntqvaluelist.html#end">end</a>(); ++it) { - <a href="qcanvasitem.html">TQCanvasItem</a> *hit = *it; -<a name="x2917"></a><a name="x2914"></a> if ( hit-><a href="qcanvasitem.html#rtti">rtti</a>()==logo_rtti && hit-><a href="qcanvasitem.html#collidesWith">collidesWith</a>(this) ) { + <a href="tqcanvasitem.html">TQCanvasItem</a> *hit = *it; +<a name="x2917"></a><a name="x2914"></a> if ( hit-><a href="tqcanvasitem.html#rtti">rtti</a>()==logo_rtti && hit-><a href="tqcanvasitem.html#collidesWith">collidesWith</a>(this) ) { switch ( bounce ) { case 0: vx = -vx; @@ -431,7 +431,7 @@ void <a name="f617"></a>BouncyLogo::initSpeed() setVelocity(vx,vy); } break; case 1: -<a name="x2913"></a> <a href="qcanvasitem.html">TQCanvasItem</a>::<a href="qcanvasitem.html#advance">advance</a>(stage); +<a name="x2913"></a> <a href="tqcanvasitem.html">TQCanvasItem</a>::<a href="tqcanvasitem.html#advance">advance</a>(stage); break; } } @@ -518,13 +518,13 @@ void <a name="f626"></a>Main::init() logoimg = 0; int i; -<a name="x2912"></a> for ( i=0; i<canvas.<a href="ntqcanvas.html#width">width</a>() / 56; i++) { +<a name="x2912"></a> for ( i=0; i<canvas.<a href="tqcanvas.html#width">width</a>() / 56; i++) { addButterfly(); } - for ( i=0; i<canvas.<a href="ntqcanvas.html#width">width</a>() / 85; i++) { + for ( i=0; i<canvas.<a href="tqcanvas.html#width">width</a>() / 85; i++) { addHexagon(); } - for ( i=0; i<canvas.<a href="ntqcanvas.html#width">width</a>() / 128; i++) { + for ( i=0; i<canvas.<a href="tqcanvas.html#width">width</a>() / 128; i++) { addLogo(); } } @@ -578,80 +578,80 @@ void <a name="f631"></a>Main::toggleDoubleBuffer() { <a name="x2938"></a> bool s = !options-><a href="ntqmenudata.html#isItemChecked">isItemChecked</a>(dbf_id); options-><a href="ntqmenudata.html#setItemChecked">setItemChecked</a>(dbf_id,s); -<a name="x2911"></a> canvas.<a href="ntqcanvas.html#setDoubleBuffering">setDoubleBuffering</a>(s); +<a name="x2911"></a> canvas.<a href="tqcanvas.html#setDoubleBuffering">setDoubleBuffering</a>(s); } void <a name="f632"></a>Main::enlarge() { -<a name="x2910"></a><a name="x2909"></a> canvas.<a href="ntqcanvas.html#resize">resize</a>(canvas.<a href="ntqcanvas.html#width">width</a>()*4/3, canvas.<a href="ntqcanvas.html#height">height</a>()*4/3); +<a name="x2910"></a><a name="x2909"></a> canvas.<a href="tqcanvas.html#resize">resize</a>(canvas.<a href="tqcanvas.html#width">width</a>()*4/3, canvas.<a href="tqcanvas.html#height">height</a>()*4/3); } void <a name="f633"></a>Main::shrink() { - canvas.<a href="ntqcanvas.html#resize">resize</a>(canvas.<a href="ntqcanvas.html#width">width</a>()*3/4, canvas.<a href="ntqcanvas.html#height">height</a>()*3/4); + canvas.<a href="tqcanvas.html#resize">resize</a>(canvas.<a href="tqcanvas.html#width">width</a>()*3/4, canvas.<a href="tqcanvas.html#height">height</a>()*3/4); } void <a name="f634"></a>Main::rotateClockwise() { -<a name="x2931"></a> <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); +<a name="x2931"></a> <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); <a name="x2955"></a> m.<a href="ntqwmatrix.html#rotate">rotate</a>( 22.5 ); -<a name="x2930"></a> editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); +<a name="x2930"></a> editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f635"></a>Main::rotateCounterClockwise() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); m.<a href="ntqwmatrix.html#rotate">rotate</a>( -22.5 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f636"></a>Main::zoomIn() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); <a name="x2956"></a> m.<a href="ntqwmatrix.html#scale">scale</a>( 2.0, 2.0 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f637"></a>Main::zoomOut() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); m.<a href="ntqwmatrix.html#scale">scale</a>( 0.5, 0.5 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f638"></a>Main::mirror() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); m.<a href="ntqwmatrix.html#scale">scale</a>( -1, 1 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f639"></a>Main::moveL() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); <a name="x2957"></a> m.<a href="ntqwmatrix.html#translate">translate</a>( -16, 0 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f640"></a>Main::moveR() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); m.<a href="ntqwmatrix.html#translate">translate</a>( +16, 0 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f641"></a>Main::moveU() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); m.<a href="ntqwmatrix.html#translate">translate</a>( 0, -16 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f642"></a>Main::moveD() { - <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="tqcanvasview.html#worldMatrix">worldMatrix</a>(); m.<a href="ntqwmatrix.html#translate">translate</a>( 0, +16 ); - editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); + editor-><a href="tqcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f643"></a>Main::print() @@ -659,16 +659,16 @@ void <a name="f643"></a>Main::print() if ( !printer ) printer = new <a href="ntqprinter.html">TQPrinter</a>; if ( printer->setup(this) ) { <a href="ntqpainter.html">TQPainter</a> pp(printer); -<a name="x2908"></a> canvas.<a href="ntqcanvas.html#drawArea">drawArea</a>(TQRect(0,0,canvas.<a href="ntqcanvas.html#width">width</a>(),canvas.<a href="ntqcanvas.html#height">height</a>()),&pp,FALSE); +<a name="x2908"></a> canvas.<a href="tqcanvas.html#drawArea">drawArea</a>(TQRect(0,0,canvas.<a href="tqcanvas.html#width">width</a>(),canvas.<a href="tqcanvas.html#height">height</a>()),&pp,FALSE); } } void <a name="f644"></a>Main::addSprite() { - <a href="qcanvasitem.html">TQCanvasItem</a>* i = new BouncyLogo(&canvas); -<a name="x2918"></a> i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256); -<a name="x2919"></a> i-><a href="qcanvasitem.html#show">show</a>(); + <a href="tqcanvasitem.html">TQCanvasItem</a>* i = new BouncyLogo(&canvas); +<a name="x2918"></a> i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256); +<a name="x2919"></a> i-><a href="tqcanvasitem.html#show">show</a>(); } TQString butterfly_fn; @@ -689,11 +689,11 @@ void <a name="f645"></a>Main::addButterfly() butterflyimg[3] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.25), int(butterflyimg[0].height()*0.25) ); } - <a href="qcanvaspolygonalitem.html">TQCanvasPolygonalItem</a>* i = new ImageItem(butterflyimg[rand()%4],&canvas); -<a name="x2915"></a> i-><a href="qcanvasitem.html#move">move</a>(rand()%(canvas.<a href="ntqcanvas.html#width">width</a>()-butterflyimg-><a href="ntqimage.html#width">width</a>()), - rand()%(canvas.<a href="ntqcanvas.html#height">height</a>()-butterflyimg-><a href="ntqimage.html#height">height</a>())); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256+250); - i-><a href="qcanvasitem.html#show">show</a>(); + <a href="tqcanvaspolygonalitem.html">TQCanvasPolygonalItem</a>* i = new ImageItem(butterflyimg[rand()%4],&canvas); +<a name="x2915"></a> i-><a href="tqcanvasitem.html#move">move</a>(rand()%(canvas.<a href="tqcanvas.html#width">width</a>()-butterflyimg-><a href="ntqimage.html#width">width</a>()), + rand()%(canvas.<a href="tqcanvas.html#height">height</a>()-butterflyimg-><a href="ntqimage.html#height">height</a>())); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256+250); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f646"></a>Main::addLogo() @@ -710,28 +710,28 @@ void <a name="f646"></a>Main::addLogo() logoimg[3] = logoimg[0].smoothScale( int(logoimg[0].width()*0.25), int(logoimg[0].height()*0.25) ); } - <a href="qcanvaspolygonalitem.html">TQCanvasPolygonalItem</a>* i = new ImageItem(logoimg[rand()%4],&canvas); - i-><a href="qcanvasitem.html#move">move</a>(rand()%(canvas.<a href="ntqcanvas.html#width">width</a>()-logoimg-><a href="ntqimage.html#width">width</a>()), - rand()%(canvas.<a href="ntqcanvas.html#height">height</a>()-logoimg-><a href="ntqimage.html#width">width</a>())); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256+256); - i-><a href="qcanvasitem.html#show">show</a>(); + <a href="tqcanvaspolygonalitem.html">TQCanvasPolygonalItem</a>* i = new ImageItem(logoimg[rand()%4],&canvas); + i-><a href="tqcanvasitem.html#move">move</a>(rand()%(canvas.<a href="tqcanvas.html#width">width</a>()-logoimg-><a href="ntqimage.html#width">width</a>()), + rand()%(canvas.<a href="tqcanvas.html#height">height</a>()-logoimg-><a href="ntqimage.html#width">width</a>())); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256+256); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f647"></a>Main::addCircle() { - <a href="qcanvaspolygonalitem.html">TQCanvasPolygonalItem</a>* i = new <a href="qcanvasellipse.html">TQCanvasEllipse</a>(50,50,&canvas); -<a name="x2923"></a> i-><a href="qcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); - i-><a href="qcanvasitem.html#move">move</a>(rand()%canvas.<a href="ntqcanvas.html#width">width</a>(),rand()%canvas.<a href="ntqcanvas.html#height">height</a>()); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256); - i-><a href="qcanvasitem.html#show">show</a>(); + <a href="tqcanvaspolygonalitem.html">TQCanvasPolygonalItem</a>* i = new <a href="tqcanvasellipse.html">TQCanvasEllipse</a>(50,50,&canvas); +<a name="x2923"></a> i-><a href="tqcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); + i-><a href="tqcanvasitem.html#move">move</a>(rand()%canvas.<a href="tqcanvas.html#width">width</a>(),rand()%canvas.<a href="tqcanvas.html#height">height</a>()); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f648"></a>Main::addHexagon() { - <a href="qcanvaspolygon.html">TQCanvasPolygon</a>* i = new <a href="qcanvaspolygon.html">TQCanvasPolygon</a>(&canvas); - const int size = canvas.<a href="ntqcanvas.html#width">width</a>() / 25; + <a href="tqcanvaspolygon.html">TQCanvasPolygon</a>* i = new <a href="tqcanvaspolygon.html">TQCanvasPolygon</a>(&canvas); + const int size = canvas.<a href="tqcanvas.html#width">width</a>() / 25; <a href="ntqpointarray.html">TQPointArray</a> pa(6); pa[0] = TQPoint(2*size,0); pa[1] = TQPoint(size,-size*173/100); @@ -739,17 +739,17 @@ void <a name="f648"></a>Main::addHexagon() pa[3] = TQPoint(-2*size,0); pa[4] = TQPoint(-size,size*173/100); pa[5] = TQPoint(size,size*173/100); -<a name="x2922"></a> i-><a href="qcanvasline.html#setPoints">setPoints</a>(pa); - i-><a href="qcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); - i-><a href="qcanvasitem.html#move">move</a>(rand()%canvas.<a href="ntqcanvas.html#width">width</a>(),rand()%canvas.<a href="ntqcanvas.html#height">height</a>()); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256); - i-><a href="qcanvasitem.html#show">show</a>(); +<a name="x2922"></a> i-><a href="tqcanvasline.html#setPoints">setPoints</a>(pa); + i-><a href="tqcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); + i-><a href="tqcanvasitem.html#move">move</a>(rand()%canvas.<a href="tqcanvas.html#width">width</a>(),rand()%canvas.<a href="tqcanvas.html#height">height</a>()); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f649"></a>Main::addPolygon() { - <a href="qcanvaspolygon.html">TQCanvasPolygon</a>* i = new <a href="qcanvaspolygon.html">TQCanvasPolygon</a>(&canvas); - const int size = canvas.<a href="ntqcanvas.html#width">width</a>()/2; + <a href="tqcanvaspolygon.html">TQCanvasPolygon</a>* i = new <a href="tqcanvaspolygon.html">TQCanvasPolygon</a>(&canvas); + const int size = canvas.<a href="tqcanvas.html#width">width</a>()/2; <a href="ntqpointarray.html">TQPointArray</a> pa(6); pa[0] = TQPoint(0,0); pa[1] = TQPoint(size,size/5); @@ -757,17 +757,17 @@ void <a name="f649"></a>Main::addPolygon() pa[3] = TQPoint(size/6,size*5/4); pa[4] = TQPoint(size*3/4,size*3/4); pa[5] = TQPoint(size*3/4,size/4); - i-><a href="qcanvasline.html#setPoints">setPoints</a>(pa); - i-><a href="qcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); - i-><a href="qcanvasitem.html#move">move</a>(rand()%canvas.<a href="ntqcanvas.html#width">width</a>(),rand()%canvas.<a href="ntqcanvas.html#height">height</a>()); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256); - i-><a href="qcanvasitem.html#show">show</a>(); + i-><a href="tqcanvasline.html#setPoints">setPoints</a>(pa); + i-><a href="tqcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); + i-><a href="tqcanvasitem.html#move">move</a>(rand()%canvas.<a href="tqcanvas.html#width">width</a>(),rand()%canvas.<a href="tqcanvas.html#height">height</a>()); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f650"></a>Main::addSpline() { - <a href="qcanvasspline.html">TQCanvasSpline</a>* i = new <a href="qcanvasspline.html">TQCanvasSpline</a>(&canvas); - const int size = canvas.<a href="ntqcanvas.html#width">width</a>()/6; + <a href="tqcanvasspline.html">TQCanvasSpline</a>* i = new <a href="tqcanvasspline.html">TQCanvasSpline</a>(&canvas); + const int size = canvas.<a href="tqcanvas.html#width">width</a>()/6; <a href="ntqpointarray.html">TQPointArray</a> pa(12); pa[0] = TQPoint(0,0); pa[1] = TQPoint(size/2,0); @@ -781,30 +781,30 @@ void <a name="f650"></a>Main::addSpline() pa[9] = TQPoint(0,size); pa[10]= TQPoint(-size/4,size/2); pa[11]= TQPoint(-size/2,0); -<a name="x2926"></a> i-><a href="qcanvasspline.html#setControlPoints">setControlPoints</a>(pa); - i-><a href="qcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); - i-><a href="qcanvasitem.html#move">move</a>(rand()%canvas.<a href="ntqcanvas.html#width">width</a>(),rand()%canvas.<a href="ntqcanvas.html#height">height</a>()); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256); - i-><a href="qcanvasitem.html#show">show</a>(); +<a name="x2926"></a> i-><a href="tqcanvasspline.html#setControlPoints">setControlPoints</a>(pa); + i-><a href="tqcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(rand()%32*8,rand()%32*8,rand()%32*8) ); + i-><a href="tqcanvasitem.html#move">move</a>(rand()%canvas.<a href="tqcanvas.html#width">width</a>(),rand()%canvas.<a href="tqcanvas.html#height">height</a>()); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f651"></a>Main::addText() { - <a href="qcanvastext.html">TQCanvasText</a>* i = new <a href="qcanvastext.html">TQCanvasText</a>(&canvas); -<a name="x2929"></a> i-><a href="qcanvastext.html#setText">setText</a>("TQCanvasText"); - i-><a href="qcanvasitem.html#move">move</a>(rand()%canvas.<a href="ntqcanvas.html#width">width</a>(),rand()%canvas.<a href="ntqcanvas.html#height">height</a>()); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256); - i-><a href="qcanvasitem.html#show">show</a>(); + <a href="tqcanvastext.html">TQCanvasText</a>* i = new <a href="tqcanvastext.html">TQCanvasText</a>(&canvas); +<a name="x2929"></a> i-><a href="tqcanvastext.html#setText">setText</a>("TQCanvasText"); + i-><a href="tqcanvasitem.html#move">move</a>(rand()%canvas.<a href="tqcanvas.html#width">width</a>(),rand()%canvas.<a href="tqcanvas.html#height">height</a>()); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f652"></a>Main::addLine() { - <a href="qcanvasline.html">TQCanvasLine</a>* i = new <a href="qcanvasline.html">TQCanvasLine</a>(&canvas); - i-><a href="qcanvasline.html#setPoints">setPoints</a>( rand()%canvas.<a href="ntqcanvas.html#width">width</a>(), rand()%canvas.<a href="ntqcanvas.html#height">height</a>(), - rand()%canvas.<a href="ntqcanvas.html#width">width</a>(), rand()%canvas.<a href="ntqcanvas.html#height">height</a>() ); -<a name="x2924"></a> i-><a href="qcanvaspolygonalitem.html#setPen">setPen</a>( TQPen(TQColor(rand()%32*8,rand()%32*8,rand()%32*8), 6) ); - i-><a href="qcanvasitem.html#setZ">setZ</a>(rand()%256); - i-><a href="qcanvasitem.html#show">show</a>(); + <a href="tqcanvasline.html">TQCanvasLine</a>* i = new <a href="tqcanvasline.html">TQCanvasLine</a>(&canvas); + i-><a href="tqcanvasline.html#setPoints">setPoints</a>( rand()%canvas.<a href="tqcanvas.html#width">width</a>(), rand()%canvas.<a href="tqcanvas.html#height">height</a>(), + rand()%canvas.<a href="tqcanvas.html#width">width</a>(), rand()%canvas.<a href="tqcanvas.html#height">height</a>() ); +<a name="x2924"></a> i-><a href="tqcanvaspolygonalitem.html#setPen">setPen</a>( TQPen(TQColor(rand()%32*8,rand()%32*8,rand()%32*8), 6) ); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(rand()%256); + i-><a href="tqcanvasitem.html#show">show</a>(); } void <a name="f653"></a>Main::addMesh() @@ -817,8 +817,8 @@ void <a name="f653"></a>Main::addMesh() int nodecount = 0; - int w = canvas.<a href="ntqcanvas.html#width">width</a>(); - int h = canvas.<a href="ntqcanvas.html#height">height</a>(); + int w = canvas.<a href="tqcanvas.html#width">width</a>(); + int h = canvas.<a href="tqcanvas.html#height">height</a>(); const int dist = 30; int rows = h / dist; @@ -839,7 +839,7 @@ void <a name="f653"></a>Main::addMesh() int r = rand(); int xrand = r %20; int yrand = (r/20) %20; - el-><a href="qcanvasitem.html#move">move</a>( xrand + x0 + i*dist + (j%2 ? dist/2 : 0 ), + el-><a href="tqcanvasitem.html#move">move</a>( xrand + x0 + i*dist + (j%2 ? dist/2 : 0 ), yrand + y0 + j*dist ); if ( j > 0 ) { @@ -855,7 +855,7 @@ void <a name="f653"></a>Main::addMesh() } if ( i > 0 ) lastRow[i-1] = prev; prev = el; - el-><a href="qcanvasitem.html#show">show</a>(); + el-><a href="tqcanvasitem.html#show">show</a>(); } lastRow[n-1]=prev; #ifndef TQT_NO_PROGRESSDIALOG @@ -872,13 +872,13 @@ void <a name="f653"></a>Main::addMesh() void <a name="f654"></a>Main::addRectangle() { - <a href="qcanvaspolygonalitem.html">TQCanvasPolygonalItem</a> *i = new <a href="qcanvasrectangle.html">TQCanvasRectangle</a>( rand()%canvas.<a href="ntqcanvas.html#width">width</a>(),rand()%canvas.<a href="ntqcanvas.html#height">height</a>(), - canvas.<a href="ntqcanvas.html#width">width</a>()/5,canvas.<a href="ntqcanvas.html#width">width</a>()/5,&canvas); + <a href="tqcanvaspolygonalitem.html">TQCanvasPolygonalItem</a> *i = new <a href="tqcanvasrectangle.html">TQCanvasRectangle</a>( rand()%canvas.<a href="tqcanvas.html#width">width</a>(),rand()%canvas.<a href="tqcanvas.html#height">height</a>(), + canvas.<a href="tqcanvas.html#width">width</a>()/5,canvas.<a href="tqcanvas.html#width">width</a>()/5,&canvas); int z = rand()%256; - i-><a href="qcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(z,z,z) ); - i-><a href="qcanvaspolygonalitem.html#setPen">setPen</a>( TQPen(TQColor(rand()%32*8,rand()%32*8,rand()%32*8), 6) ); - i-><a href="qcanvasitem.html#setZ">setZ</a>(z); - i-><a href="qcanvasitem.html#show">show</a>(); + i-><a href="tqcanvaspolygonalitem.html#setBrush">setBrush</a>( TQColor(z,z,z) ); + i-><a href="tqcanvaspolygonalitem.html#setPen">setPen</a>( TQPen(TQColor(rand()%32*8,rand()%32*8,rand()%32*8), 6) ); + i-><a href="tqcanvasitem.html#setZ">setZ</a>(z); + i-><a href="tqcanvasitem.html#show">show</a>(); } </pre> @@ -911,8 +911,8 @@ int main(int argc, char** argv) else logo_fn = "qtlogo.png"; - <a href="ntqcanvas.html">TQCanvas</a> canvas(800,600); -<a name="x2962"></a> canvas.<a href="ntqcanvas.html#setAdvancePeriod">setAdvancePeriod</a>(30); + <a href="tqcanvas.html">TQCanvas</a> canvas(800,600); +<a name="x2962"></a> canvas.<a href="tqcanvas.html#setAdvancePeriod">setAdvancePeriod</a>(30); Main m(canvas); <a name="x2969"></a> m.<a href="ntqwidget.html#resize">resize</a>(m.<a href="ntqwidget.html#sizeHint">sizeHint</a>()); m.<a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - Canvas"); |