diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-05-31 11:32:43 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-05-31 11:59:34 +0900 |
commit | 68b81013e8668f50fc18b7e26a520ec93a7a1251 (patch) | |
tree | d6d15d07cb34e5443a10b71f91adee1473906263 /doc/html/tutorial2-06.html | |
parent | 1702a6daff27f5d3e6fdac16962d1828df6ca270 (diff) | |
download | tqt3-68b81013e8668f50fc18b7e26a520ec93a7a1251.tar.gz tqt3-68b81013e8668f50fc18b7e26a520ec93a7a1251.zip |
Rename nt* canvas related files to equivalent tq*
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'doc/html/tutorial2-06.html')
-rw-r--r-- | doc/html/tutorial2-06.html | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/doc/html/tutorial2-06.html b/doc/html/tutorial2-06.html index 4f1ff0bf5..3d5977d7f 100644 --- a/doc/html/tutorial2-06.html +++ b/doc/html/tutorial2-06.html @@ -43,7 +43,7 @@ drawElements() function is called to redraw the canvas when necessary. <pre> void ChartForm::drawElements() { - <a href="qcanvasitemlist.html">TQCanvasItemList</a> list = m_canvas->allItems(); + <a href="tqcanvasitemlist.html">TQCanvasItemList</a> list = m_canvas->allItems(); for ( TQCanvasItemList::iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>(); it != list.<a href="ntqvaluelist.html#end">end</a>(); ++it ) delete *it; </pre> @@ -135,15 +135,15 @@ it to <tt>NoPen</tt> so that no outlines are drawn. <p> We iterate over every element in the element vector, skipping invalid elements. The extent of each bar (its length) is simply its scaled value. -<p> <pre> <a href="qcanvasrectangle.html">TQCanvasRectangle</a> *rect = new <a href="qcanvasrectangle.html">TQCanvasRectangle</a>( +<p> <pre> <a href="tqcanvasrectangle.html">TQCanvasRectangle</a> *rect = new <a href="tqcanvasrectangle.html">TQCanvasRectangle</a>( 0, y, extent, proheight, m_canvas ); - <a name="x2572"></a> rect-><a href="qcanvaspolygonalitem.html#setBrush">setBrush</a>( TQBrush( m_elements[i].valueColor(), + <a name="x2572"></a> rect-><a href="tqcanvaspolygonalitem.html#setBrush">setBrush</a>( TQBrush( m_elements[i].valueColor(), BrushStyle(m_elements[i].valuePattern()) ) ); - <a name="x2573"></a> rect-><a href="qcanvaspolygonalitem.html#setPen">setPen</a>( pen ); - <a name="x2570"></a> rect-><a href="qcanvasitem.html#setZ">setZ</a>( 0 ); - <a name="x2571"></a> rect-><a href="qcanvasitem.html#show">show</a>(); + <a name="x2573"></a> rect-><a href="tqcanvaspolygonalitem.html#setPen">setPen</a>( pen ); + <a name="x2570"></a> rect-><a href="tqcanvasitem.html#setZ">setZ</a>( 0 ); + <a name="x2571"></a> rect-><a href="tqcanvasitem.html#show">show</a>(); </pre> -<p> We create a new <a href="qcanvasrectangle.html">TQCanvasRectangle</a> for each bar with an x position of 0 +<p> We create a new <a href="tqcanvasrectangle.html">TQCanvasRectangle</a> for each bar with an x position of 0 (since this is a horizontal bar chart every bar begins at the left), a y value that starts at 0 and grows by the height of each bar as each one is drawn, the height of the bar and the canvas that the bar should @@ -176,11 +176,11 @@ containing the label text. (The valueLabel() function adds on the value or percentage to the textual label if the user has set the appropriate options.) <p> <pre> CanvasText *text = new CanvasText( i, label, m_font, m_canvas ); - <a name="x2574"></a> text-><a href="qcanvastext.html#setColor">setColor</a>( m_elements[i].labelColor() ); - <a name="x2568"></a> text-><a href="qcanvasitem.html#setX">setX</a>( proX * width ); - <a name="x2569"></a> text-><a href="qcanvasitem.html#setY">setY</a>( proY * height ); - text-><a href="qcanvasitem.html#setZ">setZ</a>( 1 ); - text-><a href="qcanvasitem.html#show">show</a>(); + <a name="x2574"></a> text-><a href="tqcanvastext.html#setColor">setColor</a>( m_elements[i].labelColor() ); + <a name="x2568"></a> text-><a href="tqcanvasitem.html#setX">setX</a>( proX * width ); + <a name="x2569"></a> text-><a href="tqcanvasitem.html#setY">setY</a>( proY * height ); + text-><a href="tqcanvasitem.html#setZ">setZ</a>( 1 ); + text-><a href="tqcanvasitem.html#show">show</a>(); m_elements[i].setProX( HORIZONTAL_BAR, proX ); m_elements[i].setProY( HORIZONTAL_BAR, proY ); </pre> @@ -201,22 +201,22 @@ proportional height ready to draw the next element. } } </pre> -<p> <h2> Subclassing <a href="qcanvastext.html">TQCanvasText</a> +<p> <h2> Subclassing <a href="tqcanvastext.html">TQCanvasText</a> </h2> <a name="2"></a><p> (Extracts from <tt>canvastext.h</tt>.) <p> -<pre> class CanvasText : public <a href="qcanvastext.html">TQCanvasText</a> +<pre> class CanvasText : public <a href="tqcanvastext.html">TQCanvasText</a> { public: enum { CANVAS_TEXT = 1100 }; CanvasText( int index, TQCanvas *canvas ) - : <a href="qcanvastext.html">TQCanvasText</a>( canvas ), m_index( index ) {} + : <a href="tqcanvastext.html">TQCanvasText</a>( canvas ), m_index( index ) {} CanvasText( int index, const <a href="ntqstring.html">TQString</a>& text, TQCanvas *canvas ) - : <a href="qcanvastext.html">TQCanvasText</a>( text, canvas ), m_index( index ) {} + : <a href="tqcanvastext.html">TQCanvasText</a>( text, canvas ), m_index( index ) {} CanvasText( int index, const <a href="ntqstring.html">TQString</a>& text, TQFont font, TQCanvas *canvas ) - : <a href="qcanvastext.html">TQCanvasText</a>( text, font, canvas ), m_index( index ) {} + : <a href="tqcanvastext.html">TQCanvasText</a>( text, font, canvas ), m_index( index ) {} int index() const { return m_index; } void setIndex( int index ) { m_index = index; } @@ -228,21 +228,21 @@ proportional height ready to draw the next element. }; </pre> <p> Our CanvasText subclass is a very simple specialisation of -<a href="qcanvastext.html">TQCanvasText</a>. All we've done is added a single private member <tt>m_index</tt> which holds the element vector index of the element associated +<a href="tqcanvastext.html">TQCanvasText</a>. All we've done is added a single private member <tt>m_index</tt> which holds the element vector index of the element associated with this text item, and provided a getter and setter for this value. -<p> <h2> Subclassing <a href="qcanvasview.html">TQCanvasView</a> +<p> <h2> Subclassing <a href="tqcanvasview.html">TQCanvasView</a> </h2> <a name="3"></a><p> (Extracts from <tt>canvasview.h</tt>.) <p> -<pre> class CanvasView : public <a href="qcanvasview.html">TQCanvasView</a> +<pre> class CanvasView : public <a href="tqcanvasview.html">TQCanvasView</a> { <a href="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> public: - CanvasView( <a href="ntqcanvas.html">TQCanvas</a> *canvas, ElementVector *elements, + CanvasView( <a href="tqcanvas.html">TQCanvas</a> *canvas, ElementVector *elements, <a href="ntqwidget.html">TQWidget</a>* parent = 0, const char* name = "canvas view", WFlags f = 0 ) - : <a href="qcanvasview.html">TQCanvasView</a>( canvas, parent, name, f ), m_movingItem(0), + : <a href="tqcanvasview.html">TQCanvasView</a>( canvas, parent, name, f ), m_movingItem(0), m_elements( elements ) {} protected: @@ -252,12 +252,12 @@ with this text item, and provided a getter and setter for this value. void contentsContextMenuEvent( <a href="qcontextmenuevent.html">TQContextMenuEvent</a> *e ); private: - <a href="qcanvasitem.html">TQCanvasItem</a> *m_movingItem; + <a href="tqcanvasitem.html">TQCanvasItem</a> *m_movingItem; <a href="ntqpoint.html">TQPoint</a> m_pos; ElementVector *m_elements; }; </pre> -<p> We need to subclass <a href="qcanvasview.html">TQCanvasView</a> so that we can handle: +<p> We need to subclass <a href="tqcanvasview.html">TQCanvasView</a> so that we can handle: <ol type=1> <li> Context menu requests. <li> Form resizing. @@ -284,7 +284,7 @@ position. </h3> <a name="3-2"></a><p> <pre> <a name="x2587"></a>void CanvasView::<a href="ntqscrollview.html#viewportResizeEvent">viewportResizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> *e ) { - <a name="x2583"></a> <a href="qcanvasview.html#canvas">canvas</a>()->resize( e-><a href="qresizeevent.html#size">size</a>().width(), e-><a href="qresizeevent.html#size">size</a>().height() ); + <a name="x2583"></a> <a href="tqcanvasview.html#canvas">canvas</a>()->resize( e-><a href="qresizeevent.html#size">size</a>().width(), e-><a href="qresizeevent.html#size">size</a>().height() ); ((ChartForm*)<a href="tqobject.html#parent">parent</a>())->drawElements(); } </pre> @@ -299,7 +299,7 @@ drawn correctly. drag and release at the new position. <p> <pre> <a name="x2586"></a>void CanvasView::<a href="ntqscrollview.html#contentsMousePressEvent">contentsMousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { - <a name="x2580"></a> <a href="qcanvasitemlist.html">TQCanvasItemList</a> list = <a href="qcanvasview.html#canvas">canvas</a>()->collisions( e-><a href="qmouseevent.html#pos">pos</a>() ); + <a name="x2580"></a> <a href="tqcanvasitemlist.html">TQCanvasItemList</a> list = <a href="tqcanvasview.html#canvas">canvas</a>()->collisions( e-><a href="qmouseevent.html#pos">pos</a>() ); <a name="x2589"></a><a name="x2588"></a> for ( TQCanvasItemList::iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>(); it != list.<a href="ntqvaluelist.html#end">end</a>(); ++it ) if ( (*it)->rtti() == CanvasText::CANVAS_TEXT ) { m_movingItem = *it; @@ -328,7 +328,7 @@ and record its position. Otherwise we set there to be no moving item. (*m_elements)[i].setProX( chartType, item->x() / canvas()->width() ); (*m_elements)[i].setProY( chartType, item->y() / canvas()->height() ); - <a href="qcanvasview.html#canvas">canvas</a>()->update(); + <a href="tqcanvasview.html#canvas">canvas</a>()->update(); } } </pre> @@ -342,16 +342,16 @@ element's proportional x and y positions for the current chart type to the current x and y positions proportional to the width and height respectively. We know which element to update because when we create each canvas text item we pass it the index position of the element it -corresponds to. We subclassed <a href="qcanvastext.html">TQCanvasText</a> so that we could set and get +corresponds to. We subclassed <a href="tqcanvastext.html">TQCanvasText</a> so that we could set and get this index value. Finally we call update() to make the canvas redraw. <p> <center><table cellpadding="4" cellspacing="2" border="0"> <tr bgcolor="#f0f0f0"> -<td valign="top">A <a href="ntqcanvas.html">TQCanvas</a> has no visual representation. To see the contents of a -canvas you must create a <a href="qcanvasview.html">TQCanvasView</a> to present the canvas. Items only +<td valign="top">A <a href="tqcanvas.html">TQCanvas</a> has no visual representation. To see the contents of a +canvas you must create a <a href="tqcanvasview.html">TQCanvasView</a> to present the canvas. Items only appear in the canvas view if they have been show()n, and then, only if -<a href="ntqcanvas.html#update">TQCanvas::update</a>() has been called. By default a TQCanvas's background +<a href="tqcanvas.html#update">TQCanvas::update</a>() has been called. By default a TQCanvas's background color is white, and by default shapes drawn on the canvas, e.g. -<a href="qcanvasrectangle.html">TQCanvasRectangle</a>, <a href="qcanvasellipse.html">TQCanvasEllipse</a>, etc., have their fill color set to +<a href="tqcanvasrectangle.html">TQCanvasRectangle</a>, <a href="tqcanvasellipse.html">TQCanvasEllipse</a>, etc., have their fill color set to white, so setting a non-white brush color is highly recommended! </table></center> <p> <p align="right"> |