summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-05 15:55:57 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-05 15:55:57 -0600
commit9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch)
treec81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/examples/qt-examples/checklists/checklists.rb')
-rw-r--r--qtruby/rubylib/examples/qt-examples/checklists/checklists.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb b/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
index 8f67d9aa..3912c61b 100644
--- a/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
+++ b/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class CheckLists < Qt::Widget
+class CheckLists < TQt::Widget
slots 'copy1to2()', 'copy2to3()'
# Constructor
@@ -9,18 +9,18 @@ class CheckLists < Qt::Widget
def initialize
super()
- lay = Qt::HBoxLayout.new(self)
+ lay = TQt::HBoxLayout.new(self)
lay.setMargin(5)
# create a widget which layouts its childs in a column
- vbox1 = Qt::VBoxLayout.new(lay)
+ vbox1 = TQt::VBoxLayout.new(lay)
vbox1.setMargin(5)
# First child: a Label
- vbox1.addWidget(Qt::Label.new('Check some items!', self))
+ vbox1.addWidget(TQt::Label.new('Check some items!', self))
# Second child: the ListView
- @lv1 = Qt::ListView.new(self)
+ @lv1 = TQt::ListView.new(self)
vbox1.addWidget(@lv1)
@lv1.addColumn('Items')
@lv1.setRootIsDecorated(true)
@@ -29,10 +29,10 @@ class CheckLists < Qt::Widget
parentList = Array.new
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 1'))
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 2'))
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 3'))
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 4'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 1'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 2'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 3'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 4'))
item = 0
num = 1
@@ -42,51 +42,51 @@ class CheckLists < Qt::Widget
# ...and create 5 checkable child ListViewItems for each parent item
for i in 1..5
str = sprintf('%s. Child of Parent %s', i, num)
- Qt::CheckListItem.new(item, str, Qt::CheckListItem.CheckBox)
+ TQt::CheckListItem.new(item, str, TQt::CheckListItem.CheckBox)
end
num = num + 1
}
# Create another widget for layouting
- tmp = Qt::VBoxLayout.new(lay)
+ tmp = TQt::VBoxLayout.new(lay)
tmp.setMargin(5)
# create a pushbutton
- copy1 = Qt::PushButton.new(' -> ', self)
+ copy1 = TQt::PushButton.new(' -> ', self)
tmp.addWidget(copy1)
copy1.setMaximumWidth(copy1.sizeHint.width)
# connect the SIGNAL clicked() of the pushbutton with the SLOT copy1to2()
connect(copy1, SIGNAL('clicked()'), self, SLOT('copy1to2()'))
# another widget for layouting
- vbox2 = Qt::VBoxLayout.new(lay)
+ vbox2 = TQt::VBoxLayout.new(lay)
vbox2.setMargin(5)
# and another label
- vbox2.addWidget(Qt::Label.new('Check one item!', self))
+ vbox2.addWidget(TQt::Label.new('Check one item!', self))
# create the second listview
- @lv2 = Qt::ListView.new(self)
+ @lv2 = TQt::ListView.new(self)
vbox2.addWidget(@lv2)
@lv2.addColumn('Items')
@lv2.setRootIsDecorated(true)
# another widget needed for layouting only
- tmp = Qt::VBoxLayout.new(lay)
+ tmp = TQt::VBoxLayout.new(lay)
tmp.setMargin(5)
# create another pushbutton...
- copy2 = Qt::PushButton.new(' -> ', self)
+ copy2 = TQt::PushButton.new(' -> ', self)
lay.addWidget( copy2 )
copy2.setMaximumWidth(copy2.sizeHint.width)
# ...and connect its clicked() SIGNAL to the copy2to3() SLOT
connect(copy2, SIGNAL('clicked()'), self, SLOT('copy2to3()'))
- tmp = Qt::VBoxLayout.new(lay)
+ tmp = TQt::VBoxLayout.new(lay)
tmp.setMargin(5)
# and create a label which will be at the right of the window
- @label = Qt::Label.new('No Item yet...', self)
+ @label = TQt::Label.new('No Item yet...', self)
tmp.addWidget(@label)
end
@@ -96,10 +96,10 @@ class CheckLists < Qt::Widget
# the second one, and inserts them as Radio-ListViewItem.
def copy1to2
@lv2.clear
- it = Qt::ListViewItemIterator.new(@lv1)
+ it = TQt::ListViewItemIterator.new(@lv1)
# 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 = Qt::CheckListItem.new(@lv2, 'Controller', Qt::CheckListItem::Controller );
+ item = TQt::CheckListItem.new(@lv2, 'Controller', TQt::CheckListItem::Controller );
item.setOpen(true);
# iterate through the first ListView...
@@ -109,7 +109,7 @@ class CheckLists < Qt::Widget
# ...if the item is checked...
if (it.current.isOn)
# ...insert a Radio-ListViewItem with the same text into the second ListView
- Qt::CheckListItem.new(item, it.current.text(0), Qt::CheckListItem::RadioButton)
+ TQt::CheckListItem.new(item, it.current.text(0), TQt::CheckListItem::RadioButton)
end
end
it += 1
@@ -127,7 +127,7 @@ class CheckLists < Qt::Widget
# Label at the right.
def copy2to3
# create an iterator which operates on the second ListView
- it = Qt::ListViewItemIterator.new(@lv2)
+ it = TQt::ListViewItemIterator.new(@lv2)
@label.setText('No Item checked')