From fef846914f8db6dc117e206ef913d519bf6bb33e Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 29 Jul 2024 12:43:23 +0900 Subject: Rename basic widget nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/html/tutorial2-08.html | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'doc/html/tutorial2-08.html') diff --git a/doc/html/tutorial2-08.html b/doc/html/tutorial2-08.html index da976638..6bd21ee6 100644 --- a/doc/html/tutorial2-08.html +++ b/doc/html/tutorial2-08.html @@ -40,7 +40,7 @@ enter label text and choose a label color for each label.

(Extracts from setdataform.h.)

-

    class SetDataForm: public TQDialog
+
    class SetDataForm: public TQDialog
     {
         TQ_OBJECT
     public:
@@ -60,9 +60,9 @@ enter label text and choose a label color for each label.
 
     private:
         TQTable *table;
-        TQPushButton *colorPushButton;
-        TQPushButton *okPushButton;
-        TQPushButton *cancelPushButton;
+        TQPushButton *colorPushButton;
+        TQPushButton *okPushButton;
+        TQPushButton *cancelPushButton;
 
     protected:
         TQVBoxLayout *tableButtonBox;
@@ -90,13 +90,13 @@ TQt supports. We'll use these in the pattern combobox.
 

    SetDataForm::SetDataForm( ElementVector *elements, int decimalPlaces,
                               TQWidget* parent,  const char* name,
                               bool modal, WFlags f )
-        : TQDialog( parent, name, modal, f )
+        : TQDialog( parent, name, modal, f )
 
     {
         m_elements = elements;
         m_decimalPlaces = decimalPlaces;
 
-

We pass most of the arguments to the TQDialog superclass. We assign the +

We pass most of the arguments to the TQDialog superclass. We assign the elements vector pointer and the number of decimal places to display to member variables so that they are accessible by all SetDataForm's member functions. @@ -139,7 +139,7 @@ column and finally add the table to the tableButtonBox layout.

        buttonBox = new TQHBoxLayout( 0, 0, 6, "button box layout" );
 

We create a horizontal box layout to hold the buttons. -

        colorPushButton = new TQPushButton( this, "color button" );
+

        colorPushButton = new TQPushButton( this, "color button" );
         colorPushButton->setText( "&Color..." );
         colorPushButton->setEnabled( FALSE );
         buttonBox->addWidget( colorPushButton );
@@ -153,12 +153,12 @@ on a color cell.
 

Since we want to separate the color button from the OK and Cancel buttons we next create a spacer and add that to the buttonBox layout. -

        okPushButton = new TQPushButton( this, "ok button" );
+

        okPushButton = new TQPushButton( this, "ok button" );
         okPushButton->setText( "OK" );
-        okPushButton->setDefault( TRUE );
+        okPushButton->setDefault( TRUE );
         buttonBox->addWidget( okPushButton );
 
-        cancelPushButton = new TQPushButton( this, "cancel button" );
+        cancelPushButton = new TQPushButton( this, "cancel button" );
         cancelPushButton->setText( "Cancel" );
         cancelPushButton->setAccel( Key_Escape );
         buttonBox->addWidget( cancelPushButton );
@@ -177,8 +177,8 @@ complete.
         connect( table, TQ_SIGNAL( valueChanged(int,int) ),
                  this, TQ_SLOT( valueChanged(int,int) ) );
         connect( colorPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( setColor() ) );
-        connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
-        connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
+        connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
+        connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
 

We now "wire up" the form.

    @@ -194,7 +194,7 @@ correct number of decimal places.
  • If the user clicks the Color button we call a setColor() slot.
  • The OK button is connected to the accept() slot; we will update the elements vector in this slot. -
  • The Cancel button is connected to the TQDialog reject() slot, and +
  • The Cancel button is connected to the TQDialog reject() slot, and requires no further code or action on our part.

        TQPixmap patterns[MAX_PATTERNS];
@@ -221,10 +221,10 @@ create a blank pixmap of that size.
             table->setPixmap( i, 1, pix );
             table->setText( i, 1, color.name() );
 
-            TQComboBox *combobox = new TQComboBox;
+            TQComboBox *combobox = new TQComboBox;
             for ( int j = 0; j < MAX_PATTERNS; ++j )
-                combobox->insertItem( patterns[j] );
-            combobox->setCurrentItem( element.valuePattern() - 1 );
+                combobox->insertItem( patterns[j] );
+            combobox->setCurrentItem( element.valuePattern() - 1 );
             table->setCellWidget( i, 2, combobox );
 
             table->setText( i, 3, element.label() );
@@ -246,9 +246,9 @@ CanvasText subclass) and store the color there. But we've taken a
 simpler route: we set the cell's text to the name of the color.
 

Next we populate the pattern combobox with the patterns. We will use the position of the chosen pattern in the combobox to determine which -pattern the user has selected. TQTable can make use of TQComboTableItem +pattern the user has selected. TQTable can make use of TQComboTableItem items; but these only support text, so we use setCellWidget() to -insert TQComboBox's into the table instead. +insert TQComboBox's into the table instead.

Next we insert the element's label. Finally we set the label color in the same way as we set the value color.

The Slots @@ -305,7 +305,7 @@ function and put the focus back into the table. the static TQColorDialog::getColor() dialog to get the user's choice of color. If they chose a color we fill the color cell's pixmap with that color and set the cell's text to the new color's name. -

    void SetDataForm::accept()
+

    void SetDataForm::accept()
     {
         bool ok;
         for ( int i = 0; i < ChartForm::MAX_ELEMENTS; ++i ) {
@@ -322,7 +322,7 @@ color and set the cell's text to the new color's name.
             element.setLabelColor( TQColor( table->text( i, 4 ) ) );
         }
 
-        TQDialog::accept();
+        TQDialog::accept();
     }
 

If the user clicks OK we must update the elements vector. We iterate @@ -332,7 +332,7 @@ and the label color by constructing TQColor temporari color name as argument. The pattern is set to the pattern combobox's current item with an offset of 1 (since our pattern numbers begin at 1, but the combobox's items are indexed from 0). -

Finally we call TQDialog::accept(). +

Finally we call TQDialog::accept().

« File Handling | Contents | -- cgit v1.2.1