From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/tutorial2-06.html | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'doc/html/tutorial2-06.html') diff --git a/doc/html/tutorial2-06.html b/doc/html/tutorial2-06.html index 09dab5723..baf5493c6 100644 --- a/doc/html/tutorial2-06.html +++ b/doc/html/tutorial2-06.html @@ -44,7 +44,7 @@ drawElements() function is called to redraw the canvas when necessary.
    void ChartForm::drawElements()
     {
         TQCanvasItemList list = m_canvas->allItems();
-        for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it )
+        for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it )
             delete *it;
 

The first thing we do in drawElements() is delete all the existing @@ -123,8 +123,8 @@ required) and a count of the number of values.

We retrieve the width and height of the canvas and calculate the proportional height (proheight). We set the initial y position to 0. -

        TQPen pen;
-        pen.setStyle( NoPen );
+

        TQPen pen;
+        pen.setStyle( NoPen );
 

We create a pen that we will use to draw each bar (rectangle); we set it to NoPen so that no outlines are drawn. @@ -151,8 +151,8 @@ be drawn on. We then set the bar's brush to the color and pattern that the user has specified for the element, set the pen to the pen we created earlier (i.e. to NoPen) and we place the bar at position 0 in the Z-order. Finally we call show() to draw the bar on the canvas. -

                TQString label = m_elements[i].label();
-                if ( !label.isEmpty() || m_addValues != NO ) {
+

                TQString label = m_elements[i].label();
+                if ( !label.isEmpty() || m_addValues != NO ) {
                     double proX = m_elements[i].proX( HORIZONTAL_BAR );
                     double proY = m_elements[i].proY( HORIZONTAL_BAR );
                     if ( proX < 0 || proY < 0 ) {
@@ -213,9 +213,9 @@ proportional height ready to draw the next element.
 
         CanvasText( int index, TQCanvas *canvas )
             : TQCanvasText( canvas ), m_index( index ) {}
-        CanvasText( int index, const TQString& text, TQCanvas *canvas )
+        CanvasText( int index, const TQString& text, TQCanvas *canvas )
             : TQCanvasText( text, canvas ), m_index( index ) {}
-        CanvasText( int index, const TQString& text, TQFont font, TQCanvas *canvas )
+        CanvasText( int index, const TQString& text, TQFont font, TQCanvas *canvas )
             : TQCanvasText( text, font, canvas ), m_index( index ) {}
 
         int index() const { return m_index; }
@@ -239,8 +239,8 @@ with this text item, and provided a getter and setter for this value.
     {
         Q_OBJECT
     public:
-        CanvasView( TQCanvas *canvas, ElementVector *elements,
-                    TQWidget* parent = 0, const char* name = "canvas view",
+        CanvasView( TQCanvas *canvas, ElementVector *elements,
+                    TQWidget* parent = 0, const char* name = "canvas view",
                     WFlags f = 0 )
             : TQCanvasView( canvas, parent, name, f ), m_movingItem(0),
               m_elements( elements ) {}
@@ -253,7 +253,7 @@ with this text item, and provided a getter and setter for this value.
 
     private:
         TQCanvasItem *m_movingItem;
-        TQPoint m_pos;
+        TQPoint m_pos;
         ElementVector *m_elements;
     };
 
@@ -271,9 +271,9 @@ vector.

(Extracts from canvasview.cpp.)

-

    void CanvasView::contentsContextMenuEvent( TQContextMenuEvent * )
+
    void CanvasView::contentsContextMenuEvent( TQContextMenuEvent * )
     {
-        ((ChartForm*)parent())->optionsMenu->exec( TQCursor::pos() );
+        ((ChartForm*)parent())->optionsMenu->exec( TQCursor::pos() );
     }
 

When the user invokes a context menu (e.g. by right-clicking on most @@ -282,10 +282,10 @@ to the right type and then exec()ute the options menu at the cursor position.

Handling Resizing

-

    void CanvasView::viewportResizeEvent( TQResizeEvent *e )
+

    void CanvasView::viewportResizeEvent( TQResizeEvent *e )
     {
         canvas()->resize( e->size().width(), e->size().height() );
-        ((ChartForm*)parent())->drawElements();
+        ((ChartForm*)parent())->drawElements();
     }
 

To resize we simply resize the canvas that the canvas view is @@ -297,10 +297,10 @@ drawn correctly.

When the user wants to drag a label into position they click it, then drag and release at the new position. -

    void CanvasView::contentsMousePressEvent( TQMouseEvent *e )
+

    void CanvasView::contentsMousePressEvent( TQMouseEvent *e )
     {
         TQCanvasItemList list = canvas()->collisions( e->pos() );
-        for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it )
+        for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it )
             if ( (*it)->rtti() == CanvasText::CANVAS_TEXT ) {
                 m_movingItem = *it;
                 m_pos = e->pos();
@@ -313,13 +313,13 @@ drag and release at the new position.
 the mouse click "collided" with (if any). We then iterate over this
 list and if we find a CanvasText item we set it as the moving item
 and record its position. Otherwise we set there to be no moving item.
-

    void CanvasView::contentsMouseMoveEvent( TQMouseEvent *e )
+

    void CanvasView::contentsMouseMoveEvent( TQMouseEvent *e )
     {
         if ( m_movingItem ) {
-            TQPoint offset = e->pos() - m_pos;
-            m_movingItem->moveBy( offset.x(), offset.y() );
+            TQPoint offset = e->pos() - m_pos;
+            m_movingItem->moveBy( offset.x(), offset.y() );
             m_pos = e->pos();
-            ChartForm *form = (ChartForm*)parent();
+            ChartForm *form = (ChartForm*)parent();
             form->setChanged( TRUE );
             int chartType = form->chartType();
             CanvasText *item = (CanvasText*)m_movingItem;
@@ -346,10 +346,10 @@ corresponds to. We subclassed TQCanvasText so tha
 this index value. Finally we call update() to make the canvas redraw.
 

-
A TQCanvas has no visual representation. To see the contents of a +A TQCanvas has no visual representation. To see the contents of a canvas you must create a TQCanvasView to present the canvas. Items only appear in the canvas view if they have been show()n, and then, only if -TQCanvas::update() has been called. By default a TQCanvas's background +TQCanvas::update() has been called. By default a TQCanvas's background color is white, and by default shapes drawn on the canvas, e.g. TQCanvasRectangle, TQCanvasEllipse, etc., have their fill color set to white, so setting a non-white brush color is highly recommended! -- cgit v1.2.1