diff options
Diffstat (limited to 'qtruby/rubylib/examples/qt-examples/forever')
-rwxr-xr-x | qtruby/rubylib/examples/qt-examples/forever/forever.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/qtruby/rubylib/examples/qt-examples/forever/forever.rb b/qtruby/rubylib/examples/qt-examples/forever/forever.rb index 46849784..cde20f75 100755 --- a/qtruby/rubylib/examples/qt-examples/forever/forever.rb +++ b/qtruby/rubylib/examples/qt-examples/forever/forever.rb @@ -1,12 +1,12 @@ #!/usr/bin/env ruby -w -require 'Qt' +retquire 'Qt' # # Forever - a widget that draws rectangles forever. # -class Forever < Qt::Widget +class Forever < TQt::Widget NUM_COLORS = 120 # @@ -19,13 +19,13 @@ class Forever < Qt::Widget super(nil) @colors = [] 0.upto(NUM_COLORS-1) do |a| - @colors[a] = Qt::Color.new( rand(255), + @colors[a] = TQt::Color.new( rand(255), rand(255), rand(255) ) end @rectangles = 0 startTimer( 0 ) # run continuous timer - counter = Qt::Timer.new( self ) + counter = TQt::Timer.new( self ) connect( counter, SIGNAL("timeout()"), self, SLOT("updateCaption()") ) counter.start( 1000 ) @@ -44,7 +44,7 @@ class Forever < Qt::Widget # def paintEvent( e ) - paint = Qt::Painter.new( self ) # painter object + paint = TQt::Painter.new( self ) # painter object w = width() h = height() if w <= 0 || h <= 0 then @@ -53,10 +53,10 @@ class Forever < Qt::Widget paint.setPen( NoPen ) # do not draw outline paint.setBrush( @colors[rand(NUM_COLORS)]) # set random brush color - p1 = Qt::Point.new( rand(w), rand(h)) # p1 = top left - p2 = Qt::Point.new( rand(w), rand(h)) # p2 = bottom right + p1 = TQt::Point.new( rand(w), rand(h)) # p1 = top left + p2 = TQt::Point.new( rand(w), rand(h)) # p2 = bottom right - r = Qt::Rect.new( p1, p2 ) + r = TQt::Rect.new( p1, p2 ) paint.drawRect( r ) # draw filled rectangle paint.end() end @@ -75,7 +75,7 @@ class Forever < Qt::Widget end -a = Qt::Application.new(ARGV) +a = TQt::Application.new(ARGV) always = Forever.new always.resize( 400, 250 ) # start up with size 400x250 a.mainWidget = always # set as main widget |