From 8ac0e970e4464d9f8f73c0fb34a178ff135be8c3 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 2 Jun 2024 23:07:22 +0900 Subject: Rename ntqwidget* related files to equivalent tqwidget* Signed-off-by: Michele Calgaro --- doc/html/tutorial1-08.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'doc/html/tutorial1-08.html') diff --git a/doc/html/tutorial1-08.html b/doc/html/tutorial1-08.html index 13676712a..629ec4818 100644 --- a/doc/html/tutorial1-08.html +++ b/doc/html/tutorial1-08.html @@ -86,13 +86,13 @@ function using ::qInstallMsgHan

CannonField is a new custom widget that knows how to display itself.

-

    class CannonField : public TQWidget
+

    class CannonField : public TQWidget
     {
         TQ_OBJECT
     public:
-        CannonField( TQWidget *parent=0, const char *name=0 );
+        CannonField( TQWidget *parent=0, const char *name=0 );
 
-

CannonField inherits TQWidget, and we use the same idiom as for LCDRange. +

CannonField inherits TQWidget, and we use the same idiom as for LCDRange.

        int angle() const { return ang; }
         TQSizePolicy sizePolicy() const;
 
@@ -114,13 +114,13 @@ to update itself (i.e., paint the widget's surface).
 
 

-

    CannonField::CannonField( TQWidget *parent, const char *name )
-            : TQWidget( parent, name )
+

    CannonField::CannonField( TQWidget *parent, const char *name )
+            : TQWidget( parent, name )
     {
 

Again, we use the same idiom as for LCDRange in the previous chapter.

        ang = 45;
-        setPalette( TQPalette( TQColor( 250, 250, 200) ) );
+        setPalette( TQPalette( TQColor( 250, 250, 200) ) );
     }
 

The constructor initializes the angle value to 45 degrees and sets a @@ -137,7 +137,7 @@ colors will actually be used.) if ( ang == degrees ) return; ang = degrees; - repaint(); + repaint(); emit angleChanged( ang ); }

@@ -146,13 +146,13 @@ colors will actually be used.) chosen not to issue a warning if the new angle is out of range.

If the new angle equals the old one, we return immediately. It is important to only emit the signal angleChanged() when the angle really has changed. -

Then we set the new angle value and repaint our widget. The TQWidget::repaint() function clears the widget (usually filling it with +

Then we set the new angle value and repaint our widget. The TQWidget::repaint() function clears the widget (usually filling it with its background color) and sends a paint event to the widget. This 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 );
@@ -174,10 +174,10 @@ We'll come back to TQPainter later; it can do a great many things.
 

    #include "cannon.h"
 

We include our new class. -

    class MyWidget: public TQWidget
+

    class MyWidget: public TQWidget
     {
     public:
-        MyWidget( TQWidget *parent=0, const char *name=0 );
+        MyWidget( TQWidget *parent=0, const char *name=0 );
     };
 

This time we include a single LCDRange and a CannonField in our top-level @@ -244,7 +244,7 @@ resized.

We set an initial angle value. Note that this will trigger the connection from LCDRange to CannonField. -

        angle->setFocus();
+

        angle->setFocus();
 

Our last action is to set angle to have keyboard focus so that keyboard input will go to the LCDRange widget by default. @@ -252,7 +252,7 @@ keyboard input will go to the LCDRange widget by default. to be terribly useful. However, its constructor just got a new line:

-

        setFocusProxy( slider );
+
        setFocusProxy( slider );
 

The LCDRange sets the slider to be its focus proxy. That means that when someone (the program or the user) wants to give the LCDRange -- cgit v1.2.3