summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/qt-examples/aclock/aclock.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/aclock/aclock.rb
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/examples/qt-examples/aclock/aclock.rb')
-rw-r--r--qtruby/rubylib/examples/qt-examples/aclock/aclock.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb b/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb
index a2cdc378..721bf7b0 100644
--- a/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb
+++ b/qtruby/rubylib/examples/qt-examples/aclock/aclock.rb
@@ -1,16 +1,16 @@
#!/usr/bin/env ruby -w
-require 'Qt'
+retquire 'Qt'
-# an analog clock widget using an internal QTimer
-class AnalogClock < Qt::Widget
- slots 'setTime(const QTime&)', 'drawClock(QPainter*)', 'timeout()'
+# an analog clock widget using an internal TQTimer
+class AnalogClock < TQt::Widget
+ slots 'setTime(const TQTime&)', 'drawClock(TQPainter*)', 'timeout()'
def initialize(*k)
super(*k)
- @time = Qt::Time::currentTime
- @internalTimer = Qt::Timer.new(self)
+ @time = TQt::Time::currentTime
+ @internalTimer = TQt::Timer.new(self)
connect(@internalTimer, SIGNAL('timeout()'), self, SLOT('timeout()'))
@internalTimer.start(5000)
end
@@ -33,9 +33,9 @@ class AnalogClock < Qt::Widget
timeout()
end
- # The QTimer::timeout() signal is received by this slot.
+ # The TQTimer::timeout() signal is received by this slot.
def timeout
- new_time = Qt::Time::currentTime
+ new_time = TQt::Time::currentTime
@time = @time.addSecs 5
unless new_time.minute == @time.minute
if autoMask
@@ -48,7 +48,7 @@ class AnalogClock < Qt::Widget
def paintEvent(blah)
unless autoMask
- paint = Qt::Painter.new(self)
+ paint = TQt::Painter.new(self)
paint.setBrush(colorGroup.foreground)
drawClock(paint)
paint.end
@@ -57,10 +57,10 @@ class AnalogClock < Qt::Widget
# If clock is transparent, we use updateMask() instead of paintEvent()
def updateMask
- bm = Qt::Bitmap.new(size)
+ bm = TQt::Bitmap.new(size)
bm.fill(color0) # transparent
- paint = Qt::Painter.new
+ paint = TQt::Painter.new
paint.begin(bm, self)
paint.setBrush(color1) # use non-transparent color
paint.setPen(color1)
@@ -87,13 +87,13 @@ class AnalogClock < Qt::Widget
paint.save
paint.rotate(30*(@time.hour%12-3) + @time.minute/2)
- pts = Qt::PointArray.new(4, [-20,0, 0,-20, 300,0, 0,20])
+ pts = TQt::PointArray.new(4, [-20,0, 0,-20, 300,0, 0,20])
paint.drawConvexPolygon(pts)
paint.restore
paint.save
paint.rotate((@time.minute-15)*6)
- pts = Qt::PointArray.new(4, [-10,0, 0,-10, 400,0, 0,10])
+ pts = TQt::PointArray.new(4, [-10,0, 0,-10, 400,0, 0,10])
paint.drawConvexPolygon(pts)
paint.restore;
@@ -107,7 +107,7 @@ class AnalogClock < Qt::Widget
def setAutoMask(background)
setBackgroundMode(background ? PaletteForeground : PaletteBackground)
- Qt::Widget::setAutoMask(background)
+ TQt::Widget::setAutoMask(background)
end
end