diff options
Diffstat (limited to 'qtjava/javalib/examples/demo/sql')
-rw-r--r-- | qtjava/javalib/examples/demo/sql/BookForm.java | 84 | ||||
-rw-r--r-- | qtjava/javalib/examples/demo/sql/ConnectDialog.java | 64 | ||||
-rw-r--r-- | qtjava/javalib/examples/demo/sql/EditBookForm.java | 136 | ||||
-rw-r--r-- | qtjava/javalib/examples/demo/sql/Main.java | 2 |
4 files changed, 143 insertions, 143 deletions
diff --git a/qtjava/javalib/examples/demo/sql/BookForm.java b/qtjava/javalib/examples/demo/sql/BookForm.java index 67670357..0c51bd09 100644 --- a/qtjava/javalib/examples/demo/sql/BookForm.java +++ b/qtjava/javalib/examples/demo/sql/BookForm.java @@ -8,37 +8,37 @@ ****************************************************************************/ import org.kde.qt.*; -public class BookForm extends QWidget { - QDataTable AuthorDataTable; - QDataTable BookDataTable; - QPushButton connectButton; - QPushButton editButton; +public class BookForm extends TQWidget { + TQDataTable AuthorDataTable; + TQDataTable BookDataTable; + TQPushButton connectButton; + TQPushButton editButton; - QGridLayout BookFormLayout; - QSizePolicy policy_1; - QSizePolicy policy_2; - QSpacerItem spacer; - QSpacerItem spacer_2; + TQGridLayout BookFormLayout; + TQSizePolicy policy_1; + TQSizePolicy policy_2; + TQSpacerItem spacer; + TQSpacerItem spacer_2; - QSqlCursor authorCursor; - QSqlCursor bookCursor; + TQSqlCursor authorCursor; + TQSqlCursor bookCursor; /* * Constructs a BookForm which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ -BookForm( QWidget parent, String name, int fl ) +BookForm( TQWidget parent, String name, int fl ) { super( parent, name, fl ); if ( name == null ) setName( "BookForm" ); resize( 478, 498 ); setCaption( trUtf8( "Book" ) ); - BookFormLayout = new QGridLayout( this ); + BookFormLayout = new TQGridLayout( this ); BookFormLayout.setSpacing( 6 ); BookFormLayout.setMargin( 11 ); - AuthorDataTable = new QDataTable( this, "AuthorDataTable" ); + AuthorDataTable = new TQDataTable( this, "AuthorDataTable" ); AuthorDataTable.addColumn( "surname", trUtf8( "Surname", "" ) ); AuthorDataTable.addColumn( "forename", trUtf8( "Forename", "" ) ); AuthorDataTable.setSorting( true ); @@ -46,10 +46,10 @@ BookForm( QWidget parent, String name, int fl ) AuthorDataTable.setSort( new String[] { "surname ASC", "forename ASC" } ); BookFormLayout.addMultiCellWidget( AuthorDataTable, 1, 1, 0, 2 ); - spacer = new QSpacerItem( 20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum ); + spacer = new TQSpacerItem( 20, 20, TQSizePolicy.Expanding, TQSizePolicy.Minimum ); BookFormLayout.addMultiCell( spacer, 0, 0, 1, 2 ); - BookDataTable = new QDataTable( this, "BookDataTable" ); + BookDataTable = new TQDataTable( this, "BookDataTable" ); BookDataTable.addColumn( "title", trUtf8( "Title", "" ) ); BookDataTable.addColumn( "price", trUtf8( "Price", "" ) ); BookDataTable.addColumn( "notes", trUtf8( "Notes", "" ) ); @@ -58,19 +58,19 @@ BookForm( QWidget parent, String name, int fl ) BookDataTable.setSort( new String[] { "title ASC" } ); BookFormLayout.addMultiCellWidget( BookDataTable, 2, 2, 0, 2 ); - spacer_2 = new QSpacerItem( 20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum ); + spacer_2 = new TQSpacerItem( 20, 20, TQSizePolicy.Expanding, TQSizePolicy.Minimum ); BookFormLayout.addMultiCell( spacer_2, 3, 3, 0, 1 ); - connectButton = new QPushButton( this, "connectButton" ); - policy_1 = new QSizePolicy( (int)0, (int)0, connectButton.sizePolicy().hasHeightForWidth() ); + connectButton = new TQPushButton( this, "connectButton" ); + policy_1 = new TQSizePolicy( (int)0, (int)0, connectButton.sizePolicy().hasHeightForWidth() ); connectButton.setSizePolicy( policy_1 ); connectButton.setText( trUtf8( "&Connect..." ) ); BookFormLayout.addWidget( connectButton, 0, 0 ); - editButton = new QPushButton( this, "editButton" ); + editButton = new TQPushButton( this, "editButton" ); editButton.setEnabled( false ); - policy_2 = new QSizePolicy( (int)0, (int)0, editButton.sizePolicy().hasHeightForWidth() ); + policy_2 = new TQSizePolicy( (int)0, (int)0, editButton.sizePolicy().hasHeightForWidth() ); editButton.setSizePolicy( policy_2 ); editButton.setText( trUtf8( "&Edit Books" ) ); @@ -84,8 +84,8 @@ BookForm( QWidget parent, String name, int fl ) // signals and slots connections connect( editButton, SIGNAL( "clicked()" ), this, SLOT( "editClicked()" ) ); - connect( AuthorDataTable, SIGNAL( "primeInsert(QSqlRecord)" ), this, SLOT( "primeInsertAuthor(QSqlRecord)" ) ); - connect( AuthorDataTable, SIGNAL( "currentChanged(QSqlRecord)" ), this, SLOT( "newCurrentAuthor(QSqlRecord)" ) ); + connect( AuthorDataTable, SIGNAL( "primeInsert(TQSqlRecord)" ), this, SLOT( "primeInsertAuthor(TQSqlRecord)" ) ); + connect( AuthorDataTable, SIGNAL( "currentChanged(TQSqlRecord)" ), this, SLOT( "newCurrentAuthor(TQSqlRecord)" ) ); connect( connectButton, SIGNAL( "clicked()" ), this, SLOT( "connectClicked()" ) ); // tab order @@ -93,12 +93,12 @@ BookForm( QWidget parent, String name, int fl ) init(); } -BookForm( QWidget parent, String name ) +BookForm( TQWidget parent, String name ) { this(parent, name, 0); } -BookForm( QWidget parent ) +BookForm( TQWidget parent ) { this(parent, null, 0); } @@ -119,12 +119,12 @@ public void destroy() void editClicked() { EditBookForm dialog = new EditBookForm( this, "Edit Book Form", true, 0 ); - QSqlCursor cur = new QSqlCursor( "book" ); + TQSqlCursor cur = new TQSqlCursor( "book" ); dialog.BookDataBrowser.setSqlCursor( cur ); dialog.BookDataBrowser.setFilter( BookDataTable.filter() ); String[] sort = new String[BookDataTable.sort().size()]; sort = (String[]) BookDataTable.sort().toArray(sort); - dialog.BookDataBrowser.setSort(QSqlIndex.fromStringList( + dialog.BookDataBrowser.setSort(TQSqlIndex.fromStringList( sort, cur ) ); dialog.BookDataBrowser.refresh(); int i = BookDataTable.currentRow(); @@ -139,13 +139,13 @@ void connectClicked() { boolean ok = false; ConnectDialog dialog = new ConnectDialog( this, "Connect", true, 0 ); - String[] drivers = new String[QSqlDatabase.drivers().size()];; - drivers = (String[]) QSqlDatabase.drivers().toArray(drivers); + String[] drivers = new String[TQSqlDatabase.drivers().size()];; + drivers = (String[]) TQSqlDatabase.drivers().toArray(drivers); dialog.comboDriver.insertStringList( drivers ); dialog.editDatabase.setText( "book" ); - if ( dialog.exec() == QDialog.Accepted ) { - // QSqlDatabase.removeDatabase( QSqlDatabase.defaultConnection() ); - QSqlDatabase db = QSqlDatabase.addDatabase( dialog.comboDriver.currentText() ); + if ( dialog.exec() == TQDialog.Accepted ) { + // TQSqlDatabase.removeDatabase( TQSqlDatabase.defaultConnection() ); + TQSqlDatabase db = TQSqlDatabase.addDatabase( dialog.comboDriver.currentText() ); db.setDatabaseName( dialog.editDatabase.text() ); db.setUserName( dialog.editUsername.text() ); db.setPassword( dialog.editPassword.text() ); @@ -158,29 +158,29 @@ void connectClicked() } if ( !ok ) { editButton.setEnabled( false ); - BookDataTable.setSqlCursor( (QSqlCursor) null ); - AuthorDataTable.setSqlCursor( (QSqlCursor) null ); + BookDataTable.setSqlCursor( (TQSqlCursor) null ); + AuthorDataTable.setSqlCursor( (TQSqlCursor) null ); } else { editButton.setEnabled( true ); - authorCursor = new QSqlCursor( "author" ); + authorCursor = new TQSqlCursor( "author" ); AuthorDataTable.setSqlCursor( authorCursor, false, true ); - bookCursor = new QSqlCursor( "book" ); + bookCursor = new TQSqlCursor( "book" ); BookDataTable.setSqlCursor( bookCursor, false, true ); - AuthorDataTable.refresh( QDataTable.RefreshAll ); - BookDataTable.refresh( QDataTable.RefreshAll ); + AuthorDataTable.refresh( TQDataTable.RefreshAll ); + BookDataTable.refresh( TQDataTable.RefreshAll ); } dialog = null; } -void newCurrentAuthor(QSqlRecord author) +void newCurrentAuthor(TQSqlRecord author) { BookDataTable.setFilter( "authorid=" + author.value( "id" ).toString() ); BookDataTable.refresh(); } -void primeInsertAuthor(QSqlRecord buffer) +void primeInsertAuthor(TQSqlRecord buffer) { - QSqlQuery q = new QSqlQuery(); + TQSqlQuery q = new TQSqlQuery(); q.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" ); q.exec( "SELECT sequence FROM sequence WHERE tablename='author';" ); if ( q.next() ) { diff --git a/qtjava/javalib/examples/demo/sql/ConnectDialog.java b/qtjava/javalib/examples/demo/sql/ConnectDialog.java index bbd17391..ad7c331b 100644 --- a/qtjava/javalib/examples/demo/sql/ConnectDialog.java +++ b/qtjava/javalib/examples/demo/sql/ConnectDialog.java @@ -8,22 +8,22 @@ ****************************************************************************/ import org.kde.qt.*; -public class ConnectDialog extends QDialog { - QLineEdit editDatabase; - QLabel TextLabel3; - QLineEdit editPassword; - QLabel TextLabel4; - QLabel TextLabel4_2; - QLabel TextLabel2; - QLabel TextLabel5; - QComboBox comboDriver; - QLineEdit editHostname; - QLineEdit editUsername; - QPushButton PushButton1; - QPushButton PushButton2; - - QGridLayout ConnectDialogLayout; - QSpacerItem spacer; +public class ConnectDialog extends TQDialog { + TQLineEdit editDatabase; + TQLabel TextLabel3; + TQLineEdit editPassword; + TQLabel TextLabel4; + TQLabel TextLabel4_2; + TQLabel TextLabel2; + TQLabel TextLabel5; + TQComboBox comboDriver; + TQLineEdit editHostname; + TQLineEdit editUsername; + TQPushButton PushButton1; + TQPushButton PushButton2; + + TQGridLayout ConnectDialogLayout; + TQSpacerItem spacer; /* * Constructs a ConnectDialog which is a child of 'parent', with the @@ -32,75 +32,75 @@ public class ConnectDialog extends QDialog { * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -ConnectDialog( QWidget parent, String name, boolean modal, int fl ) +ConnectDialog( TQWidget parent, String name, boolean modal, int fl ) { super( parent, name, modal, fl ); if ( name == null ) setName( "ConnectDialog" ); resize( 294, 207 ); setCaption( trUtf8( "Connect..." ) ); - ConnectDialogLayout = new QGridLayout( this ); + ConnectDialogLayout = new TQGridLayout( this ); ConnectDialogLayout.setSpacing( 6 ); ConnectDialogLayout.setMargin( 11 ); - editDatabase = new QLineEdit( this, "editDatabase" ); + editDatabase = new TQLineEdit( this, "editDatabase" ); ConnectDialogLayout.addMultiCellWidget( editDatabase, 1, 1, 2, 3 ); - TextLabel3 = new QLabel( this, "TextLabel3" ); + TextLabel3 = new TQLabel( this, "TextLabel3" ); TextLabel3.setText( trUtf8( "Database Name:" ) ); ConnectDialogLayout.addMultiCellWidget( TextLabel3, 1, 1, 0, 1 ); - editPassword = new QLineEdit( this, "editPassword" ); - editPassword.setEchoMode( QLineEdit.Password ); + editPassword = new TQLineEdit( this, "editPassword" ); + editPassword.setEchoMode( TQLineEdit.Password ); ConnectDialogLayout.addMultiCellWidget( editPassword, 3, 3, 2, 3 ); - TextLabel4 = new QLabel( this, "TextLabel4" ); + TextLabel4 = new TQLabel( this, "TextLabel4" ); TextLabel4.setText( trUtf8( "&Username:" ) ); ConnectDialogLayout.addMultiCellWidget( TextLabel4, 2, 2, 0, 1 ); - TextLabel4_2 = new QLabel( this, "TextLabel4_2" ); + TextLabel4_2 = new TQLabel( this, "TextLabel4_2" ); TextLabel4_2.setText( trUtf8( "&Password:" ) ); ConnectDialogLayout.addMultiCellWidget( TextLabel4_2, 3, 3, 0, 1 ); - TextLabel2 = new QLabel( this, "TextLabel2" ); + TextLabel2 = new TQLabel( this, "TextLabel2" ); TextLabel2.setText( trUtf8( "D&river" ) ); ConnectDialogLayout.addMultiCellWidget( TextLabel2, 0, 0, 0, 1 ); - TextLabel5 = new QLabel( this, "TextLabel5" ); + TextLabel5 = new TQLabel( this, "TextLabel5" ); TextLabel5.setText( trUtf8( "&Hostname:" ) ); ConnectDialogLayout.addMultiCellWidget( TextLabel5, 4, 4, 0, 1 ); - comboDriver = new QComboBox( false, this, "comboDriver" ); + comboDriver = new TQComboBox( false, this, "comboDriver" ); comboDriver.setEditable( true ); ConnectDialogLayout.addMultiCellWidget( comboDriver, 0, 0, 2, 3 ); - editHostname = new QLineEdit( this, "editHostname" ); + editHostname = new TQLineEdit( this, "editHostname" ); ConnectDialogLayout.addMultiCellWidget( editHostname, 4, 4, 2, 3 ); - editUsername = new QLineEdit( this, "editUsername" ); + editUsername = new TQLineEdit( this, "editUsername" ); ConnectDialogLayout.addMultiCellWidget( editUsername, 2, 2, 2, 3 ); - PushButton1 = new QPushButton( this, "PushButton1" ); + PushButton1 = new TQPushButton( this, "PushButton1" ); PushButton1.setText( trUtf8( "&OK" ) ); PushButton1.setDefault( true ); ConnectDialogLayout.addMultiCellWidget( PushButton1, 5, 5, 1, 2 ); - PushButton2 = new QPushButton( this, "PushButton2" ); + PushButton2 = new TQPushButton( this, "PushButton2" ); PushButton2.setText( trUtf8( "&Cancel" ) ); ConnectDialogLayout.addWidget( PushButton2, 5, 3 ); - spacer = new QSpacerItem( 20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum ); + spacer = new TQSpacerItem( 20, 20, TQSizePolicy.Expanding, TQSizePolicy.Minimum ); ConnectDialogLayout.addItem( spacer, 5, 0 ); diff --git a/qtjava/javalib/examples/demo/sql/EditBookForm.java b/qtjava/javalib/examples/demo/sql/EditBookForm.java index 6c07176f..4def1743 100644 --- a/qtjava/javalib/examples/demo/sql/EditBookForm.java +++ b/qtjava/javalib/examples/demo/sql/EditBookForm.java @@ -9,33 +9,33 @@ import org.kde.qt.*; import java.util.HashMap; -public class EditBookForm extends QDialog { - QDataBrowser BookDataBrowser; - QLabel labelPrice; - QLabel labelTitle; - QLineEdit QLineEditTitle; - QLineEdit QLineEditPrice; - QPushButton PushButtonInsert; - QPushButton PushButtonUpdate; - QPushButton PushButtonDelete; - QPushButton PushButtonClose; - QPushButton PushButtonFirst; - QPushButton PushButtonPrev; - QPushButton PushButtonNext; - QPushButton PushButtonLast; - QLabel TextLabel1; - QComboBox ComboBoxAuthor; - - QVBoxLayout EditBookFormLayout; - QGridLayout BookDataBrowserLayout; - QGridLayout Layout2; - QHBoxLayout Layout6; - QHBoxLayout Layout3; - QHBoxLayout Layout6_2; +public class EditBookForm extends TQDialog { + TQDataBrowser BookDataBrowser; + TQLabel labelPrice; + TQLabel labelTitle; + TQLineEdit TQLineEditTitle; + TQLineEdit TQLineEditPrice; + TQPushButton PushButtonInsert; + TQPushButton PushButtonUpdate; + TQPushButton PushButtonDelete; + TQPushButton PushButtonClose; + TQPushButton PushButtonFirst; + TQPushButton PushButtonPrev; + TQPushButton PushButtonNext; + TQPushButton PushButtonLast; + TQLabel TextLabel1; + TQComboBox ComboBoxAuthor; + + TQVBoxLayout EditBookFormLayout; + TQGridLayout BookDataBrowserLayout; + TQGridLayout Layout2; + TQHBoxLayout Layout6; + TQHBoxLayout Layout3; + TQHBoxLayout Layout6_2; HashMap authorMap; - QSizePolicy policy_1; - QSqlForm BookDataBrowserForm; + TQSizePolicy policy_1; + TQSqlForm BookDataBrowserForm; /* * Constructs a EditBookForm which is a child of 'parent', with the @@ -44,102 +44,102 @@ public class EditBookForm extends QDialog { * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -EditBookForm( QWidget parent, String name, boolean modal, int fl ) +EditBookForm( TQWidget parent, String name, boolean modal, int fl ) { super( parent, name, modal, fl ); if ( name == null ) setName( "EditBookForm" ); resize( 524, 371 ); setCaption( trUtf8( "Edit Books" ) ); - EditBookFormLayout = new QVBoxLayout( this ); + EditBookFormLayout = new TQVBoxLayout( this ); EditBookFormLayout.setSpacing( 6 ); EditBookFormLayout.setMargin( 11 ); - BookDataBrowser = new QDataBrowser( this, "BookDataBrowser" ); - BookDataBrowserLayout = new QGridLayout( BookDataBrowser ); + BookDataBrowser = new TQDataBrowser( this, "BookDataBrowser" ); + BookDataBrowserLayout = new TQGridLayout( BookDataBrowser ); BookDataBrowser.setSort( new String[] { "title ASC" } ); BookDataBrowserLayout.setSpacing( 6 ); BookDataBrowserLayout.setMargin( 11 ); - Layout2 = new QGridLayout(); + Layout2 = new TQGridLayout(); Layout2.setSpacing( 6 ); Layout2.setMargin( 0 ); - labelPrice = new QLabel( BookDataBrowser, "labelPrice" ); + labelPrice = new TQLabel( BookDataBrowser, "labelPrice" ); labelPrice.setText( trUtf8( "Price" ) ); Layout2.addWidget( labelPrice, 1, 0 ); - labelTitle = new QLabel( BookDataBrowser, "labelTitle" ); + labelTitle = new TQLabel( BookDataBrowser, "labelTitle" ); labelTitle.setText( trUtf8( "Title" ) ); Layout2.addWidget( labelTitle, 0, 0 ); - QLineEditTitle = new QLineEdit( BookDataBrowser, "QLineEditTitle" ); + TQLineEditTitle = new TQLineEdit( BookDataBrowser, "TQLineEditTitle" ); - Layout2.addWidget( QLineEditTitle, 0, 1 ); + Layout2.addWidget( TQLineEditTitle, 0, 1 ); - QLineEditPrice = new QLineEdit( BookDataBrowser, "QLineEditPrice" ); + TQLineEditPrice = new TQLineEdit( BookDataBrowser, "TQLineEditPrice" ); - Layout2.addWidget( QLineEditPrice, 1, 1 ); + Layout2.addWidget( TQLineEditPrice, 1, 1 ); BookDataBrowserLayout.addLayout( Layout2, 0, 0 ); - Layout6 = new QHBoxLayout(); + Layout6 = new TQHBoxLayout(); Layout6.setSpacing( 6 ); Layout6.setMargin( 0 ); - PushButtonInsert = new QPushButton( BookDataBrowser, "PushButtonInsert" ); + PushButtonInsert = new TQPushButton( BookDataBrowser, "PushButtonInsert" ); PushButtonInsert.setText( trUtf8( "&Insert" ) ); Layout6.addWidget( PushButtonInsert ); - PushButtonUpdate = new QPushButton( BookDataBrowser, "PushButtonUpdate" ); + PushButtonUpdate = new TQPushButton( BookDataBrowser, "PushButtonUpdate" ); PushButtonUpdate.setText( trUtf8( "&Update" ) ); PushButtonUpdate.setDefault( true ); Layout6.addWidget( PushButtonUpdate ); - PushButtonDelete = new QPushButton( BookDataBrowser, "PushButtonDelete" ); + PushButtonDelete = new TQPushButton( BookDataBrowser, "PushButtonDelete" ); PushButtonDelete.setText( trUtf8( "&Delete" ) ); Layout6.addWidget( PushButtonDelete ); - PushButtonClose = new QPushButton( BookDataBrowser, "PushButtonClose" ); + PushButtonClose = new TQPushButton( BookDataBrowser, "PushButtonClose" ); PushButtonClose.setText( trUtf8( "&Close" ) ); Layout6.addWidget( PushButtonClose ); BookDataBrowserLayout.addLayout( Layout6, 3, 0 ); - Layout3 = new QHBoxLayout(); + Layout3 = new TQHBoxLayout(); Layout3.setSpacing( 6 ); Layout3.setMargin( 0 ); - PushButtonFirst = new QPushButton( BookDataBrowser, "PushButtonFirst" ); + PushButtonFirst = new TQPushButton( BookDataBrowser, "PushButtonFirst" ); PushButtonFirst.setText( trUtf8( "|< &First" ) ); Layout3.addWidget( PushButtonFirst ); - PushButtonPrev = new QPushButton( BookDataBrowser, "PushButtonPrev" ); + PushButtonPrev = new TQPushButton( BookDataBrowser, "PushButtonPrev" ); PushButtonPrev.setText( trUtf8( "<< &Prev" ) ); Layout3.addWidget( PushButtonPrev ); - PushButtonNext = new QPushButton( BookDataBrowser, "PushButtonNext" ); + PushButtonNext = new TQPushButton( BookDataBrowser, "PushButtonNext" ); PushButtonNext.setText( trUtf8( "&Next >>" ) ); Layout3.addWidget( PushButtonNext ); - PushButtonLast = new QPushButton( BookDataBrowser, "PushButtonLast" ); + PushButtonLast = new TQPushButton( BookDataBrowser, "PushButtonLast" ); PushButtonLast.setText( trUtf8( "&Last >|" ) ); Layout3.addWidget( PushButtonLast ); BookDataBrowserLayout.addLayout( Layout3, 2, 0 ); - Layout6_2 = new QHBoxLayout(); + Layout6_2 = new TQHBoxLayout(); Layout6_2.setSpacing( 6 ); Layout6_2.setMargin( 0 ); - TextLabel1 = new QLabel( BookDataBrowser, "TextLabel1" ); + TextLabel1 = new TQLabel( BookDataBrowser, "TextLabel1" ); TextLabel1.setText( trUtf8( "Author" ) ); Layout6_2.addWidget( TextLabel1 ); - ComboBoxAuthor = new QComboBox( false, BookDataBrowser, "ComboBoxAuthor" ); - policy_1 = new QSizePolicy( (int)7, (int)0, ComboBoxAuthor.sizePolicy().hasHeightForWidth() ); + ComboBoxAuthor = new TQComboBox( false, BookDataBrowser, "ComboBoxAuthor" ); + policy_1 = new TQSizePolicy( (int)7, (int)0, ComboBoxAuthor.sizePolicy().hasHeightForWidth() ); ComboBoxAuthor.setSizePolicy( policy_1 ); Layout6_2.addWidget( ComboBoxAuthor ); @@ -147,9 +147,9 @@ EditBookForm( QWidget parent, String name, boolean modal, int fl ) EditBookFormLayout.addWidget( BookDataBrowser ); // database support - BookDataBrowserForm = new QSqlForm( this, "BookDataBrowserForm" ); - BookDataBrowserForm.insert( QLineEditTitle, "title" ); - BookDataBrowserForm.insert( QLineEditPrice, "price" ); + BookDataBrowserForm = new TQSqlForm( this, "BookDataBrowserForm" ); + BookDataBrowserForm.insert( TQLineEditTitle, "title" ); + BookDataBrowserForm.insert( TQLineEditPrice, "price" ); BookDataBrowser.setForm( BookDataBrowserForm ); @@ -169,15 +169,15 @@ EditBookForm( QWidget parent, String name, boolean modal, int fl ) connect( PushButtonUpdate, SIGNAL( "clicked()" ), BookDataBrowser, SLOT( "update()" ) ); connect( PushButtonDelete, SIGNAL( "clicked()" ), BookDataBrowser, SLOT( "del()" ) ); connect( PushButtonClose, SIGNAL( "clicked()" ), this, SLOT( "accept()" ) ); - connect( BookDataBrowser, SIGNAL( "primeUpdate(QSqlRecord)" ), this, SLOT( "primeUpdateBook(QSqlRecord)" ) ); - connect( BookDataBrowser, SIGNAL( "beforeUpdate(QSqlRecord)" ), this, SLOT( "beforeUpdateBook(QSqlRecord)" ) ); - connect( BookDataBrowser, SIGNAL( "beforeInsert(QSqlRecord)" ), this, SLOT( "beforeUpdateBook(QSqlRecord)" ) ); - connect( BookDataBrowser, SIGNAL( "primeInsert(QSqlRecord)" ), this, SLOT( "primeInsertBook(QSqlRecord)" ) ); - connect( BookDataBrowser, SIGNAL( "primeInsert(QSqlRecord)" ), this, SLOT( "primeInsertBook(QSqlRecord)" ) ); + connect( BookDataBrowser, SIGNAL( "primeUpdate(TQSqlRecord)" ), this, SLOT( "primeUpdateBook(TQSqlRecord)" ) ); + connect( BookDataBrowser, SIGNAL( "beforeUpdate(TQSqlRecord)" ), this, SLOT( "beforeUpdateBook(TQSqlRecord)" ) ); + connect( BookDataBrowser, SIGNAL( "beforeInsert(TQSqlRecord)" ), this, SLOT( "beforeUpdateBook(TQSqlRecord)" ) ); + connect( BookDataBrowser, SIGNAL( "primeInsert(TQSqlRecord)" ), this, SLOT( "primeInsertBook(TQSqlRecord)" ) ); + connect( BookDataBrowser, SIGNAL( "primeInsert(TQSqlRecord)" ), this, SLOT( "primeInsertBook(TQSqlRecord)" ) ); // tab order - setTabOrder( QLineEditTitle, QLineEditPrice ); - setTabOrder( QLineEditPrice, ComboBoxAuthor ); + setTabOrder( TQLineEditTitle, TQLineEditPrice ); + setTabOrder( TQLineEditPrice, ComboBoxAuthor ); setTabOrder( ComboBoxAuthor, PushButtonFirst ); setTabOrder( PushButtonFirst, PushButtonPrev ); setTabOrder( PushButtonPrev, PushButtonNext ); @@ -197,7 +197,7 @@ public void polish() { if ( BookDataBrowser != null ) { if ( BookDataBrowser.sqlCursor() == null ) { - QSqlCursor cursor = new QSqlCursor( "book" ); + TQSqlCursor cursor = new TQSqlCursor( "book" ); BookDataBrowser.setSqlCursor( cursor, true ); BookDataBrowser.refresh(); BookDataBrowser.first(); @@ -206,11 +206,11 @@ public void polish() super.polish(); } -void beforeUpdateBook(QSqlRecord buffer) +void beforeUpdateBook(TQSqlRecord buffer) { int[] id = { 0 }; mapAuthor( ComboBoxAuthor.currentText(), id, false ); - buffer.setValue( "authorid", new QVariant(id[0]) ); + buffer.setValue( "authorid", new TQVariant(id[0]) ); } void mapAuthor(String name, int[] id, boolean populate) @@ -221,9 +221,9 @@ void mapAuthor(String name, int[] id, boolean populate) // id[0] = authorMap[ name ]; } -void primeInsertBook(QSqlRecord buffer) +void primeInsertBook(TQSqlRecord buffer) { - QSqlQuery q = new QSqlQuery(); + TQSqlQuery q = new TQSqlQuery(); q.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='book';" ); q.exec( "SELECT sequence FROM sequence WHERE tablename='book';" ); if ( q.next() ) { @@ -231,10 +231,10 @@ void primeInsertBook(QSqlRecord buffer) } } -void primeUpdateBook(QSqlRecord buffer) +void primeUpdateBook(TQSqlRecord buffer) { // Who is this book's author? - QSqlQuery query = new QSqlQuery( "SELECT surname FROM author WHERE id=" + + TQSqlQuery query = new TQSqlQuery( "SELECT surname FROM author WHERE id=" + buffer.value( "authorid" ).toString() + ";" ); String author = ""; if ( query.next() ) @@ -251,7 +251,7 @@ void primeUpdateBook(QSqlRecord buffer) void init() { authorMap = new HashMap(); - QSqlQuery query = new QSqlQuery( "SELECT surname, id FROM author ORDER BY surname;" ); + TQSqlQuery query = new TQSqlQuery( "SELECT surname, id FROM author ORDER BY surname;" ); while ( query.next() ) { ComboBoxAuthor.insertItem( query.value( 0 ).toString() ); int[] id = new int[1]; diff --git a/qtjava/javalib/examples/demo/sql/Main.java b/qtjava/javalib/examples/demo/sql/Main.java index 1bf81c88..b1697dd8 100644 --- a/qtjava/javalib/examples/demo/sql/Main.java +++ b/qtjava/javalib/examples/demo/sql/Main.java @@ -4,7 +4,7 @@ public class Main { public static void main(String[] args) { - QApplication a = new QApplication(args); + TQApplication a = new TQApplication(args); BookForm form = new BookForm(); a.setMainWidget( form ); |