diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/canvas-example.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/canvas-example.html')
-rw-r--r-- | doc/html/canvas-example.html | 392 |
1 files changed, 196 insertions, 196 deletions
diff --git a/doc/html/canvas-example.html b/doc/html/canvas-example.html index dc662e95b..b9b0090e6 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="qcanvas.html">TQCanvas</a> and some <a href="qcanvasitem.html">TQCanvasItem</a>s in action. +This example shows a <a href="ntqcanvas.html">TQCanvas</a> and some <a href="qcanvasitem.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> @@ -41,10 +41,10 @@ example provides a taste of what can be done. <p> <pre>#ifndef EXAMPLE_H #define EXAMPLE_H -#include <<a href="qpopupmenu-h.html">qpopupmenu.h</a>> -#include <<a href="qmainwindow-h.html">qmainwindow.h</a>> -#include <<a href="qintdict-h.html">qintdict.h</a>> -#include <<a href="qcanvas-h.html">qcanvas.h</a>> +#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>> class BouncyLogo : public <a href="qcanvassprite.html">TQCanvasSprite</a> { void initPos(); @@ -68,14 +68,14 @@ protected: void contentsMouseMoveEvent(TQMouseEvent*); signals: - void status(const <a href="qstring.html">TQString</a>&); + void status(const <a href="ntqstring.html">TQString</a>&); private: <a href="qcanvasitem.html">TQCanvasItem</a>* moving; - <a href="qpoint.html">TQPoint</a> moving_start; + <a href="ntqpoint.html">TQPoint</a> moving_start; }; -class Main : public <a href="qmainwindow.html">TQMainWindow</a> { +class Main : public <a href="ntqmainwindow.html">TQMainWindow</a> { Q_OBJECT public: @@ -120,11 +120,11 @@ private slots: void toggleDoubleBuffer(); private: - <a href="qcanvas.html">TQCanvas</a>& canvas; + <a href="ntqcanvas.html">TQCanvas</a>& canvas; FigureEditor *editor; - <a href="qpopupmenu.html">TQPopupMenu</a>* options; - <a href="qprinter.html">TQPrinter</a>* printer; + <a href="ntqpopupmenu.html">TQPopupMenu</a>* options; + <a href="ntqprinter.html">TQPrinter</a>* printer; int dbf_id; }; @@ -133,17 +133,17 @@ private: <p> <hr> <p> Implementation: -<p> <pre>#include <<a href="qdatetime-h.html">qdatetime.h</a>> -#include <<a href="qmainwindow-h.html">qmainwindow.h</a>> -#include <<a href="qstatusbar-h.html">qstatusbar.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> -#include <<a href="qmenubar-h.html">qmenubar.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qprinter-h.html">qprinter.h</a>> -#include <<a href="qlabel-h.html">qlabel.h</a>> -#include <<a href="qimage-h.html">qimage.h</a>> -#include <<a href="qprogressdialog-h.html">qprogressdialog.h</a>> +<p> <pre>#include <<a href="qdatetime-h.html">ntqdatetime.h</a>> +#include <<a href="qmainwindow-h.html">ntqmainwindow.h</a>> +#include <<a href="qstatusbar-h.html">ntqstatusbar.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> +#include <<a href="qmenubar-h.html">ntqmenubar.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qprinter-h.html">ntqprinter.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> +#include <<a href="qimage-h.html">ntqimage.h</a>> +#include <<a href="qprogressdialog-h.html">ntqprogressdialog.h</a>> #include "canvas.h" #include <stdlib.h> @@ -174,64 +174,64 @@ static const int imageRTTI = 984376; class ImageItem: public <a href="qcanvasrectangle.html">TQCanvasRectangle</a> { public: - ImageItem( <a href="qimage.html">TQImage</a> img, TQCanvas *canvas ); + ImageItem( <a href="ntqimage.html">TQImage</a> img, TQCanvas *canvas ); int rtti () const { return imageRTTI; } - bool hit( const <a href="qpoint.html">TQPoint</a>&) const; + bool hit( const <a href="ntqpoint.html">TQPoint</a>&) const; protected: - void drawShape( <a href="qpainter.html">TQPainter</a> & ); + void drawShape( <a href="ntqpainter.html">TQPainter</a> & ); private: - <a href="qimage.html">TQImage</a> image; - <a href="qpixmap.html">TQPixmap</a> pixmap; + <a href="ntqimage.html">TQImage</a> image; + <a href="ntqpixmap.html">TQPixmap</a> pixmap; }; -<a name="f623"></a>ImageItem::ImageItem( <a href="qimage.html">TQImage</a> img, TQCanvas *canvas ) +<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 name="x2935"></a><a name="x2932"></a> <a href="qcanvasrectangle.html#setSize">setSize</a>( image.<a href="qimage.html#width">width</a>(), image.<a href="qimage.html#height">height</a>() ); +<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>() ); #if !defined(Q_WS_QWS) -<a name="x2943"></a> pixmap.<a href="qpixmap.html#convertFromImage">convertFromImage</a>(image, OrderedAlphaDither); +<a name="x2943"></a> pixmap.<a href="ntqpixmap.html#convertFromImage">convertFromImage</a>(image, OrderedAlphaDither); #endif } -<a name="x2925"></a>void ImageItem::<a href="qcanvasrectangle.html#drawShape">drawShape</a>( <a href="qpainter.html">TQPainter</a> &p ) +<a name="x2925"></a>void ImageItem::<a href="qcanvasrectangle.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(Q_WS_QWS) -<a name="x2941"></a> p.<a href="qpainter.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="qcanvasitem.html#x">x</a>()), int(<a href="qcanvasitem.html#y">y</a>()), image, 0, 0, -1, -1, OrderedAlphaDither ); #else - p.<a href="qpainter.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="qcanvasitem.html#x">x</a>()), int(<a href="qcanvasitem.html#y">y</a>()), pixmap ); #endif } -bool <a name="f624"></a>ImageItem::hit( const <a href="qpoint.html">TQPoint</a> &p ) const +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="qpoint.html#x">x</a>()-int(<a href="qcanvasitem.html#x">x</a>()); -<a name="x2945"></a> int iy = p.<a href="qpoint.html#y">y</a>()-int(<a href="qcanvasitem.html#y">y</a>()); -<a name="x2934"></a> if ( !image.<a href="qimage.html#valid">valid</a>( ix , iy ) ) +<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="x2934"></a> if ( !image.<a href="ntqimage.html#valid">valid</a>( ix , iy ) ) return FALSE; -<a name="x2933"></a> TQRgb pixel = image.<a href="qimage.html#pixel">pixel</a>( ix, iy ); +<a name="x2933"></a> TQRgb pixel = image.<a href="ntqimage.html#pixel">pixel</a>( ix, iy ); return qAlpha( pixel ) != 0; } class NodeItem: public <a href="qcanvasellipse.html">TQCanvasEllipse</a> { public: - NodeItem( <a href="qcanvas.html">TQCanvas</a> *canvas ); + NodeItem( <a href="ntqcanvas.html">TQCanvas</a> *canvas ); ~NodeItem() {} - void addInEdge( EdgeItem *edge ) { inList.<a href="qptrlist.html#append">append</a>( edge ); } - void addOutEdge( EdgeItem *edge ) { outList.<a href="qptrlist.html#append">append</a>( edge ); } + void addInEdge( EdgeItem *edge ) { inList.<a href="ntqptrlist.html#append">append</a>( edge ); } + void addOutEdge( EdgeItem *edge ) { outList.<a href="ntqptrlist.html#append">append</a>( edge ); } void moveBy(double dx, double dy); // TQPoint center() { return boundingRect().center(); } private: - <a href="qptrlist.html">TQPtrList</a><EdgeItem> inList; - <a href="qptrlist.html">TQPtrList</a><EdgeItem> outList; + <a href="ntqptrlist.html">TQPtrList</a><EdgeItem> inList; + <a href="ntqptrlist.html">TQPtrList</a><EdgeItem> outList; }; @@ -275,7 +275,7 @@ void NodeItem::<a href="qcanvasitem.html#moveBy">moveBy</a>(double dx, double dy EdgeItem *edge; <a name="x2949"></a> while (( edge = it1.<a href="qptrlistiterator.html#current">current</a>() )) { ++it1; - edge->setToPoint( int(<a href="qwidget.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="qcanvasitem.html#y">y</a>()) ); } <a href="qptrlistiterator.html">TQPtrListIterator</a><EdgeItem> it2( outList ); while (( edge = it2.<a href="qptrlistiterator.html#current">current</a>() )) { @@ -284,7 +284,7 @@ void NodeItem::<a href="qcanvasitem.html#moveBy">moveBy</a>(double dx, double dy } } -<a name="f655"></a>NodeItem::NodeItem( <a href="qcanvas.html">TQCanvas</a> *canvas ) +<a name="f655"></a>NodeItem::NodeItem( <a href="ntqcanvas.html">TQCanvas</a> *canvas ) : <a href="qcanvasellipse.html">TQCanvasEllipse</a>( 6, 6, canvas ) { setPen( *tp ); @@ -293,17 +293,17 @@ void NodeItem::<a href="qcanvasitem.html#moveBy">moveBy</a>(double dx, double dy } <a name="f621"></a>FigureEditor::FigureEditor( - <a href="qcanvas.html">TQCanvas</a>& c, TQWidget* parent, + <a href="ntqcanvas.html">TQCanvas</a>& c, TQWidget* parent, const char* name, WFlags f) : <a href="qcanvasview.html">TQCanvasView</a>(&c,parent,name,f) { } -<a name="x2951"></a>void FigureEditor::<a href="qscrollview.html#contentsMousePressEvent">contentsMousePressEvent</a>(TQMouseEvent* e) +<a name="x2951"></a>void FigureEditor::<a href="ntqscrollview.html#contentsMousePressEvent">contentsMousePressEvent</a>(TQMouseEvent* e) { - <a href="qpoint.html">TQPoint</a> p = inverseWorldMatrix().map(e->pos()); + <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 name="x2953"></a><a name="x2952"></a> for (TQCanvasItemList::Iterator it=l.<a href="qvaluelist.html#begin">begin</a>(); it!=l.<a href="qvaluelist.html#end">end</a>(); ++it) { +<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); if ( !item->hit( p ) ) @@ -319,19 +319,19 @@ 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(); - TQCanvasItemList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>(); - for (; it != list.<a href="qvaluelist.html#end">end</a>(); ++it) { + TQCanvasItemList::Iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>(); + for (; it != list.<a href="ntqvaluelist.html#end">end</a>(); ++it) { if ( *it ) delete *it; } } -<a name="x2950"></a>void FigureEditor::<a href="qscrollview.html#contentsMouseMoveEvent">contentsMouseMoveEvent</a>(TQMouseEvent* e) +<a name="x2950"></a>void FigureEditor::<a href="ntqscrollview.html#contentsMouseMoveEvent">contentsMouseMoveEvent</a>(TQMouseEvent* e) { if ( moving ) { - <a href="qpoint.html">TQPoint</a> p = inverseWorldMatrix().map(e->pos()); - moving->moveBy(p.<a href="qpoint.html#x">x</a>() - moving_start.x(), - p.<a href="qpoint.html#y">y</a>() - moving_start.y()); + <a href="ntqpoint.html">TQPoint</a> p = inverseWorldMatrix().map(e->pos()); + 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(); } @@ -387,8 +387,8 @@ void <a name="f617"></a>BouncyLogo::initSpeed() vy = yVelocity(); } - double nx = <a href="qwidget.html#x">x</a>() + vx; - double ny = <a href="qwidget.html#y">y</a>() + vy; + double nx = <a href="ntqwidget.html#x">x</a>() + vx; + double ny = <a href="ntqwidget.html#y">y</a>() + vy; if ( nx < 0 || nx >= canvas()->width() ) vx = -vx; @@ -397,7 +397,7 @@ void <a name="f617"></a>BouncyLogo::initSpeed() for (int bounce=0; bounce<4; bounce++) { <a href="qcanvasitemlist.html">TQCanvasItemList</a> l=collisions(FALSE); - for (TQCanvasItemList::Iterator it=l.<a href="qvaluelist.html#begin">begin</a>(); it!=l.<a href="qvaluelist.html#end">end</a>(); ++it) { + 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) ) { switch ( bounce ) { @@ -423,9 +423,9 @@ void <a name="f617"></a>BouncyLogo::initSpeed() } } - if ( <a href="qwidget.html#x">x</a>()+vx < 0 || x()+vx >= canvas()->width() ) + if ( <a href="ntqwidget.html#x">x</a>()+vx < 0 || x()+vx >= canvas()->width() ) vx = 0; - if ( <a href="qwidget.html#y">y</a>()+vy < 0 || y()+vy >= canvas()->height() ) + if ( <a href="ntqwidget.html#y">y</a>()+vy < 0 || y()+vy >= canvas()->height() ) vy = 0; setVelocity(vx,vy); @@ -441,65 +441,65 @@ static TQImage *butterflyimg; static TQImage *logoimg; <a name="f625"></a>Main::Main(TQCanvas& c, TQWidget* parent, const char* name, WFlags f) : - <a href="qmainwindow.html">TQMainWindow</a>(parent,name,f), + <a href="ntqmainwindow.html">TQMainWindow</a>(parent,name,f), canvas(c) { editor = new FigureEditor(canvas,this); - <a href="qmenubar.html">TQMenuBar</a>* menu = <a href="qmainwindow.html#menuBar">menuBar</a>(); - - <a href="qpopupmenu.html">TQPopupMenu</a>* file = new <a href="qpopupmenu.html">TQPopupMenu</a>( menu ); -<a name="x2936"></a> file-><a href="qmenudata.html#insertItem">insertItem</a>("&Fill canvas", this, SLOT(init()), CTRL+Key_F); - file-><a href="qmenudata.html#insertItem">insertItem</a>("&Erase canvas", this, SLOT(clear()), CTRL+Key_E); - file-><a href="qmenudata.html#insertItem">insertItem</a>("&New view", this, SLOT(newView()), CTRL+Key_N); - file-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - file-><a href="qmenudata.html#insertItem">insertItem</a>("&Print...", this, SLOT(print()), CTRL+Key_P); - file-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - file-><a href="qmenudata.html#insertItem">insertItem</a>("E&xit", qApp, SLOT(<a href="qapplication.html#quit">quit</a>()), CTRL+Key_Q); - menu-><a href="qmenudata.html#insertItem">insertItem</a>("&File", file); - - <a href="qpopupmenu.html">TQPopupMenu</a>* edit = new <a href="qpopupmenu.html">TQPopupMenu</a>( menu ); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Circle", this, SLOT(addCircle()), ALT+Key_C); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Hexagon", this, SLOT(addHexagon()), ALT+Key_H); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Polygon", this, SLOT(addPolygon()), ALT+Key_P); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add Spl&ine", this, SLOT(addSpline()), ALT+Key_I); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Text", this, SLOT(addText()), ALT+Key_T); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Line", this, SLOT(addLine()), ALT+Key_L); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Rectangle", this, SLOT(addRectangle()), ALT+Key_R); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Sprite", this, SLOT(addSprite()), ALT+Key_S); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Create &Mesh", this, SLOT(addMesh()), ALT+Key_M ); - edit-><a href="qmenudata.html#insertItem">insertItem</a>("Add &Alpha-blended image", this, SLOT(addButterfly()), ALT+Key_A); - menu-><a href="qmenudata.html#insertItem">insertItem</a>("&Edit", edit); - - <a href="qpopupmenu.html">TQPopupMenu</a>* view = new <a href="qpopupmenu.html">TQPopupMenu</a>( menu ); - view-><a href="qmenudata.html#insertItem">insertItem</a>("&Enlarge", this, SLOT(enlarge()), SHIFT+CTRL+Key_Plus); - view-><a href="qmenudata.html#insertItem">insertItem</a>("Shr&ink", this, SLOT(shrink()), SHIFT+CTRL+Key_Minus); - view-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - view-><a href="qmenudata.html#insertItem">insertItem</a>("&Rotate clockwise", this, SLOT(rotateClockwise()), CTRL+Key_PageDown); - view-><a href="qmenudata.html#insertItem">insertItem</a>("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), CTRL+Key_PageUp); - view-><a href="qmenudata.html#insertItem">insertItem</a>("&Zoom in", this, SLOT(zoomIn()), CTRL+Key_Plus); - view-><a href="qmenudata.html#insertItem">insertItem</a>("Zoom &out", this, SLOT(zoomOut()), CTRL+Key_Minus); - view-><a href="qmenudata.html#insertItem">insertItem</a>("Translate left", this, SLOT(moveL()), CTRL+Key_Left); - view-><a href="qmenudata.html#insertItem">insertItem</a>("Translate right", this, SLOT(moveR()), CTRL+Key_Right); - view-><a href="qmenudata.html#insertItem">insertItem</a>("Translate up", this, SLOT(moveU()), CTRL+Key_Up); - view-><a href="qmenudata.html#insertItem">insertItem</a>("Translate down", this, SLOT(moveD()), CTRL+Key_Down); - view-><a href="qmenudata.html#insertItem">insertItem</a>("&Mirror", this, SLOT(mirror()), CTRL+Key_Home); - menu-><a href="qmenudata.html#insertItem">insertItem</a>("&View", view); - - options = new <a href="qpopupmenu.html">TQPopupMenu</a>( menu ); - dbf_id = options-><a href="qmenudata.html#insertItem">insertItem</a>("Double buffer", this, SLOT(toggleDoubleBuffer())); -<a name="x2939"></a> options-><a href="qmenudata.html#setItemChecked">setItemChecked</a>(dbf_id, TRUE); - menu-><a href="qmenudata.html#insertItem">insertItem</a>("&Options",options); - - menu-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - - <a href="qpopupmenu.html">TQPopupMenu</a>* help = new <a href="qpopupmenu.html">TQPopupMenu</a>( menu ); - help-><a href="qmenudata.html#insertItem">insertItem</a>("&About", this, SLOT(help()), Key_F1); - help-><a href="qmenudata.html#setItemChecked">setItemChecked</a>(dbf_id, TRUE); - menu-><a href="qmenudata.html#insertItem">insertItem</a>("&Help",help); - - <a href="qmainwindow.html#statusBar">statusBar</a>(); - - <a href="qmainwindow.html#setCentralWidget">setCentralWidget</a>(editor); + <a href="ntqmenubar.html">TQMenuBar</a>* menu = <a href="ntqmainwindow.html#menuBar">menuBar</a>(); + + <a href="ntqpopupmenu.html">TQPopupMenu</a>* file = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( menu ); +<a name="x2936"></a> file-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Fill canvas", this, SLOT(init()), CTRL+Key_F); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Erase canvas", this, SLOT(clear()), CTRL+Key_E); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>("&New view", this, SLOT(newView()), CTRL+Key_N); + file-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Print...", this, SLOT(print()), CTRL+Key_P); + file-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>("E&xit", qApp, SLOT(<a href="ntqapplication.html#quit">quit</a>()), CTRL+Key_Q); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>("&File", file); + + <a href="ntqpopupmenu.html">TQPopupMenu</a>* edit = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( menu ); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Circle", this, SLOT(addCircle()), ALT+Key_C); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Hexagon", this, SLOT(addHexagon()), ALT+Key_H); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Polygon", this, SLOT(addPolygon()), ALT+Key_P); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add Spl&ine", this, SLOT(addSpline()), ALT+Key_I); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Text", this, SLOT(addText()), ALT+Key_T); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Line", this, SLOT(addLine()), ALT+Key_L); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Rectangle", this, SLOT(addRectangle()), ALT+Key_R); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Sprite", this, SLOT(addSprite()), ALT+Key_S); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Create &Mesh", this, SLOT(addMesh()), ALT+Key_M ); + edit-><a href="ntqmenudata.html#insertItem">insertItem</a>("Add &Alpha-blended image", this, SLOT(addButterfly()), ALT+Key_A); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Edit", edit); + + <a href="ntqpopupmenu.html">TQPopupMenu</a>* view = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( menu ); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Enlarge", this, SLOT(enlarge()), SHIFT+CTRL+Key_Plus); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("Shr&ink", this, SLOT(shrink()), SHIFT+CTRL+Key_Minus); + view-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Rotate clockwise", this, SLOT(rotateClockwise()), CTRL+Key_PageDown); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), CTRL+Key_PageUp); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Zoom in", this, SLOT(zoomIn()), CTRL+Key_Plus); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("Zoom &out", this, SLOT(zoomOut()), CTRL+Key_Minus); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("Translate left", this, SLOT(moveL()), CTRL+Key_Left); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("Translate right", this, SLOT(moveR()), CTRL+Key_Right); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("Translate up", this, SLOT(moveU()), CTRL+Key_Up); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("Translate down", this, SLOT(moveD()), CTRL+Key_Down); + view-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Mirror", this, SLOT(mirror()), CTRL+Key_Home); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>("&View", view); + + options = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( menu ); + dbf_id = options-><a href="ntqmenudata.html#insertItem">insertItem</a>("Double buffer", this, SLOT(toggleDoubleBuffer())); +<a name="x2939"></a> options-><a href="ntqmenudata.html#setItemChecked">setItemChecked</a>(dbf_id, TRUE); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Options",options); + + menu-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + + <a href="ntqpopupmenu.html">TQPopupMenu</a>* help = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( menu ); + help-><a href="ntqmenudata.html#insertItem">insertItem</a>("&About", this, SLOT(help()), Key_F1); + help-><a href="ntqmenudata.html#setItemChecked">setItemChecked</a>(dbf_id, TRUE); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>("&Help",help); + + <a href="ntqmainwindow.html#statusBar">statusBar</a>(); + + <a href="ntqmainwindow.html#setCentralWidget">setCentralWidget</a>(editor); printer = 0; @@ -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="qcanvas.html#width">width</a>() / 56; i++) { +<a name="x2912"></a> for ( i=0; i<canvas.<a href="ntqcanvas.html#width">width</a>() / 56; i++) { addButterfly(); } - for ( i=0; i<canvas.<a href="qcanvas.html#width">width</a>() / 85; i++) { + for ( i=0; i<canvas.<a href="ntqcanvas.html#width">width</a>() / 85; i++) { addHexagon(); } - for ( i=0; i<canvas.<a href="qcanvas.html#width">width</a>() / 128; i++) { + for ( i=0; i<canvas.<a href="ntqcanvas.html#width">width</a>() / 128; i++) { addLogo(); } } @@ -544,9 +544,9 @@ void <a name="f627"></a>Main::newView() { // Open a new view... have it delete when closed. Main *m = new Main(canvas, 0, 0, WDestructiveClose); - qApp-><a href="qapplication.html#setMainWidget">setMainWidget</a>(m); - m-><a href="qwidget.html#show">show</a>(); - qApp-><a href="qapplication.html#setMainWidget">setMainWidget</a>(0); + qApp-><a href="ntqapplication.html#setMainWidget">setMainWidget</a>(m); + m-><a href="ntqwidget.html#show">show</a>(); + qApp-><a href="ntqapplication.html#setMainWidget">setMainWidget</a>(0); } void <a name="f628"></a>Main::clear() @@ -556,7 +556,7 @@ void <a name="f628"></a>Main::clear() void <a name="f629"></a>Main::help() { - static TQMessageBox* about = new <a href="qmessagebox.html">TQMessageBox</a>( "TQt Canvas Example", + static TQMessageBox* about = new <a href="ntqmessagebox.html">TQMessageBox</a>( "TQt Canvas Example", "<h3>The TQCanvas classes example</h3>" "<ul>" "<li> Press ALT-S for some sprites." @@ -571,95 +571,95 @@ void <a name="f629"></a>Main::help() void <a name="f630"></a>Main::aboutTQt() { - TQMessageBox::<a href="qmessagebox.html#aboutTQt">aboutTQt</a>( this, "TQt Canvas Example" ); + TQMessageBox::<a href="ntqmessagebox.html#aboutTQt">aboutTQt</a>( this, "TQt Canvas Example" ); } void <a name="f631"></a>Main::toggleDoubleBuffer() { -<a name="x2938"></a> bool s = !options-><a href="qmenudata.html#isItemChecked">isItemChecked</a>(dbf_id); - options-><a href="qmenudata.html#setItemChecked">setItemChecked</a>(dbf_id,s); -<a name="x2911"></a> canvas.<a href="qcanvas.html#setDoubleBuffering">setDoubleBuffering</a>(s); +<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); } void <a name="f632"></a>Main::enlarge() { -<a name="x2910"></a><a name="x2909"></a> canvas.<a href="qcanvas.html#resize">resize</a>(canvas.<a href="qcanvas.html#width">width</a>()*4/3, canvas.<a href="qcanvas.html#height">height</a>()*4/3); +<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); } void <a name="f633"></a>Main::shrink() { - canvas.<a href="qcanvas.html#resize">resize</a>(canvas.<a href="qcanvas.html#width">width</a>()*3/4, canvas.<a href="qcanvas.html#height">height</a>()*3/4); + 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); } void <a name="f634"></a>Main::rotateClockwise() { -<a name="x2931"></a> <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); -<a name="x2955"></a> m.<a href="qwmatrix.html#rotate">rotate</a>( 22.5 ); +<a name="x2931"></a> <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.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 ); } void <a name="f635"></a>Main::rotateCounterClockwise() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); - m.<a href="qwmatrix.html#rotate">rotate</a>( -22.5 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + m.<a href="ntqwmatrix.html#rotate">rotate</a>( -22.5 ); editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f636"></a>Main::zoomIn() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); -<a name="x2956"></a> m.<a href="qwmatrix.html#scale">scale</a>( 2.0, 2.0 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.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 ); } void <a name="f637"></a>Main::zoomOut() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); - m.<a href="qwmatrix.html#scale">scale</a>( 0.5, 0.5 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.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 ); } void <a name="f638"></a>Main::mirror() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); - m.<a href="qwmatrix.html#scale">scale</a>( -1, 1 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + m.<a href="ntqwmatrix.html#scale">scale</a>( -1, 1 ); editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f639"></a>Main::moveL() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); -<a name="x2957"></a> m.<a href="qwmatrix.html#translate">translate</a>( -16, 0 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.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 ); } void <a name="f640"></a>Main::moveR() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); - m.<a href="qwmatrix.html#translate">translate</a>( +16, 0 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + m.<a href="ntqwmatrix.html#translate">translate</a>( +16, 0 ); editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f641"></a>Main::moveU() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); - m.<a href="qwmatrix.html#translate">translate</a>( 0, -16 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + m.<a href="ntqwmatrix.html#translate">translate</a>( 0, -16 ); editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f642"></a>Main::moveD() { - <a href="qwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); - m.<a href="qwmatrix.html#translate">translate</a>( 0, +16 ); + <a href="ntqwmatrix.html">TQWMatrix</a> m = editor-><a href="qcanvasview.html#worldMatrix">worldMatrix</a>(); + m.<a href="ntqwmatrix.html#translate">translate</a>( 0, +16 ); editor-><a href="qcanvasview.html#setWorldMatrix">setWorldMatrix</a>( m ); } void <a name="f643"></a>Main::print() { - if ( !printer ) printer = new <a href="qprinter.html">TQPrinter</a>; + if ( !printer ) printer = new <a href="ntqprinter.html">TQPrinter</a>; if ( printer->setup(this) ) { - <a href="qpainter.html">TQPainter</a> pp(printer); -<a name="x2908"></a> canvas.<a href="qcanvas.html#drawArea">drawArea</a>(TQRect(0,0,canvas.<a href="qcanvas.html#width">width</a>(),canvas.<a href="qcanvas.html#height">height</a>()),&pp,FALSE); + <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); } } @@ -680,7 +680,7 @@ void <a name="f645"></a>Main::addButterfly() if ( butterfly_fn.isEmpty() ) return; if ( !butterflyimg ) { - butterflyimg = new <a href="qimage.html">TQImage</a>[4]; + butterflyimg = new <a href="ntqimage.html">TQImage</a>[4]; butterflyimg[0].load( butterfly_fn ); butterflyimg[1] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.75), int(butterflyimg[0].height()*0.75) ); @@ -690,8 +690,8 @@ void <a name="f645"></a>Main::addButterfly() 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="qcanvas.html#width">width</a>()-butterflyimg-><a href="qimage.html#width">width</a>()), - rand()%(canvas.<a href="qcanvas.html#height">height</a>()-butterflyimg-><a href="qimage.html#height">height</a>())); +<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>(); } @@ -701,7 +701,7 @@ void <a name="f646"></a>Main::addLogo() if ( logo_fn.isEmpty() ) return; if ( !logoimg ) { - logoimg = new <a href="qimage.html">TQImage</a>[4]; + logoimg = new <a href="ntqimage.html">TQImage</a>[4]; logoimg[0].load( logo_fn ); logoimg[1] = logoimg[0].smoothScale( int(logoimg[0].width()*0.75), int(logoimg[0].height()*0.75) ); @@ -711,8 +711,8 @@ void <a name="f646"></a>Main::addLogo() 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="qcanvas.html#width">width</a>()-logoimg-><a href="qimage.html#width">width</a>()), - rand()%(canvas.<a href="qcanvas.html#height">height</a>()-logoimg-><a href="qimage.html#width">width</a>())); + 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>(); } @@ -723,7 +723,7 @@ 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="qcanvas.html#width">width</a>(),rand()%canvas.<a href="qcanvas.html#height">height</a>()); + 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>(); } @@ -731,8 +731,8 @@ void <a name="f647"></a>Main::addCircle() 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="qcanvas.html#width">width</a>() / 25; - <a href="qpointarray.html">TQPointArray</a> pa(6); + const int size = canvas.<a href="ntqcanvas.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); pa[2] = TQPoint(-size,-size*173/100); @@ -741,7 +741,7 @@ void <a name="f648"></a>Main::addHexagon() 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="qcanvas.html#width">width</a>(),rand()%canvas.<a href="qcanvas.html#height">height</a>()); + 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>(); } @@ -749,8 +749,8 @@ void <a name="f648"></a>Main::addHexagon() 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="qcanvas.html#width">width</a>()/2; - <a href="qpointarray.html">TQPointArray</a> pa(6); + const int size = canvas.<a href="ntqcanvas.html#width">width</a>()/2; + <a href="ntqpointarray.html">TQPointArray</a> pa(6); pa[0] = TQPoint(0,0); pa[1] = TQPoint(size,size/5); pa[2] = TQPoint(size*4/5,size); @@ -759,7 +759,7 @@ void <a name="f649"></a>Main::addPolygon() 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="qcanvas.html#width">width</a>(),rand()%canvas.<a href="qcanvas.html#height">height</a>()); + 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>(); } @@ -767,8 +767,8 @@ void <a name="f649"></a>Main::addPolygon() 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="qcanvas.html#width">width</a>()/6; - <a href="qpointarray.html">TQPointArray</a> pa(12); + const int size = canvas.<a href="ntqcanvas.html#width">width</a>()/6; + <a href="ntqpointarray.html">TQPointArray</a> pa(12); pa[0] = TQPoint(0,0); pa[1] = TQPoint(size/2,0); pa[2] = TQPoint(size,size/2); @@ -783,7 +783,7 @@ void <a name="f650"></a>Main::addSpline() 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="qcanvas.html#width">width</a>(),rand()%canvas.<a href="qcanvas.html#height">height</a>()); + 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>(); } @@ -792,7 +792,7 @@ 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="qcanvas.html#width">width</a>(),rand()%canvas.<a href="qcanvas.html#height">height</a>()); + 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>(); } @@ -800,8 +800,8 @@ void <a name="f651"></a>Main::addText() 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="qcanvas.html#width">width</a>(), rand()%canvas.<a href="qcanvas.html#height">height</a>(), - rand()%canvas.<a href="qcanvas.html#width">width</a>(), rand()%canvas.<a href="qcanvas.html#height">height</a>() ); + 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>(); @@ -812,24 +812,24 @@ void <a name="f653"></a>Main::addMesh() int x0 = 0; int y0 = 0; - if ( !tb ) tb = new <a href="qbrush.html">TQBrush</a>( TQt::red ); - if ( !tp ) tp = new <a href="qpen.html">TQPen</a>( TQt::black ); + if ( !tb ) tb = new <a href="ntqbrush.html">TQBrush</a>( TQt::red ); + if ( !tp ) tp = new <a href="ntqpen.html">TQPen</a>( TQt::black ); int nodecount = 0; - int w = canvas.<a href="qcanvas.html#width">width</a>(); - int h = canvas.<a href="qcanvas.html#height">height</a>(); + int w = canvas.<a href="ntqcanvas.html#width">width</a>(); + int h = canvas.<a href="ntqcanvas.html#height">height</a>(); const int dist = 30; int rows = h / dist; int cols = w / dist; #ifndef QT_NO_PROGRESSDIALOG - <a href="qprogressdialog.html">TQProgressDialog</a> progress( "Creating mesh...", "Abort", rows, + <a href="ntqprogressdialog.html">TQProgressDialog</a> progress( "Creating mesh...", "Abort", rows, this, "progress", TRUE ); #endif - <a href="qmemarray.html">TQMemArray</a><NodeItem*> lastRow(cols); + <a href="ntqmemarray.html">TQMemArray</a><NodeItem*> lastRow(cols); for ( int j = 0; j < rows; j++ ) { int n = j%2 ? cols-1 : cols; NodeItem *prev = 0; @@ -859,21 +859,21 @@ void <a name="f653"></a>Main::addMesh() } lastRow[n-1]=prev; #ifndef QT_NO_PROGRESSDIALOG -<a name="x2946"></a> progress.<a href="qprogressdialog.html#setProgress">setProgress</a>( j ); -<a name="x2947"></a> if ( progress.<a href="qprogressdialog.html#wasCancelled">wasCancelled</a>() ) +<a name="x2946"></a> progress.<a href="ntqprogressdialog.html#setProgress">setProgress</a>( j ); +<a name="x2947"></a> if ( progress.<a href="ntqprogressdialog.html#wasCancelled">wasCancelled</a>() ) break; #endif } #ifndef QT_NO_PROGRESSDIALOG - progress.<a href="qprogressdialog.html#setProgress">setProgress</a>( rows ); + progress.<a href="ntqprogressdialog.html#setProgress">setProgress</a>( rows ); #endif // qDebug( "%d nodes, %d edges", nodecount, EdgeItem::count() ); } 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="qcanvas.html#width">width</a>(),rand()%canvas.<a href="qcanvas.html#height">height</a>(), - canvas.<a href="qcanvas.html#width">width</a>()/5,canvas.<a href="qcanvas.html#width">width</a>()/5,&canvas); + <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); 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) ); @@ -884,11 +884,11 @@ void <a name="f654"></a>Main::addRectangle() <p> <hr> <p> Main: -<p> <pre>#include <<a href="qstatusbar-h.html">qstatusbar.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> -#include <<a href="qmenubar-h.html">qmenubar.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qimage-h.html">qimage.h</a>> +<p> <pre>#include <<a href="qstatusbar-h.html">ntqstatusbar.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> +#include <<a href="qmenubar-h.html">ntqmenubar.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qimage-h.html">ntqimage.h</a>> #include "canvas.h" @@ -899,7 +899,7 @@ extern TQString logo_fn; int main(int argc, char** argv) { - <a href="qapplication.html">TQApplication</a> app(argc,argv); + <a href="ntqapplication.html">TQApplication</a> app(argc,argv); if ( argc > 1 ) butterfly_fn = argv[1]; @@ -911,20 +911,20 @@ int main(int argc, char** argv) else logo_fn = "qtlogo.png"; - <a href="qcanvas.html">TQCanvas</a> canvas(800,600); -<a name="x2962"></a> canvas.<a href="qcanvas.html#setAdvancePeriod">setAdvancePeriod</a>(30); + <a href="ntqcanvas.html">TQCanvas</a> canvas(800,600); +<a name="x2962"></a> canvas.<a href="ntqcanvas.html#setAdvancePeriod">setAdvancePeriod</a>(30); Main m(canvas); -<a name="x2969"></a> m.<a href="qwidget.html#resize">resize</a>(m.<a href="qwidget.html#sizeHint">sizeHint</a>()); - m.<a href="qwidget.html#setCaption">setCaption</a>("TQt Example - Canvas"); -<a name="x2970"></a><a name="x2958"></a> if ( TQApplication::<a href="qapplication.html#desktop">desktop</a>()->width() > m.<a href="qwidget.html#width">width</a>() + 10 -<a name="x2964"></a> && TQApplication::<a href="qapplication.html#desktop">desktop</a>()->height() > m.<a href="qwidget.html#height">height</a>() +30 ) - m.<a href="qwidget.html#show">show</a>(); +<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"); +<a name="x2970"></a><a name="x2958"></a> if ( TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->width() > m.<a href="ntqwidget.html#width">width</a>() + 10 +<a name="x2964"></a> && TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->height() > m.<a href="ntqwidget.html#height">height</a>() +30 ) + m.<a href="ntqwidget.html#show">show</a>(); else -<a name="x2968"></a> m.<a href="qwidget.html#showMaximized">showMaximized</a>(); +<a name="x2968"></a> m.<a href="ntqwidget.html#showMaximized">showMaximized</a>(); - TQObject::<a href="qobject.html#connect">connect</a>( qApp, SIGNAL(<a href="qapplication.html#lastWindowClosed">lastWindowClosed</a>()), qApp, SLOT(<a href="qapplication.html#quit">quit</a>()) ); + TQObject::<a href="ntqobject.html#connect">connect</a>( qApp, SIGNAL(<a href="ntqapplication.html#lastWindowClosed">lastWindowClosed</a>()), qApp, SLOT(<a href="ntqapplication.html#quit">quit</a>()) ); - return app.<a href="qapplication.html#exec">exec</a>(); + return app.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |