diff options
Diffstat (limited to 'qtjava/javalib/examples/addressbook/ABCentralWidget.java')
-rw-r--r-- | qtjava/javalib/examples/addressbook/ABCentralWidget.java | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/qtjava/javalib/examples/addressbook/ABCentralWidget.java b/qtjava/javalib/examples/addressbook/ABCentralWidget.java index 8dd6af37..2819ea8c 100644 --- a/qtjava/javalib/examples/addressbook/ABCentralWidget.java +++ b/qtjava/javalib/examples/addressbook/ABCentralWidget.java @@ -10,21 +10,21 @@ import org.kde.qt.*; import java.util.*; -public class ABCentralWidget extends QWidget +public class ABCentralWidget extends TQWidget { - protected QGridLayout mainGrid; - protected QTabWidget tabWidget; - protected QListView listView; - protected QPushButton add, change, find; - protected QLineEdit iFirstName, iLastName, iAddress, iEMail, + protected TQGridLayout mainGrid; + protected TQTabWidget tabWidget; + protected TQListView listView; + protected TQPushButton add, change, find; + protected TQLineEdit iFirstName, iLastName, iAddress, iEMail, sFirstName, sLastName, sAddress, sEMail; - protected QCheckBox cFirstName, cLastName, cAddress, cEMail; + protected TQCheckBox cFirstName, cLastName, cAddress, cEMail; -public ABCentralWidget( QWidget parent, String name ) +public ABCentralWidget( TQWidget parent, String name ) { super( parent, name ); - mainGrid = new QGridLayout( this, 2, 1, 5, 5 ); + mainGrid = new TQGridLayout( this, 2, 1, 5, 5 ); setupTabWidget(); setupListView(); @@ -33,7 +33,7 @@ public ABCentralWidget( QWidget parent, String name ) mainGrid.setRowStretch( 1, 1 ); } -public ABCentralWidget( QWidget parent ) +public ABCentralWidget( TQWidget parent ) { this(parent, null); } @@ -43,15 +43,15 @@ public void save( String filename ) if ( listView.firstChild() == null ) return; - QFile f = new QFile( filename ); - if ( !f.open( QIODevice.IO_WriteOnly ) ) + TQFile f = new TQFile( filename ); + if ( !f.open( TQIODevice.IO_WriteOnly ) ) return; - QTextStream t = new QTextStream( f ); + TQTextStream t = new TQTextStream( f ); Iterator it = listView.itemList().iterator(); while ( it.hasNext() ) { - QListViewItem currentItem = (QListViewItem) it.next(); + TQListViewItem currentItem = (TQListViewItem) it.next(); for ( int i = 0; i < 4; i++ ) { t.writeRawBytes( currentItem.text(i), currentItem.text(i).length() ); t.writeRawBytes( "\n", 1 ); @@ -65,14 +65,14 @@ public void load( String filename ) { listView.clear(); - QFile f = new QFile( filename ); - if ( !f.open( QIODevice.IO_ReadOnly ) ) + TQFile f = new TQFile( filename ); + if ( !f.open( TQIODevice.IO_ReadOnly ) ) return; - QTextStream t = new QTextStream( f ); + TQTextStream t = new TQTextStream( f ); while ( !t.atEnd() ) { - QListViewItem item = new QListViewItem( listView ); + TQListViewItem item = new TQListViewItem( listView ); for ( int i = 0; i < 4; i++ ) item.setText( i, t.readLine() ); } @@ -82,53 +82,53 @@ public void load( String filename ) public void setupTabWidget() { - tabWidget = new QTabWidget( this ); + tabWidget = new TQTabWidget( this ); - QWidget input = new QWidget( tabWidget ); - QGridLayout grid1 = new QGridLayout( input, 2, 5, 5, 5 ); + TQWidget input = new TQWidget( tabWidget ); + TQGridLayout grid1 = new TQGridLayout( input, 2, 5, 5, 5 ); - QLabel liFirstName = new QLabel( "First &Name", input ); + TQLabel liFirstName = new TQLabel( "First &Name", input ); liFirstName.resize( liFirstName.sizeHint() ); grid1.addWidget( liFirstName, 0, 0 ); - QLabel liLastName = new QLabel( "&Last Name", input ); + TQLabel liLastName = new TQLabel( "&Last Name", input ); liLastName.resize( liLastName.sizeHint() ); grid1.addWidget( liLastName, 0, 1 ); - QLabel liAddress = new QLabel( "Add&ress", input ); + TQLabel liAddress = new TQLabel( "Add&ress", input ); liAddress.resize( liAddress.sizeHint() ); grid1.addWidget( liAddress, 0, 2 ); - QLabel liEMail = new QLabel( "&E-Mail", input ); + TQLabel liEMail = new TQLabel( "&E-Mail", input ); liEMail.resize( liEMail.sizeHint() ); grid1.addWidget( liEMail, 0, 3 ); - add = new QPushButton( "A&dd", input ); + add = new TQPushButton( "A&dd", input ); add.resize( add.sizeHint() ); grid1.addWidget( add, 0, 4 ); connect( add, SIGNAL( "clicked()" ), this, SLOT( "addEntry()" ) ); - iFirstName = new QLineEdit( input ); + iFirstName = new TQLineEdit( input ); iFirstName.resize( iFirstName.sizeHint() ); grid1.addWidget( iFirstName, 1, 0 ); liFirstName.setBuddy( iFirstName ); - iLastName = new QLineEdit( input ); + iLastName = new TQLineEdit( input ); iLastName.resize( iLastName.sizeHint() ); grid1.addWidget( iLastName, 1, 1 ); liLastName.setBuddy( iLastName ); - iAddress = new QLineEdit( input ); + iAddress = new TQLineEdit( input ); iAddress.resize( iAddress.sizeHint() ); grid1.addWidget( iAddress, 1, 2 ); liAddress.setBuddy( iAddress ); - iEMail = new QLineEdit( input ); + iEMail = new TQLineEdit( input ); iEMail.resize( iEMail.sizeHint() ); grid1.addWidget( iEMail, 1, 3 ); liEMail.setBuddy( iEMail ); - change = new QPushButton( "&Change", input ); + change = new TQPushButton( "&Change", input ); change.resize( change.sizeHint() ); grid1.addWidget( change, 1, 4 ); connect( change, SIGNAL( "clicked()" ), this, SLOT( "changeEntry()" ) ); @@ -137,46 +137,46 @@ public void setupTabWidget() // -------------------------------------- - QWidget search = new QWidget( this ); - QGridLayout grid2 = new QGridLayout( search, 2, 5, 5, 5 ); + TQWidget search = new TQWidget( this ); + TQGridLayout grid2 = new TQGridLayout( search, 2, 5, 5, 5 ); - cFirstName = new QCheckBox( "First &Name", search ); + cFirstName = new TQCheckBox( "First &Name", search ); cFirstName.resize( cFirstName.sizeHint() ); grid2.addWidget( cFirstName, 0, 0 ); connect( cFirstName, SIGNAL( "clicked()" ), this, SLOT( "toggleFirstName()" ) ); - cLastName = new QCheckBox( "&Last Name", search ); + cLastName = new TQCheckBox( "&Last Name", search ); cLastName.resize( cLastName.sizeHint() ); grid2.addWidget( cLastName, 0, 1 ); connect( cLastName, SIGNAL( "clicked()" ), this, SLOT( "toggleLastName()" ) ); - cAddress = new QCheckBox( "Add&ress", search ); + cAddress = new TQCheckBox( "Add&ress", search ); cAddress.resize( cAddress.sizeHint() ); grid2.addWidget( cAddress, 0, 2 ); connect( cAddress, SIGNAL( "clicked()" ), this, SLOT( "toggleAddress()" ) ); - cEMail = new QCheckBox( "&E-Mail", search ); + cEMail = new TQCheckBox( "&E-Mail", search ); cEMail.resize( cEMail.sizeHint() ); grid2.addWidget( cEMail, 0, 3 ); connect( cEMail, SIGNAL( "clicked()" ), this, SLOT( "toggleEMail()" ) ); - sFirstName = new QLineEdit( search ); + sFirstName = new TQLineEdit( search ); sFirstName.resize( sFirstName.sizeHint() ); grid2.addWidget( sFirstName, 1, 0 ); - sLastName = new QLineEdit( search ); + sLastName = new TQLineEdit( search ); sLastName.resize( sLastName.sizeHint() ); grid2.addWidget( sLastName, 1, 1 ); - sAddress = new QLineEdit( search ); + sAddress = new TQLineEdit( search ); sAddress.resize( sAddress.sizeHint() ); grid2.addWidget( sAddress, 1, 2 ); - sEMail = new QLineEdit( search ); + sEMail = new TQLineEdit( search ); sEMail.resize( sEMail.sizeHint() ); grid2.addWidget( sEMail, 1, 3 ); - find = new QPushButton( "F&ind", search ); + find = new TQPushButton( "F&ind", search ); find.resize( find.sizeHint() ); grid2.addWidget( find, 1, 4 ); connect( find, SIGNAL( "clicked()" ), this, SLOT( "findEntries()" ) ); @@ -194,15 +194,15 @@ public void setupTabWidget() public void setupListView() { - listView = new QListView( this ); + listView = new TQListView( this ); listView.addColumn( "First Name" ); listView.addColumn( "Last Name" ); listView.addColumn( "Address" ); listView.addColumn( "E-Mail" ); - listView.setSelectionMode( QListView.Extended ); + listView.setSelectionMode( TQListView.Extended ); - connect( listView, SIGNAL( "clicked( QListViewItem )" ), this, SLOT( "itemSelected( QListViewItem )" ) ); + connect( listView, SIGNAL( "clicked( TQListViewItem )" ), this, SLOT( "itemSelected( TQListViewItem )" ) ); mainGrid.addWidget( listView, 1, 0 ); listView.setAllColumnsShowFocus( true ); @@ -212,7 +212,7 @@ public void addEntry() { if ( !iFirstName.text().equals("") || !iLastName.text().equals("") || !iAddress.text().equals("") || !iEMail.text().equals("") ) { - QListViewItem item = new QListViewItem( listView ); + TQListViewItem item = new TQListViewItem( listView ); item.setText( 0, iFirstName.text() ); item.setText( 1, iLastName.text() ); item.setText( 2, iAddress.text() ); @@ -227,7 +227,7 @@ public void addEntry() public void changeEntry() { - QListViewItem item = listView.currentItem(); + TQListViewItem item = listView.currentItem(); if ( item != null && ( !iFirstName.text().equals("") || !iLastName.text().equals("") || @@ -247,7 +247,7 @@ public void selectionChanged() iEMail.setText( "" ); } -public void itemSelected( QListViewItem item ) +public void itemSelected( TQListViewItem item ) { item.setSelected( true ); item.repaint(); @@ -318,7 +318,7 @@ public void findEntries() Iterator it = listView.itemList().iterator(); while ( it.hasNext() ) { - QListViewItem currentItem = (QListViewItem) it.next(); + TQListViewItem currentItem = (TQListViewItem) it.next(); boolean select = true; if ( cFirstName.isChecked() ) { |