summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/qt-examples/hello
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/hello
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/examples/qt-examples/hello')
-rw-r--r--qtruby/rubylib/examples/qt-examples/hello/hello.rb12
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/hello/main.rb10
2 files changed, 11 insertions, 11 deletions
diff --git a/qtruby/rubylib/examples/qt-examples/hello/hello.rb b/qtruby/rubylib/examples/qt-examples/hello/hello.rb
index ce957c75..80bf3e32 100644
--- a/qtruby/rubylib/examples/qt-examples/hello/hello.rb
+++ b/qtruby/rubylib/examples/qt-examples/hello/hello.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class Hello < Qt::Widget
+class Hello < TQt::Widget
signals 'clicked()'
slots 'animate()'
@@ -12,7 +12,7 @@ class Hello < Qt::Widget
@b = 0
@text = text
@sin_tbl = [0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38]
- timer = Qt::Timer.new(self);
+ timer = TQt::Timer.new(self);
connect(timer, SIGNAL('timeout()'), SLOT('animate()'))
timer.start(40);
@@ -53,11 +53,11 @@ class Hello < Qt::Widget
pmy = height/2 - h/2
# 2: Create the pixmap and fill it with the widget's background
- pm = Qt::Pixmap.new(w, h)
+ pm = TQt::Pixmap.new(w, h)
pm.fill(self, pmx, pmy)
# 3: Paint the pixmap. Cool wave effect
- p = Qt::Painter.new;
+ p = TQt::Painter.new;
x = 10
y = h/2 + fm.descent
i = 0
@@ -66,7 +66,7 @@ class Hello < Qt::Widget
for i in 0..@text.size-1
j = (@b+i) & 15
- p.setPen(Qt::Color.new((15-j)*16,255,255,Qt::Color.Hsv) )
+ p.setPen(TQt::Color.new((15-j)*16,255,255,TQt::Color.Hsv) )
p.drawText( x, y-@sin_tbl[j]*h/800, @text[i,1], 1 )
x += fm.width(@text[i,1])
end
diff --git a/qtruby/rubylib/examples/qt-examples/hello/main.rb b/qtruby/rubylib/examples/qt-examples/hello/main.rb
index a6d3447f..9a7a7822 100755
--- a/qtruby/rubylib/examples/qt-examples/hello/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/hello/main.rb
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
-require 'Qt'
-require 'hello'
+retquire 'Qt'
+retquire 'hello'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
s = ''
s = ARGV[0..ARGV.size-1].join(' ') if ARGV.length
@@ -15,8 +15,8 @@ end
h = Hello.new(s)
h.setCaption('QtRuby says hello')
h.connect(h, SIGNAL('clicked()'), a, SLOT('quit()'))
-h.setFont(Qt::Font.new('times', 32, Qt::Font.Bold)) # default font
-h.setBackgroundColor(Qt::white) # default bg color
+h.setFont(TQt::Font.new('times', 32, TQt::Font.Bold)) # default font
+h.setBackgroundColor(TQt::white) # default bg color
a.setMainWidget(h)
h.show