diff options
author | Timothy Pearson <[email protected]> | 2011-11-29 01:11:08 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-11-29 01:11:08 -0600 |
commit | 8a055d66f43592c257cece2eb8cc021808062917 (patch) | |
tree | d0922f201bd5d24b62a33160d1d9baf9e89f9a70 /examples3/checklists.py | |
parent | b388516ca2691303a076a0764fd40bf7116fe43d (diff) | |
download | pytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip |
Initial TQt conversion
Diffstat (limited to 'examples3/checklists.py')
-rwxr-xr-x | examples3/checklists.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/examples3/checklists.py b/examples3/checklists.py index 12a3cdb..d6378e6 100755 --- a/examples3/checklists.py +++ b/examples3/checklists.py @@ -9,21 +9,21 @@ from qt import * TRUE = 1 FALSE = 0 -class CheckLists(QWidget): +class CheckLists(TQWidget): def __init__(self, *args): - apply( QWidget.__init__, (self, ) + args ) + apply( TQWidget.__init__, (self, ) + args ) - lay = QHBoxLayout(self) + lay = TQHBoxLayout(self) lay.setMargin(5) - vbox1 = QVBoxLayout(lay) + vbox1 = TQVBoxLayout(lay) vbox1.setMargin(5) # First child: a Label - vbox1.addWidget(QLabel("Check some items!", self)) + vbox1.addWidget(TQLabel("Check some items!", self)) # Second child: the ListView - self.lv1 = QListView(self) + self.lv1 = TQListView(self) vbox1.addWidget(self.lv1) self.lv1.addColumn("Items") self.lv1.setRootIsDecorated(TRUE) @@ -32,10 +32,10 @@ class CheckLists(QWidget): parentList = [] - parentList.append( QListViewItem( self.lv1, "Parent Item 1" ) ) - parentList.append( QListViewItem( self.lv1, "Parent Item 2" ) ) - parentList.append( QListViewItem( self.lv1, "Parent Item 3" ) ) - parentList.append( QListViewItem( self.lv1, "Parent Item 4" ) ) + parentList.append( TQListViewItem( self.lv1, "Parent Item 1" ) ) + parentList.append( TQListViewItem( self.lv1, "Parent Item 2" ) ) + parentList.append( TQListViewItem( self.lv1, "Parent Item 3" ) ) + parentList.append( TQListViewItem( self.lv1, "Parent Item 4" ) ) num = 0 @@ -47,49 +47,49 @@ class CheckLists(QWidget): # ...and create 5 checkable child ListViewItems for each parent item for j in range(5): - ci = QCheckListItem( it, QString("%1. Child of Parent %2").arg( j ).arg( i ), QCheckListItem.CheckBox ) + ci = TQCheckListItem( it, TQString("%1. Child of Parent %2").arg( j ).arg( i ), TQCheckListItem.CheckBox ) self.childList1.append(ci) # Create another widget for layouting - tmp1 = QVBoxLayout( lay ) + tmp1 = TQVBoxLayout( lay ) tmp1.setMargin( 5 ) # create a pushbutton - copy1 = QPushButton( " -> ", self ) + copy1 = TQPushButton( " -> ", self ) tmp1.addWidget( copy1 ) copy1.setMaximumWidth( copy1.sizeHint().width() ); # connect the SIGNAL clicked() of the pushbutton with the SLOT copy1to2() self.connect( copy1, SIGNAL('clicked()'), self.copy1to2 ) # another widget for layouting - vbox2 = QVBoxLayout( lay ) + vbox2 = TQVBoxLayout( lay ) vbox2.setMargin( 5 ) # and another label - vbox2.addWidget( QLabel( "Check one item!", self ) ) + vbox2.addWidget( TQLabel( "Check one item!", self ) ) # create the second listview - self.lv2 = QListView( self ) + self.lv2 = TQListView( self ) vbox2.addWidget( self.lv2 ) self.lv2.addColumn( "Items" ) self.lv2.setRootIsDecorated( TRUE ) # another widget needed for layouting only - tmp2 = QVBoxLayout( lay ) + tmp2 = TQVBoxLayout( lay ) tmp2.setMargin( 5 ) # create another pushbutton... - copy2 = QPushButton( " -> ", self ) + copy2 = TQPushButton( " -> ", self ) lay.addWidget( copy2 ) copy2.setMaximumWidth( copy2.sizeHint().width() ) # ...and connect its clicked() SIGNAL to the copy2to3() SLOT self.connect( copy2, SIGNAL('clicked()'), self.copy2to3 ) - tmp3 = QVBoxLayout( lay ) + tmp3 = TQVBoxLayout( lay ) tmp3.setMargin( 5 ) # and create a label which will be at the right of the window - self.label = QLabel( "No Item yet...", self ) + self.label = TQLabel( "No Item yet...", self ) tmp3.addWidget( self.label ) def copy1to2(self): @@ -97,7 +97,7 @@ class CheckLists(QWidget): # 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! - item = QCheckListItem( self.lv2, "Controller", QCheckListItem.Controller ) + item = TQCheckListItem( self.lv2, "Controller", TQCheckListItem.Controller ) item.setOpen( TRUE ) self.listChild2 = [] @@ -107,7 +107,7 @@ class CheckLists(QWidget): # ...if the item is checked... if it.isOn(): # ...insert a Radio-ListViewItem with the same text into the second ListView - ri = QCheckListItem(item , it.text(0), QCheckListItem.RadioButton) + ri = TQCheckListItem(item , it.text(0), TQCheckListItem.RadioButton) self.listChild2.append(ri) if item.firstChild() != None: @@ -125,11 +125,11 @@ class CheckLists(QWidget): # ...set the text of the item to the label self.label.setText( it.text( 0 ) ) -a = QApplication(sys.argv) +a = TQApplication(sys.argv) checkLists = CheckLists() checkLists.resize(700, 400) -checkLists.setCaption("PyQt example - CheckLists") +checkLists.setCaption("PyTQt example - CheckLists") a.setMainWidget(checkLists) checkLists.show() |