From 1e9fa8e06de5da7fcc268e9cccb2d6b21c5f53a3 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 20 Jul 2024 20:15:52 +0900 Subject: Rename graphics class nt* related files to equivalent tq* (part 2) Signed-off-by: Michele Calgaro --- doc/html/tutorial1-10.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'doc/html/tutorial1-10.html') diff --git a/doc/html/tutorial1-10.html b/doc/html/tutorial1-10.html index 8bb1345ba..5f59affa6 100644 --- a/doc/html/tutorial1-10.html +++ b/doc/html/tutorial1-10.html @@ -66,7 +66,7 @@ implementation.

The interface to the force follows the same practice as for the angle.

    private:
-        TQRect cannonRect() const;
+        TQRect cannonRect() const;
 

We have put the definition of the cannon's enclosing rectangle in a separate function. @@ -79,9 +79,9 @@ separate function.

-

    #include <ntqpixmap.h>
+

    #include <tqpixmap.h>
 
-

We include the TQPixmap class definition. +

We include the TQPixmap class definition.

    CannonField::CannonField( TQWidget *parent, const char *name )
             : TQWidget( parent, name )
     {
@@ -130,8 +130,8 @@ value, we don't need to repaint the widget.
 

We have now optimized the paint event to repaint only the parts of the widget that need updating. First we check whether we have to paint anything at all, and we return if we don't. -

        TQRect cr = cannonRect();
-        TQPixmap pix( cr.size() );
+

        TQRect cr = cannonRect();
+        TQPixmap pix( cr.size() );
 

Then we create a temporary pixmap, which we use for flicker-free painting. All the painting operations are done into this pixmap, and @@ -141,13 +141,13 @@ precisely once. Less, and you get drawing errors. More, and you get flicker. It doesn't matter much in this example - when the code was written there were still machines slow enough for it to flicker, but not any more. We've kept the code for educational purposes. -

        pix.fill( this, cr.topLeft() );
+

        pix.fill( this, cr.topLeft() );
 

We fill the pixmap with the background from this widget.

        TQPainter p( &pix );
         p.setBrush( blue );
         p.setPen( NoPen );
-        p.translate( 0, pix.height() - 1 );
+        p.translate( 0, pix.height() - 1 );
         p.drawPie( TQRect( -35,-35, 70, 70 ), 0, 90*16 );
         p.rotate( -ang );
         p.drawRect( TQRect(33, -4, 15, 8) );
@@ -157,15 +157,15 @@ not any more. We've kept the code for educational purposes.
 

At this point, we have a painter variable and a pixmap that looks precisely right, but we still haven't painted on the screen.

        p.begin( this );
-        p.drawPixmap( cr.topLeft(), pix );
+        p.drawPixmap( cr.topLeft(), pix );
 

So we open the painter on the CannonField itself and then draw the pixmap.

That's all. A couple of extra lines at the top and a couple at the bottom, and the code is 100% flicker-free.

    TQRect CannonField::cannonRect() const
     {
-        TQRect r( 0, 0, 50, 50 );
-        r.moveBottomLeft( rect().bottomLeft() );
+        TQRect r( 0, 0, 50, 50 );
+        r.moveBottomLeft( rect().bottomLeft() );
         return r;
     }
 
-- cgit v1.2.3