summaryrefslogtreecommitdiffstats
path: root/examples3/checklists.py
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2022-07-28 15:46:19 +0000
committeraneejit1 <aneejit1@gmail.com>2022-07-30 17:54:15 +0000
commite602246539fd7435aaeb440fcb7f852c92c8426b (patch)
tree35e09f5d93c67158e6c1160d6d9b27ae8a0bf966 /examples3/checklists.py
parentb34531364d5c0d3be7056d87011afd8bd538a0e7 (diff)
downloadpytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.tar.gz
pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.zip
Remove Qt V2 support and example files
Build files for pyuic2 have been removed along with the examples for version 2 of Qt and the build/configure scripts have been amended accordingly. The "examples3" directory has been renamed to just "examples". Signed-off-by: aneejit1 <aneejit1@gmail.com>
Diffstat (limited to 'examples3/checklists.py')
-rwxr-xr-xexamples3/checklists.py135
1 files changed, 0 insertions, 135 deletions
diff --git a/examples3/checklists.py b/examples3/checklists.py
deleted file mode 100755
index 61734ba..0000000
--- a/examples3/checklists.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002 Oleksandr Yakovlyev (yshurik) <yshurik@thekompany.com>
-
-import sys
-from python_tqt.qt import *
-
-TRUE = 1
-FALSE = 0
-
-class CheckLists(TQWidget):
- def __init__(self, *args):
- TQWidget.__init__(* (self, ) + args )
-
- lay = TQHBoxLayout(self)
- lay.setMargin(5)
-
- vbox1 = TQVBoxLayout(lay)
- vbox1.setMargin(5)
-
- # First child: a Label
- vbox1.addWidget(TQLabel("Check some items!", self))
-
- # Second child: the ListView
- self.lv1 = TQListView(self)
- vbox1.addWidget(self.lv1)
- self.lv1.addColumn("Items")
- self.lv1.setRootIsDecorated(TRUE)
-
- # create a list with 4 ListViewItems which will be parent items of other ListViewItems
-
- parentList = []
-
- 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
-
- self.childList1 = []
- # go through the list of parent items...
- for i in range(4):
- it = parentList[i]
- it.setOpen( TRUE )
-
- # ...and create 5 checkable child ListViewItems for each parent item
- for j in range(5):
- 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 = TQVBoxLayout( lay )
- tmp1.setMargin( 5 )
-
- # create a pushbutton
- 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 = TQVBoxLayout( lay )
- vbox2.setMargin( 5 )
-
- # and another label
- vbox2.addWidget( TQLabel( "Check one item!", self ) )
-
- # create the second listview
- self.lv2 = TQListView( self )
- vbox2.addWidget( self.lv2 )
- self.lv2.addColumn( "Items" )
- self.lv2.setRootIsDecorated( TRUE )
-
- # another widget needed for layouting only
- tmp2 = TQVBoxLayout( lay )
- tmp2.setMargin( 5 )
-
- # create another pushbutton...
- 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 = TQVBoxLayout( lay )
- tmp3.setMargin( 5 )
-
- # and create a label which will be at the right of the window
- self.label = TQLabel( "No Item yet...", self )
- tmp3.addWidget( self.label )
-
- def copy1to2(self):
- self.lv2.clear()
-
- # 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 = TQCheckListItem( self.lv2, "Controller", TQCheckListItem.Controller )
- item.setOpen( TRUE )
-
- self.listChild2 = []
- for it in self.childList1:
- # ...check state of childs, and...
- if it.parent() != None:
- # ...if the item is checked...
- if it.isOn():
- # ...insert a Radio-ListViewItem with the same text into the second ListView
- ri = TQCheckListItem(item , it.text(0), TQCheckListItem.RadioButton)
- self.listChild2.append(ri)
-
- if item.firstChild() != None:
- item.firstChild().setOn(TRUE)
-
- def copy2to3(self):
- self.label.setText( "No Item checked" )
-
- # iterate through the second ListView...
- for it in self.listChild2:
- # ...check state of childs, and...
- if it.parent() != None:
- # ...if the item is checked...
- if it.isOn():
- # ...set the text of the item to the label
- self.label.setText( it.text( 0 ) )
-
-a = TQApplication(sys.argv)
-
-checkLists = CheckLists()
-checkLists.resize(700, 400)
-checkLists.setCaption("PyTQt example - CheckLists")
-
-a.setMainWidget(checkLists)
-checkLists.show()
-a.exec_loop()