summaryrefslogtreecommitdiffstats
path: root/korundum/rubylib/examples/uimodules/uiwidgets.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 /korundum/rubylib/examples/uimodules/uiwidgets.rb
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'korundum/rubylib/examples/uimodules/uiwidgets.rb')
-rw-r--r--korundum/rubylib/examples/uimodules/uiwidgets.rb164
1 files changed, 82 insertions, 82 deletions
diff --git a/korundum/rubylib/examples/uimodules/uiwidgets.rb b/korundum/rubylib/examples/uimodules/uiwidgets.rb
index 47e9599b..cc2d9a98 100644
--- a/korundum/rubylib/examples/uimodules/uiwidgets.rb
+++ b/korundum/rubylib/examples/uimodules/uiwidgets.rb
@@ -2,11 +2,11 @@
This is a ruby version of Jim Bublitz's pytde program, translated by Richard Dale
=end
-require 'Korundum'
+retquire 'Korundum'
module UIWidgets
-class Page1 < Qt::Object
+class Page1 < TQt::Object
slots 'restrict(int)'
def initialize(parent)
@@ -16,7 +16,7 @@ class Page1 < Qt::Object
x = 10
y = 10
- editLbl = Qt::Label.new("KTextEdit", page)
+ editLbl = TQt::Label.new("KTextEdit", page)
editLbl.setGeometry(x, y, 50, 20)
editLbl.show()
@@ -33,9 +33,9 @@ class Page1 < Qt::Object
parent.edit.show()
y = y + 125
- searchBtn = Qt::PushButton.new("Search", page)
- replaceBtn = Qt::PushButton.new("Replace", page)
- gotoBtn = Qt::PushButton.new("GoTo Line", page)
+ searchBtn = TQt::PushButton.new("Search", page)
+ replaceBtn = TQt::PushButton.new("Replace", page)
+ gotoBtn = TQt::PushButton.new("GoTo Line", page)
searchBtn.setGeometry(x, y, 60, 22)
replaceBtn.setGeometry(x + 90, y, 60, 22)
@@ -51,7 +51,7 @@ class Page1 < Qt::Object
y = y + 35
- lineeditLbl = Qt::Label.new("KLineEdit", page)
+ lineeditLbl = TQt::Label.new("KLineEdit", page)
lineeditLbl.setGeometry(x, y, 70, 20)
lineeditLbl.show()
@@ -59,7 +59,7 @@ class Page1 < Qt::Object
lineedit.setGeometry(x, y + 20, 100, 20)
lineedit.show()
- intLbl = Qt::Label.new("KIntNumInput", page)
+ intLbl = TQt::Label.new("KIntNumInput", page)
intLbl.setGeometry(x + 195, y + 35, 95, 20)
intLbl.show()
@@ -73,7 +73,7 @@ class Page1 < Qt::Object
y = y + 50
- dblLbl = Qt::Label.new("KDoubleNumInput", page)
+ dblLbl = TQt::Label.new("KDoubleNumInput", page)
dblLbl.setGeometry(x + 195, y + 80, 115, 20)
dblLbl.show()
@@ -84,7 +84,7 @@ class Page1 < Qt::Object
dblNum.setRange(0.0, 10.0, 0.5, true)
dblNum.show()
- restricteditLbl = Qt::Label.new("KRestrictedLine", page)
+ restricteditLbl = TQt::Label.new("KRestrictedLine", page)
restricteditLbl.setGeometry(x, y, 95, 20)
restricteditLbl.show()
@@ -96,14 +96,14 @@ class Page1 < Qt::Object
n = buttons.length
- @validLbl = Qt::Label.new("", page)
+ @validLbl = TQt::Label.new("", page)
@validLbl.setGeometry(x, y + 50, 250, 20)
@validLbl.show()
- grp = Qt::ButtonGroup.new(n, Qt::Vertical, "Select valid chars", page, "button grp")
+ grp = TQt::ButtonGroup.new(n, TQt::Vertical, "Select valid chars", page, "button grp")
grp.setGeometry(x, y + 75, 150, 5+30*n)
- (0...n).each { |i| Qt::RadioButton.new(buttons[i], grp) }
+ (0...n).each { |i| TQt::RadioButton.new(buttons[i], grp) }
connect(grp, SIGNAL("clicked(int)"), SLOT('restrict(int)'))
@@ -116,22 +116,22 @@ class Page1 < Qt::Object
$kapp.processEvents()
y = y + 195
- sqzLbl = Qt::Label.new("This text is too long to fit in the label below", page)
+ sqzLbl = TQt::Label.new("This text is too long to fit in the label below", page)
sqzLbl.setGeometry(x, y, 350, 20)
sqzLbl.show()
- sqzLbl1 = Qt::Label.new("KSqueezedTxtLabel:", page)
+ sqzLbl1 = TQt::Label.new("KSqueezedTxtLabel:", page)
sqzLbl1.setGeometry(x, y + 20, 120, 20)
sqzLbl1.show()
squeeze = KDE::SqueezedTextLabel.new("This text is too long to fit in the label below", page)
squeeze.setGeometry(x + 125, y + 20, 125, 20)
- squeeze.setBackgroundMode(Qt::Widget::PaletteBase)
+ squeeze.setBackgroundMode(TQt::Widget::PaletteBase)
squeeze.show()
end
def restrict(which)
- r = {0 => "0123456789", 1 => "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 2 => "abcdefghijklmnopqrstuvwxyz"}
+ r = {0 => "0123456789", 1 => "ABCDEFGHIJKLMNOPTQRSTUVWXYZ", 2 => "abcdefghijklmnopqrstuvwxyz"}
@restrictlineedit.setValidChars(r[which])
@validLbl.setText("Valid: " + @restrictlineedit.validChars())
end
@@ -146,7 +146,7 @@ class Page2
x2 = 240
y2 = 100
- cbLbl = Qt::Label.new("KComboBox", page)
+ cbLbl = TQt::Label.new("KComboBox", page)
cbLbl.setGeometry(x1, y1, 75, 20)
cbLbl.show()
@@ -155,7 +155,7 @@ class Page2
combo.setGeometry(x1, y1 + 20, 100, 25)
combo.show()
- ccbLbl = Qt::Label.new("KColorCombo", page)
+ ccbLbl = TQt::Label.new("KColorCombo", page)
ccbLbl.setGeometry(x2, y1, 100, 20)
ccbLbl.show()
@@ -168,7 +168,7 @@ class Page2
editListBox.insertStringList(["One", "Two", "Three"])
editListBox.show()
- lbLbl = Qt::Label.new("KListBox", page)
+ lbLbl = TQt::Label.new("KListBox", page)
lbLbl.setGeometry(x2, y2, 100, 20)
lbLbl.show()
@@ -186,7 +186,7 @@ class Page3
x = 10
y = 10
- fontLbl = Qt::Label.new("KFontChooser", page)
+ fontLbl = TQt::Label.new("KFontChooser", page)
fontLbl.setGeometry(x, y, 95, 20)
fontLbl.show()
@@ -205,16 +205,16 @@ class Page4
x = 10
y = 10
- cbLbl = Qt::Label.new("KColorButton", page)
+ cbLbl = TQt::Label.new("KColorButton", page)
cbLbl.setGeometry(x, y, 75, 20)
cbLbl.show()
cb = KDE::ColorButton.new(page)
- cb.setColor(Qt::Color.new(255, 0, 0))
+ cb.setColor(TQt::Color.new(255, 0, 0))
cb.setGeometry(x, y + 20, 30, 30)
cb.show()
- ccbLbl = Qt::Label.new("KColorCombo", page)
+ ccbLbl = TQt::Label.new("KColorCombo", page)
ccbLbl.setGeometry(x + 150, y, 100, 20)
ccbLbl.show()
@@ -224,53 +224,53 @@ class Page4
y = y + 60
- cpLbl = Qt::Label.new("KColorPatch", page)
+ cpLbl = TQt::Label.new("KColorPatch", page)
cpLbl.setGeometry(x, y, 75, 20)
cpLbl.show()
cp = KDE::ColorPatch.new(page)
- cp.setColor(Qt::Color.new(255, 0, 0))
+ cp.setColor(TQt::Color.new(255, 0, 0))
cp.setGeometry(x, y + 20, 20, 20)
cp.show()
x = x + 150
- ccLbl = Qt::Label.new("KColorCells", page)
+ ccLbl = TQt::Label.new("KColorCells", page)
ccLbl.setGeometry(x, y, 75, 20)
ccLbl.show()
cc = KDE::ColorCells.new(page, 1, 5)
- cc.setColor(0, Qt::Color.new(0, 0, 0))
- cc.setColor(1, Qt::Color.new(255, 0, 0))
- cc.setColor(2, Qt::Color.new(0, 255, 0))
- cc.setColor(3, Qt::Color.new(0, 0, 255))
- cc.setColor(4, Qt::Color.new(255, 255, 255))
+ cc.setColor(0, TQt::Color.new(0, 0, 0))
+ cc.setColor(1, TQt::Color.new(255, 0, 0))
+ cc.setColor(2, TQt::Color.new(0, 255, 0))
+ cc.setColor(3, TQt::Color.new(0, 0, 255))
+ cc.setColor(4, TQt::Color.new(255, 255, 255))
cc.setGeometry(x, y + 20, 100, 20)
cc.show()
x = 10
y = y + 50
- dcLbl = Qt::Label.new("KDualColorButton", page)
+ dcLbl = TQt::Label.new("KDualColorButton", page)
dcLbl.setGeometry(x, y, 105, 20)
dcLbl.show()
- dc = KDE::DualColorButton.new(Qt::Color.new(255, 0, 0), Qt::Color.new(0, 0, 0), page)
+ dc = KDE::DualColorButton.new(TQt::Color.new(255, 0, 0), TQt::Color.new(0, 0, 0), page)
dc.setGeometry(x, y + 20, 40, 40)
dc.show()
- gsLbl = Qt::Label.new("KGradientSelector", page)
+ gsLbl = TQt::Label.new("KGradientSelector", page)
gsLbl.setGeometry(x + 80, y + 30, 110, 20)
gsLbl.show()
gs = KDE::GradientSelector.new(page)
gs.setGeometry(x + 80, y + 50, 250, 20)
- gs.setColors(Qt::Color.new(255, 0, 0), Qt::Color.new(255, 255, 0))
+ gs.setColors(TQt::Color.new(255, 0, 0), TQt::Color.new(255, 255, 0))
gs.show()
y = y + 80
- hsLbl = Qt::Label.new("KHSSelector", page)
+ hsLbl = TQt::Label.new("KHSSelector", page)
hsLbl.setGeometry(x, y, 95, 20)
hsLbl.show()
@@ -280,7 +280,7 @@ class Page4
y = y + 110
- ptLbl = Qt::Label.new("KPaletteTable", page)
+ ptLbl = TQt::Label.new("KPaletteTable", page)
ptLbl.setGeometry(x, y, 95, 20)
ptLbl.show()
@@ -298,7 +298,7 @@ class Page5
x = 10
y = 10
- rpLbl = Qt::Label.new("KRootPermsIcon", page)
+ rpLbl = TQt::Label.new("KRootPermsIcon", page)
rpLbl.setGeometry(x, y, 95, 20)
rpLbl.show()
@@ -306,7 +306,7 @@ class Page5
rp.setGeometry(x, y + 20, 32, 32)
rp.show()
- wpLbl = Qt::Label.new("KWritePermsIcon", page)
+ wpLbl = TQt::Label.new("KWritePermsIcon", page)
wpLbl.setGeometry(x + 125, y, 95, 20)
wpLbl.show()
@@ -316,7 +316,7 @@ class Page5
y = y + 75
- pw1Lbl = Qt::Label.new("KPasswordEdit - echo *", page)
+ pw1Lbl = TQt::Label.new("KPasswordEdit - echo *", page)
pw1Lbl.setGeometry(x, y, 150, 20)
pw1Lbl.show()
@@ -326,7 +326,7 @@ class Page5
y = y + 50
- pw2Lbl = Qt::Label.new("KPasswordEdit - echo ***", page)
+ pw2Lbl = TQt::Label.new("KPasswordEdit - echo ***", page)
pw2Lbl.setGeometry(x, y, 150, 20)
pw2Lbl.show()
@@ -336,7 +336,7 @@ class Page5
y = y + 50
- pw3Lbl = Qt::Label.new("KPasswordEdit - no echo", page)
+ pw3Lbl = TQt::Label.new("KPasswordEdit - no echo", page)
pw3Lbl.setGeometry(x, y, 150, 20)
pw3Lbl.show()
@@ -346,7 +346,7 @@ class Page5
y = y + 50
- urlLbl = Qt::Label.new("KURLLabel", page)
+ urlLbl = TQt::Label.new("KURLLabel", page)
urlLbl.setGeometry(x, y, 100, 20)
urlLbl.show()
@@ -359,11 +359,11 @@ class Page5
x = 70
y = y + 50
- bbLbl = Qt::Label.new("KButtonBox", page)
+ bbLbl = TQt::Label.new("KButtonBox", page)
bbLbl.setGeometry(x, y, 75, 20)
bbLbl.show()
- bbox = KDE::ButtonBox.new(page, Qt::Horizontal)
+ bbox = KDE::ButtonBox.new(page, TQt::Horizontal)
bbox.setGeometry(x, y + 20, 300, 22)
bbox.addButton("Button 1")
bbox.addButton("Button 2")
@@ -372,14 +372,14 @@ class Page5
y = y + 50
-# dbLbl = Qt::Label.new("KDirectionButton", page)
+# dbLbl = TQt::Label.new("KDirectionButton", page)
# dbLbl.setGeometry(x, y, 95, 20)
# dbLbl.show()
-# dbUp = KDE::DirectionButton.new(Qt::t::UpArrow, page)
-# dbDown = KDE::DirectionButton.new(Qt::t::DownArrow, page)
-# dbRight = KDE::DirectionButton.new(Qt::t::RightArrow, page)
-# dbLeft = KDE::DirectionButton.new(Qt::t::LeftArrow, page)
+# dbUp = KDE::DirectionButton.new(TQt::t::UpArrow, page)
+# dbDown = KDE::DirectionButton.new(TQt::t::DownArrow, page)
+# dbRight = KDE::DirectionButton.new(TQt::t::RightArrow, page)
+# dbLeft = KDE::DirectionButton.new(TQt::t::LeftArrow, page)
# dbUp.setGeometry(x, y + 20, 22, 22)
# dbDown.setGeometry(x + 30, y + 20, 22, 22)
@@ -393,7 +393,7 @@ class Page5
x = x + 150
-# kbLbl = Qt::Label.new("KKeyButton", page)
+# kbLbl = TQt::Label.new("KKeyButton", page)
# kbLbl.setGeometry(x, y, 95, 20)
# kbLbl.show()
@@ -405,14 +405,14 @@ class Page5
x = 70
y = y + 50
-# tbLbl = Qt::Label.new("KTabButton", page)
+# tbLbl = TQt::Label.new("KTabButton", page)
# tbLbl.setGeometry(x, y, 95, 20)
# tbLbl.show()
-# tbUp = KDE::TabButton.new(Qt::t::UpArrow, page)
-# tbDown = KDE::TabButton.new(Qt::t::DownArrow, page)
-# tbRight = KDE::TabButton.new(Qt::t::RightArrow, page)
-# tbLeft = KDE::TabButton.new(Qt::t::LeftArrow, page)
+# tbUp = KDE::TabButton.new(TQt::t::UpArrow, page)
+# tbDown = KDE::TabButton.new(TQt::t::DownArrow, page)
+# tbRight = KDE::TabButton.new(TQt::t::RightArrow, page)
+# tbLeft = KDE::TabButton.new(TQt::t::LeftArrow, page)
# tbUp.setGeometry(x, y + 20, 22, 25)
# tbDown.setGeometry(x + 30, y + 20, 22, 25)
@@ -426,7 +426,7 @@ class Page5
end
end
-class Page6 < Qt::Object
+class Page6 < TQt::Object
slots 'toggleClicked()'
def initialize(parent)
@@ -436,10 +436,10 @@ class Page6 < Qt::Object
x = 20
y = 10
- red = Qt::Color.new(255, 0, 0)
- green = Qt::Color.new(0, 255, 0)
- yellow = Qt::Color.new(255, 255, 0)
- blue = Qt::Color.new(0, 0, 255)
+ red = TQt::Color.new(255, 0, 0)
+ green = TQt::Color.new(0, 255, 0)
+ yellow = TQt::Color.new(255, 255, 0)
+ blue = TQt::Color.new(0, 0, 255)
ledcolor = [red, green, yellow, blue]
ledshape = [KDE::Led::Rectangular, KDE::Led::Circular]
@@ -465,7 +465,7 @@ class Page6 < Qt::Object
y = y + 10
end
- toggle = Qt::PushButton.new("Toggle", page)
+ toggle = TQt::PushButton.new("Toggle", page)
toggle.setGeometry(150, 400, 60, 22)
toggle.show()
@@ -479,7 +479,7 @@ class Page6 < Qt::Object
end
end
-class Page7 < Qt::Object
+class Page7 < TQt::Object
slots 'add1()'
def initialize(parent)
@@ -489,21 +489,21 @@ class Page7 < Qt::Object
x = 10
y = 10
- tabLbl = Qt::Label.new("KTabCtl", page)
+ tabLbl = TQt::Label.new("KTabCtl", page)
tabLbl.setGeometry(x, y, 95, 20)
tabLbl.show()
tab = KDE::TabCtl.new(page)
tab.setGeometry(x, y + 20, 300, 100)
- page1 = Qt::Widget.new(tab)
- p1Lbl = Qt::Label.new("This is page 1", page1)
+ page1 = TQt::Widget.new(tab)
+ p1Lbl = TQt::Label.new("This is page 1", page1)
p1Lbl.setGeometry(20, 20, 100, 20)
- page2 = Qt::Widget.new(tab)
- p2Lbl = Qt::Label.new("This is page 2", page2)
+ page2 = TQt::Widget.new(tab)
+ p2Lbl = TQt::Label.new("This is page 2", page2)
p2Lbl.setGeometry(50, 20, 100, 20)
- page3 = Qt::Widget.new(tab)
- p3Lbl = Qt::Label.new("This is page 3", page3)
+ page3 = TQt::Widget.new(tab)
+ p3Lbl = TQt::Label.new("This is page 3", page3)
p3Lbl.setGeometry(20, 50, 100, 20)
tab.addTab(page1, "Tab 1")
@@ -514,7 +514,7 @@ class Page7 < Qt::Object
x = 10
y = 150
- progLbl = Qt::Label.new("KProgress", page)
+ progLbl = TQt::Label.new("KProgress", page)
progLbl.setGeometry(x, y + 50, 95, 20)
progLbl.show()
@@ -534,17 +534,17 @@ class Page7 < Qt::Object
@total = 0
y = y + 150
- sepLbl = Qt::Label.new("KSeparator", page)
+ sepLbl = TQt::Label.new("KSeparator", page)
sepLbl.setGeometry(x, y, 95, 20)
sepLbl.show()
- sep = KDE::Separator.new(Qt::Frame::HLine, page)
+ sep = KDE::Separator.new(TQt::Frame::HLine, page)
sep.setGeometry(x, y + 20, 75, 10)
sep.show()
page.show()
- @timer = Qt::Timer.new(page)
+ @timer = TQt::Timer.new(page)
connect(@timer, SIGNAL('timeout()'), SLOT('add1()'))
@timer.start(100)
@@ -569,7 +569,7 @@ class Page8
x = 40
y = 10
- dpLbl = Qt::Label.new("KDatePicker", page)
+ dpLbl = TQt::Label.new("KDatePicker", page)
dpLbl.setGeometry(x, y, 95, 20)
dpLbl.show()
@@ -579,7 +579,7 @@ class Page8
y = y + 210
- dtLbl = Qt::Label.new("KDateTable", page)
+ dtLbl = TQt::Label.new("KDateTable", page)
dtLbl.setGeometry(x, y, 95, 20)
dtLbl.show()
@@ -596,7 +596,7 @@ class PageThisApp
x = 10
y = 10
- taLbl = Qt::Label.new("This application uses KMainWindow as its top level widget\n and KListView in the"\
+ taLbl = TQt::Label.new("This application uses KMainWindow as its top level widget\n and KListView in the"\
" left-hand panel", page)
taLbl.setGeometry(x, y, 300, 60)
taLbl.show()
@@ -610,7 +610,7 @@ class PageNotImpl
x = 10
y = 10
- niLbl = Qt::Label.new("Nothing is currently implemented for this widget", page)
+ niLbl = TQt::Label.new("Nothing is currently implemented for this widget", page)
niLbl.setGeometry(x, y, 300, 20)
niLbl.show()
end
@@ -626,14 +626,14 @@ class CSDlg < KDE::Dialog
x = 10
y = 10
- csLbl = Qt::Label.new("KCharSelect", self)
+ csLbl = TQt::Label.new("KCharSelect", self)
csLbl.setGeometry(x, y, 95, 20)
csLbl.show()
- cs = KDE::CharSelect.new(self, "chselect", nil, Qt::Char.new(0), 0)
+ cs = KDE::CharSelect.new(self, "chselect", nil, TQt::Char.new(0), 0)
cs.setGeometry(x, y + 20, 680, 250)
cs.show()
- closeBtn = Qt::PushButton.new("Close", self)
+ closeBtn = TQt::PushButton.new("Close", self)
closeBtn.setGeometry( 610, 280, 60, 22)
closeBtn.show()