From a30f5359f03c3017fa19a6770fab32d25d22cb87 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 15 Jul 2024 19:08:22 +0900 Subject: Rename graphics class nt* related files to equivalent tq* (part 1) Signed-off-by: Michele Calgaro --- doc/html/tutorial1-08.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/html/tutorial1-08.html') diff --git a/doc/html/tutorial1-08.html b/doc/html/tutorial1-08.html index a01d71a26..4eda29b4d 100644 --- a/doc/html/tutorial1-08.html +++ b/doc/html/tutorial1-08.html @@ -105,7 +105,7 @@ function using ::qInstallMsgHan

For the time being, CannonField only contains an angle value for which we provide an interface using the same idiom as for value in LCDRange.

    protected:
-        void paintEvent( TQPaintEvent * );
+        void paintEvent( TQPaintEvent * );
 

This is the second of the many event handlers in TQWidget that we encounter. This virtual function is called by TQt whenever a widget needs @@ -152,20 +152,20 @@ results in a call to the paint event function of the widget.

Finally, we emit the angleChanged() signal to tell the outside world that the angle has changed. The emit keyword is unique to TQt and not regular C++ syntax. In fact, it is a macro. -

    void CannonField::paintEvent( TQPaintEvent * )
+

    void CannonField::paintEvent( TQPaintEvent * )
     {
         TQString s = "Angle = " + TQString::number( ang );
-        TQPainter p( this );
-        p.drawText( 200, 200, s );
+        TQPainter p( this );
+        p.drawText( 200, 200, s );
     }
 

This is our first attempt to write a paint event handler. The event -argument contains a description of the paint event. TQPaintEvent +argument contains a description of the paint event. TQPaintEvent contains the region in the widget that must be updated. For the time being, we will be lazy and just paint everything.

Our code displays the angle value in the widget at a fixed position. First we create a TQString with some text and the angle; then we create -a TQPainter operating on this widget and use it to paint the string. +a TQPainter operating on this widget and use it to paint the string. We'll come back to TQPainter later; it can do a great many things.

t8/main.cpp

-- cgit v1.2.1