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/checklists/CheckLists.java | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtjava/javalib/examples/checklists/CheckLists.java')
-rw-r--r-- | qtjava/javalib/examples/checklists/CheckLists.java | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/qtjava/javalib/examples/checklists/CheckLists.java b/qtjava/javalib/examples/checklists/CheckLists.java index ef3dd8bf..5dc42300 100644 --- a/qtjava/javalib/examples/checklists/CheckLists.java +++ b/qtjava/javalib/examples/checklists/CheckLists.java @@ -10,11 +10,11 @@ import org.kde.qt.*; import java.util.*; -class CheckLists extends QWidget +class CheckLists extends TQWidget { -protected QListView lv1, lv2; -protected QLabel label; +protected TQListView lv1, lv2; +protected TQLabel label; /* Constructor @@ -27,21 +27,21 @@ CheckLists( ) this(null, null); } -CheckLists( QWidget parent, String name ) +CheckLists( TQWidget parent, String name ) { super( parent, name ); - QHBoxLayout lay = new QHBoxLayout( this ); + TQHBoxLayout lay = new TQHBoxLayout( this ); lay.setMargin( 5 ); // create a widget which layouts its childs in a column - QVBoxLayout vbox1 = new QVBoxLayout( lay ); + TQVBoxLayout vbox1 = new TQVBoxLayout( lay ); vbox1.setMargin( 5 ); // First child: a Label - vbox1.addWidget( new QLabel( "Check some items!", this ) ); + vbox1.addWidget( new TQLabel( "Check some items!", this ) ); // Second child: the ListView - lv1 = new QListView( this ); + lv1 = new TQListView( this ); vbox1.addWidget( lv1 ); lv1.addColumn( "Items" ); lv1.setRootIsDecorated( true ); @@ -49,62 +49,62 @@ CheckLists( QWidget parent, String name ) // create a list with 4 ListViewItems which will be parent items of other ListViewItems ArrayList parentList = new ArrayList(); - parentList.add( new QListViewItem( lv1, "Parent Item 1" ) ); - parentList.add( new QListViewItem( lv1, "Parent Item 2" ) ); - parentList.add( new QListViewItem( lv1, "Parent Item 3" ) ); - parentList.add( new QListViewItem( lv1, "Parent Item 4" ) ); + parentList.add( new TQListViewItem( lv1, "Parent Item 1" ) ); + parentList.add( new TQListViewItem( lv1, "Parent Item 2" ) ); + parentList.add( new TQListViewItem( lv1, "Parent Item 3" ) ); + parentList.add( new TQListViewItem( lv1, "Parent Item 4" ) ); - QListViewItem item = null; + TQListViewItem item = null; int num = 1; // go through the list of parent items... for ( Iterator it = parentList.iterator(); it.hasNext(); num++ ) { - item = (QListViewItem) it.next(); + item = (TQListViewItem) it.next(); item.setOpen( true ); // ...and create 5 checkable child ListViewItems for each parent item for ( int i = 1; i <= 5; i++ ) - new QCheckListItem( item, i + ". Child of Parent " + num, QCheckListItem.CheckBox ); + new TQCheckListItem( item, i + ". Child of Parent " + num, TQCheckListItem.CheckBox ); } // Create another widget for layouting - QVBoxLayout tmp = new QVBoxLayout( lay ); + TQVBoxLayout tmp = new TQVBoxLayout( lay ); tmp.setMargin( 5 ); // create a pushbutton - QPushButton copy1 = new QPushButton( " -> ", this ); + TQPushButton copy1 = new TQPushButton( " -> ", this ); tmp.addWidget( copy1 ); copy1.setMaximumWidth( copy1.sizeHint().width() ); // connect the SIGNAL clicked() of the pushbutton with the SLOT copy1to2() connect( copy1, SIGNAL(" clicked()"), this, SLOT(" copy1to2()") ); // another widget for layouting - QVBoxLayout vbox2 = new QVBoxLayout( lay ); + TQVBoxLayout vbox2 = new TQVBoxLayout( lay ); vbox2.setMargin( 5 ); // and another label - vbox2.addWidget( new QLabel( "Check one item!", this ) ); + vbox2.addWidget( new TQLabel( "Check one item!", this ) ); // create the second listview - lv2 = new QListView( this ); + lv2 = new TQListView( this ); vbox2.addWidget( lv2 ); lv2.addColumn( "Items" ); lv2.setRootIsDecorated( true ); // another widget needed for layouting only - tmp = new QVBoxLayout( lay ); + tmp = new TQVBoxLayout( lay ); tmp.setMargin( 5 ); // create another pushbutton... - QPushButton copy2 = new QPushButton( " -> ", this ); + TQPushButton copy2 = new TQPushButton( " -> ", this ); lay.addWidget( copy2 ); copy2.setMaximumWidth( copy2.sizeHint().width() ); // ...and connect its clicked() SIGNAL to the copy2to3() SLOT connect( copy2, SIGNAL(" clicked()"), this, SLOT(" copy2to3()") ); - tmp = new QVBoxLayout( lay ); + tmp = new TQVBoxLayout( lay ); tmp.setMargin( 5 ); // and create a label which will be at the right of the window - label = new QLabel( "No Item yet...", this ); + label = new TQLabel( "No Item yet...", this ); tmp.addWidget( label ); } @@ -124,22 +124,22 @@ public void copy1to2() // Insert first a controller Item into the second ListView. Always if Radio-ListViewItems // are inserted into a Listview, the parent item of these MUST be a controller Item! - QCheckListItem item = new QCheckListItem( lv2, "Controller", QCheckListItem.Controller ); + TQCheckListItem item = new TQCheckListItem( lv2, "Controller", TQCheckListItem.Controller ); item.setOpen( true ); // iterate through the first ListView... while ( it.hasNext() ) { - QListViewItem current = (QListViewItem) it.next(); + TQListViewItem current = (TQListViewItem) it.next(); // ...check state of childs, and... if ( current.parent() != null ) // ...if the item is checked... - if ( ( (QCheckListItem) current ).isOn() ) + if ( ( (TQCheckListItem) current ).isOn() ) // ...insert a Radio-ListViewItem with the same text into the second ListView - new QCheckListItem( item, current.text( 0 ), QCheckListItem.RadioButton ); + new TQCheckListItem( item, current.text( 0 ), TQCheckListItem.RadioButton ); } if ( item.firstChild() != null ) - ( ( QCheckListItem )item.firstChild() ).setOn( true ); + ( ( TQCheckListItem )item.firstChild() ).setOn( true ); } /* @@ -158,11 +158,11 @@ public void copy2to3() // iterate through the second ListView... while ( it.hasNext() ) { - QListViewItem current = (QListViewItem) it.next(); + TQListViewItem current = (TQListViewItem) it.next(); // ...check state of childs, and... if ( current.parent() != null ) // ...if the item is checked... - if ( ( (QCheckListItem) current ).isOn() ) + if ( ( (TQCheckListItem) current ).isOn() ) // ...set the text of the item to the label label.setText( current.text( 0 ) ); } |