diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtjava/javalib/examples/addressbook | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtjava/javalib/examples/addressbook')
-rw-r--r-- | qtjava/javalib/examples/addressbook/ABCentralWidget.java | 98 | ||||
-rw-r--r-- | qtjava/javalib/examples/addressbook/ABMainWindow.java | 24 | ||||
-rw-r--r-- | qtjava/javalib/examples/addressbook/Main.java | 2 |
3 files changed, 62 insertions, 62 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() ) { diff --git a/qtjava/javalib/examples/addressbook/ABMainWindow.java b/qtjava/javalib/examples/addressbook/ABMainWindow.java index 588098f4..c4949289 100644 --- a/qtjava/javalib/examples/addressbook/ABMainWindow.java +++ b/qtjava/javalib/examples/addressbook/ABMainWindow.java @@ -9,9 +9,9 @@ *****************************************************************************/ import org.kde.qt.*; -class ABMainWindow extends QMainWindow +class ABMainWindow extends TQMainWindow { - protected QToolBar fileTools; + protected TQToolBar fileTools; protected String filename; protected ABCentralWidget view; @@ -27,24 +27,24 @@ public ABMainWindow() public void setupMenuBar() { - QPopupMenu file = new QPopupMenu( this ); + TQPopupMenu file = new TQPopupMenu( this ); menuBar().insertItem( "&File", file ); - file.insertItem( "New", this, SLOT( "fileNew()" ), new QKeySequence(CTRL + Key_N) ); - file.insertItem( new QIconSet(new QPixmap( "fileopen.xpm" )), "Open", this, SLOT( "fileOpen()" ), new QKeySequence(CTRL + Key_O) ); + file.insertItem( "New", this, SLOT( "fileNew()" ), new TQKeySequence(CTRL + Key_N) ); + file.insertItem( new TQIconSet(new TQPixmap( "fileopen.xpm" )), "Open", this, SLOT( "fileOpen()" ), new TQKeySequence(CTRL + Key_O) ); file.insertSeparator(); - file.insertItem( new QIconSet(new QPixmap( "filesave.xpm" )), "Save", this, SLOT( "fileSave()" ), new QKeySequence(CTRL + Key_S) ); + file.insertItem( new TQIconSet(new TQPixmap( "filesave.xpm" )), "Save", this, SLOT( "fileSave()" ), new TQKeySequence(CTRL + Key_S) ); file.insertItem( "Save As...", this, SLOT( "fileSaveAs()" ) ); file.insertSeparator(); - file.insertItem( new QIconSet(new QPixmap( "fileprint.xpm" )), "Print...", this, SLOT( "filePrint()" ), new QKeySequence(CTRL + Key_P) ); + file.insertItem( new TQIconSet(new TQPixmap( "fileprint.xpm" )), "Print...", this, SLOT( "filePrint()" ), new TQKeySequence(CTRL + Key_P) ); file.insertSeparator(); - file.insertItem( "Close", this, SLOT( "closeWindow()" ), new QKeySequence(CTRL + Key_W) ); - file.insertItem( "Quit", qApp(), SLOT( "quit()" ), new QKeySequence(CTRL + Key_Q) ); + file.insertItem( "Close", this, SLOT( "closeWindow()" ), new TQKeySequence(CTRL + Key_W) ); + file.insertItem( "Quit", qApp(), SLOT( "quit()" ), new TQKeySequence(CTRL + Key_Q) ); } public void setupFileTools() { - //fileTools = new QToolBar( this, "file operations" ); + //fileTools = new TQToolBar( this, "file operations" ); } public void setupStatusBar() @@ -69,7 +69,7 @@ public void fileNew() public void fileOpen() { - String fn = QFileDialog.getOpenFileName( "", "", this ); + String fn = TQFileDialog.getOpenFileName( "", "", this ); if ( !fn.equals("") ) { filename = fn; view.load( filename ); @@ -88,7 +88,7 @@ public void fileSave() public void fileSaveAs() { - String fn = QFileDialog.getSaveFileName( "", "", this ); + String fn = TQFileDialog.getSaveFileName( "", "", this ); if ( !fn.equals("") ) { filename = fn; fileSave(); diff --git a/qtjava/javalib/examples/addressbook/Main.java b/qtjava/javalib/examples/addressbook/Main.java index eeda8adc..c69c5d24 100644 --- a/qtjava/javalib/examples/addressbook/Main.java +++ b/qtjava/javalib/examples/addressbook/Main.java @@ -13,7 +13,7 @@ public class Main { public static void main( String[] args ) { - QApplication a = new QApplication( args ); + TQApplication a = new TQApplication( args ); ABMainWindow mw = new ABMainWindow(); mw.setCaption( "Qt Example - Addressbook" ); |