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-09.html | 118 ++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'doc/html/tutorial2-09.html') diff --git a/doc/html/tutorial2-09.html b/doc/html/tutorial2-09.html index a8c5586d..52f6678d 100644 --- a/doc/html/tutorial2-09.html +++ b/doc/html/tutorial2-09.html @@ -39,30 +39,30 @@ apply to all data sets in one place.

(Extracts from optionsform.h.)

-

    class OptionsForm : public TQDialog
+
    class OptionsForm : public TQDialog
     {
         Q_OBJECT
     public:
-        OptionsForm( TQWidget* parent = 0, const char* name = "options form",
+        OptionsForm( TQWidget* parent = 0, const char* name = "options form",
                      bool modal = FALSE, WFlags f = 0 );
         ~OptionsForm() {}
 
-        TQFont font() const { return m_font; }
-        void setFont( TQFont font );
-
-        TQLabel *chartTypeTextLabel;
-        TQComboBox *chartTypeComboBox;
-        TQPushButton *fontPushButton;
-        TQLabel *fontTextLabel;
-        TQFrame *addValuesFrame;
-        TQButtonGroup *addValuesButtonGroup;
-        TQRadioButton *noRadioButton;
-        TQRadioButton *yesRadioButton;
-        TQRadioButton *asPercentageRadioButton;
-        TQLabel *decimalPlacesTextLabel;
-        TQSpinBox *decimalPlacesSpinBox;
-        TQPushButton *okPushButton;
-        TQPushButton *cancelPushButton;
+        TQFont font() const { return m_font; }
+        void setFont( TQFont font );
+
+        TQLabel *chartTypeTextLabel;
+        TQComboBox *chartTypeComboBox;
+        TQPushButton *fontPushButton;
+        TQLabel *fontTextLabel;
+        TQFrame *addValuesFrame;
+        TQButtonGroup *addValuesButtonGroup;
+        TQRadioButton *noRadioButton;
+        TQRadioButton *yesRadioButton;
+        TQRadioButton *asPercentageRadioButton;
+        TQLabel *decimalPlacesTextLabel;
+        TQSpinBox *decimalPlacesSpinBox;
+        TQPushButton *okPushButton;
+        TQPushButton *cancelPushButton;
 
     protected slots:
         void chooseFont();
@@ -77,7 +77,7 @@ apply to all data sets in one place.
         TQHBoxLayout *buttonsLayout;
 
     private:
-        TQFont m_font;
+        TQFont m_font;
     };
 

The layout of this dialog is slightly more complicated than for the @@ -95,14 +95,14 @@ things based on the changes the user makes.

We include some some pixmaps to use in the chart type combobox.

The Constructor

-

    OptionsForm::OptionsForm( TQWidget* parent, const char* name,
+

    OptionsForm::OptionsForm( TQWidget* parent, const char* name,
                               bool modal, WFlags f )
-        : TQDialog( parent, name, modal, f )
+        : TQDialog( parent, name, modal, f )
     {
-        setCaption( "Chart -- Options" );
-        resize( 320, 290 );
+        setCaption( "Chart -- Options" );
+        resize( 320, 290 );
 
-

We pass all the arguments on to the TQDialog constructor, set a caption +

We pass all the arguments on to the TQDialog constructor, set a caption and set an initial size.

The layout of the form will be to have the chart type label and combo box in a horizontal box layout, and similarly for the font button and @@ -117,14 +117,14 @@ vertical box layout.

        chartTypeLayout = new TQHBoxLayout( 0, 0, 6 );
 

The chart type label and combobox will be laid out side by side. -

        chartTypeTextLabel = new TQLabel( "&Chart Type", this );
+

        chartTypeTextLabel = new TQLabel( "&Chart Type", this );
         chartTypeLayout->addWidget( chartTypeTextLabel );
 
-        chartTypeComboBox = new TQComboBox( FALSE, this );
-        chartTypeComboBox->insertItem( TQPixmap( options_piechart ), "Pie Chart" );
-        chartTypeComboBox->insertItem( TQPixmap( options_verticalbarchart ),
+        chartTypeComboBox = new TQComboBox( FALSE, this );
+        chartTypeComboBox->insertItem( TQPixmap( options_piechart ), "Pie Chart" );
+        chartTypeComboBox->insertItem( TQPixmap( options_verticalbarchart ),
                                        "Vertical Bar Chart" );
-        chartTypeComboBox->insertItem( TQPixmap( options_horizontalbarchart ),
+        chartTypeComboBox->insertItem( TQPixmap( options_horizontalbarchart ),
                                        "Horizontal Bar Chart" );
         chartTypeLayout->addWidget( chartTypeComboBox );
         optionsFormLayout->addLayout( chartTypeLayout );
@@ -136,14 +136,14 @@ to the horizontal layout and add the horizontal layout to the form's
 vertical layout.
 

        fontLayout = new TQHBoxLayout( 0, 0, 6 );
 
-        fontPushButton = new TQPushButton( "&Font...", this );
+        fontPushButton = new TQPushButton( "&Font...", this );
         fontLayout->addWidget( fontPushButton );
         TQSpacerItem* spacer = new TQSpacerItem( 0, 0,
                                                TQSizePolicy::Expanding,
                                                TQSizePolicy::Minimum );
         fontLayout->addItem( spacer );
 
-        fontTextLabel = new TQLabel( this ); // Must be set by caller via setFont()
+        fontTextLabel = new TQLabel( this ); // Must be set by caller via setFont()
         fontLayout->addWidget( fontTextLabel );
         optionsFormLayout->addLayout( fontLayout );
 
@@ -151,27 +151,27 @@ vertical layout. label. The font button is straight-forward. We add a spacer to improve the appearance. The font text label is initially empty (since we don't know what font the user is using). -

        addValuesFrame = new TQFrame( this );
-        addValuesFrame->setFrameShape( TQFrame::StyledPanel );
-        addValuesFrame->setFrameShadow( TQFrame::Sunken );
+

        addValuesFrame = new TQFrame( this );
+        addValuesFrame->setFrameShape( TQFrame::StyledPanel );
+        addValuesFrame->setFrameShadow( TQFrame::Sunken );
         addValuesFrameLayout = new TQVBoxLayout( addValuesFrame, 11, 6 );
 
-        addValuesButtonGroup = new TQButtonGroup( "Show Values", addValuesFrame );
-        addValuesButtonGroup->setColumnLayout(0, TQt::Vertical );
-        addValuesButtonGroup->layout()->setSpacing( 6 );
-        addValuesButtonGroup->layout()->setMargin( 11 );
+        addValuesButtonGroup = new TQButtonGroup( "Show Values", addValuesFrame );
+        addValuesButtonGroup->setColumnLayout(0, TQt::Vertical );
+        addValuesButtonGroup->layout()->setSpacing( 6 );
+        addValuesButtonGroup->layout()->setMargin( 11 );
         addValuesButtonGroupLayout = new TQVBoxLayout(
-                                            addValuesButtonGroup->layout() );
+                                            addValuesButtonGroup->layout() );
         addValuesButtonGroupLayout->setAlignment( TQt::AlignTop );
 
-        noRadioButton = new TQRadioButton( "&No", addValuesButtonGroup );
-        noRadioButton->setChecked( TRUE );
+        noRadioButton = new TQRadioButton( "&No", addValuesButtonGroup );
+        noRadioButton->setChecked( TRUE );
         addValuesButtonGroupLayout->addWidget( noRadioButton );
 
-        yesRadioButton = new TQRadioButton( "&Yes", addValuesButtonGroup );
+        yesRadioButton = new TQRadioButton( "&Yes", addValuesButtonGroup );
         addValuesButtonGroupLayout->addWidget( yesRadioButton );
 
-        asPercentageRadioButton = new TQRadioButton( "As &Percentage",
+        asPercentageRadioButton = new TQRadioButton( "As &Percentage",
                                                     addValuesButtonGroup );
         addValuesButtonGroupLayout->addWidget( asPercentageRadioButton );
         addValuesFrameLayout->addWidget( addValuesButtonGroup );
@@ -185,21 +185,21 @@ create the radio buttons, making "No" the default.
 

The decimal places label and spin box are laid out just like the other horizontal layouts, and the buttons are laid out in a very similar way to the buttons in the set data form. -

        connect( fontPushButton, SIGNAL( clicked() ), this, SLOT( chooseFont() ) );
-        connect( okPushButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
-        connect( cancelPushButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+

        connect( fontPushButton, SIGNAL( clicked() ), this, SLOT( chooseFont() ) );
+        connect( okPushButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+        connect( cancelPushButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
 

We only need three connections:

  1. When the user clicks the font button we execute our own chooseFont() slot. -
  2. If the user clicks OK we call TQDialog::accept(); it is up to the +
  3. If the user clicks OK we call TQDialog::accept(); it is up to the caller to read the data from the dialog's widgets and perform any necessary actions. -
  4. If the user clicks Cancel we call TQDialog::reject(). +
  5. If the user clicks Cancel we call TQDialog::reject().
-

        chartTypeTextLabel->setBuddy( chartTypeComboBox );
-        decimalPlacesTextLabel->setBuddy( decimalPlacesSpinBox );
+

        chartTypeTextLabel->setBuddy( chartTypeComboBox );
+        decimalPlacesTextLabel->setBuddy( decimalPlacesSpinBox );
 

We use the setBuddy() function to associate widgets with label accelerators. @@ -208,24 +208,24 @@ accelerators.

    void OptionsForm::chooseFont()
     {
         bool ok;
-        TQFont font = TQFontDialog::getFont( &ok, m_font, this );
+        TQFont font = TQFontDialog::getFont( &ok, m_font, this );
         if ( ok )
-            setFont( font );
+            setFont( font );
     }
 

When the user clicks the Font button this slot is invoked. It simply -calls the static TQFontDialog::getFont() function to obtain the user's +calls the static TQFontDialog::getFont() function to obtain the user's choice of font. If they chose a font we call our setFont() slot which will present a textual description of the font in the font label. -

    void OptionsForm::setFont( TQFont font )
+

    void OptionsForm::setFont( TQFont font )
     {
-        TQString label = font.family() + " " +
-                        TQString::number( font.pointSize() ) + "pt";
-        if ( font.bold() )
+        TQString label = font.family() + " " +
+                        TQString::number( font.pointSize() ) + "pt";
+        if ( font.bold() )
             label += " Bold";
-        if ( font.italic() )
+        if ( font.italic() )
             label += " Italic";
-        fontTextLabel->setText( label );
+        fontTextLabel->setText( label );
         m_font = font;
     }
 
-- cgit v1.2.1