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/sql.html | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'doc/html/sql.html') diff --git a/doc/html/sql.html b/doc/html/sql.html index 4b170081..a88b8cbf 100644 --- a/doc/html/sql.html +++ b/doc/html/sql.html @@ -1024,16 +1024,16 @@ the code below can be automatically generated by

    #include <ntqapplication.h>
-    #include <ntqdialog.h>
+    #include <tqdialog.h>
     #include <tqlabel.h>
     #include <ntqlayout.h>
-    #include <ntqlineedit.h>
+    #include <tqlineedit.h>
     #include <tqsqldatabase.h>
     #include <tqsqlcursor.h>
     #include <tqsqlform.h>
     #include "../connection.h"
 
-    class FormDialog : public TQDialog
+    class FormDialog : public TQDialog
     {
         public:
             FormDialog();
@@ -1046,7 +1046,7 @@ the code below can be automatically generated by 
         TQLabel *surnameLabel    = new TQLabel( "Surname:", this );
         TQLabel *surnameDisplay  = new TQLabel( this );
         TQLabel *salaryLabel     = new TQLabel( "Salary:", this );
-        TQLineEdit *salaryEdit   = new TQLineEdit( this );
+        TQLineEdit *salaryEdit   = new TQLineEdit( this );
 
         TQGridLayout *grid = new TQGridLayout( this );
         grid->addWidget( forenameLabel,     0, 0 );
@@ -1076,7 +1076,7 @@ the code below can be automatically generated by 
         if ( ! createConnections() ) return 1;
 
         FormDialog *formDialog = new FormDialog();
-        formDialog->show();
+        formDialog->show();
         app.setMainWidget( formDialog );
 
         return app.exec();
@@ -1086,8 +1086,8 @@ the code below can be automatically generated by 
 

We include the header files for the widgets that we need. We also include tqsqldatabase.h and tqsqlcursor.h as usual, but we now add tqsqlform.h. -

The form will be presented as a dialog so we subclass TQDialog with -our own FormDialog class. We use a TQLineEdit for the salary so that +

The form will be presented as a dialog so we subclass TQDialog with +our own FormDialog class. We use a TQLineEdit for the salary so that the user can change it. All the widgets are laid out using a grid.

We create a cursor on the staff table, select all records and move to the first record. @@ -1115,7 +1115,7 @@ view of a record: differences.

-

    class FormDialog : public TQDialog
+
    class FormDialog : public TQDialog
     {
         TQ_OBJECT
         public:
@@ -1142,15 +1142,15 @@ confirm their update. We also hold pointers to the TQ
 right pad the fields are removed when the fields are retrieved.
 

Properties that we might wish to apply to fields, such as alignment and validation are achieved in the conventional way, for example, by -calling TQLineEdit::setAlignment() and TQLineEdit::setValidator(). -

        TQLineEdit   *forenameEdit  = new TQLineEdit( this );
+calling TQLineEdit::setAlignment() and TQLineEdit::setValidator().
+

        TQLineEdit   *forenameEdit  = new TQLineEdit( this );
 
-

        TQPushButton *saveButton    = new TQPushButton( "&Save", this );
+

        TQPushButton *saveButton    = new TQPushButton( "&Save", this );
         connect( saveButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(save()) );
 

The FormDialog constructor is similar to the one in the previous example. We have changed the forename and surname widgets to -TQLineEdits to make them editable and have added a TQPushButton +TQLineEdits to make them editable and have added a TQPushButton the user can click to save their updates.

        grid->addWidget( saveButton,    3, 0 );
 
@@ -1171,7 +1171,7 @@ cursor's update buffer. sqlForm->insert( salaryEdit, "salary" ); sqlForm->readFields();
-

Now we link the buffer's fields to the TQLineEdit controls. (In the +

Now we link the buffer's fields to the TQLineEdit controls. (In the previous example we linked the cursor's fields.) The edit controls are populated by the readFields() call as before.

    FormDialog::~FormDialog()
@@ -1214,7 +1214,7 @@ data.
 we will only cover the differences here. The full source is in sql/overview/custom1/main.h and sql/overview/custom1/main.cpp
 

-

    class CustomEdit : public TQLineEdit
+
    class CustomEdit : public TQLineEdit
     {
         TQ_OBJECT
         TQ_PROPERTY( TQString upperLine READ upperLine WRITE setUpperLine )
@@ -1228,7 +1228,7 @@ we will only cover the differences here. The full source is in TQString upperLineText;
     };
 
-

We've created a simple subclass of TQLineEdit and added a property, +

We've created a simple subclass of TQLineEdit and added a property, upperLineText, which will hold an uppercase version of the text. We also created a slot, changed().

            TQSqlPropertyMap *propMap;
@@ -1238,9 +1238,9 @@ to our FormDialog's private data.
 

    CustomEdit::CustomEdit( TQWidget *parent, const char *name ) :
-        TQLineEdit( parent, name )
+        TQLineEdit( parent, name )
     {
-        connect( this, TQ_SIGNAL(textChanged(const TQString &)),
+        connect( this, TQ_SIGNAL(textChanged(const TQString &)),
                  this, TQ_SLOT(changed(const TQString &)) );
     }
 
@@ -1268,7 +1268,7 @@ CustomEdit instances directly to database fields.

        CustomEdit  *surnameEdit    = new CustomEdit( this );
 

We use the same FormDialog as we did before, but this time replace two -of the TQLineEdit widgets with our own CustomEdit widgets. +of the TQLineEdit widgets with our own CustomEdit widgets.

Laying out the grid and setting up the cursor is the same as before.

        propMap = new TQSqlPropertyMap;
         propMap->insert( forenameEdit->className(), "upperLine" );
@@ -1291,11 +1291,11 @@ our CustomEdit widget.
 
 

We must reimpliment TQSqlEditorFactory to use custom editor widgets in tables. In the following example we will create a custom editor based -on TQComboBox and a TQSqlEditorFactory subclass to show how a TQDataTable +on TQComboBox and a TQSqlEditorFactory subclass to show how a TQDataTable can use a custom editor.

-

    class StatusPicker : public TQComboBox
+
    class StatusPicker : public TQComboBox
     {
         TQ_OBJECT
         TQ_PROPERTY( int statusid READ statusId WRITE setStatusId )
@@ -1324,14 +1324,14 @@ function since that is the only function we need to reimplement.
 

    StatusPicker::StatusPicker( TQWidget *parent, const char *name )
-        : TQComboBox( parent, name )
+        : TQComboBox( parent, name )
     {
         TQSqlCursor cur( "status" );
         cur.select( cur.index( "name" ) );
 
         int i = 0;
         while ( cur.next() ) {
-            insertItem( cur.value( "name" ).toString(), i );
+            insertItem( cur.value( "name" ).toString(), i );
             index2id[i] = cur.value( "id" ).toInt();
             i++;
         }
-- 
cgit v1.2.1