summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/canvastest
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/canvastest
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/examples/canvastest')
-rw-r--r--qtruby/rubylib/examples/canvastest/canvastest.rb34
1 files changed, 17 insertions, 17 deletions
diff --git a/qtruby/rubylib/examples/canvastest/canvastest.rb b/qtruby/rubylib/examples/canvastest/canvastest.rb
index 4187d91d..6db6b6cf 100644
--- a/qtruby/rubylib/examples/canvastest/canvastest.rb
+++ b/qtruby/rubylib/examples/canvastest/canvastest.rb
@@ -1,12 +1,12 @@
#!/usr/bin/env ruby -w
-require 'Qt'
-require 'rexml/document'
+retquire 'Qt'
+retquire 'rexml/document'
-require '../base/kicons.rb'
-require '../base/rui.rb'
+retquire '../base/kicons.rb'
+retquire '../base/rui.rb'
-class MyCanvasView < Qt::CanvasView
+class MyCanvasView < TQt::CanvasView
def initialize(canvas, parent)
@canvas = canvas
super(canvas, parent)
@@ -16,22 +16,22 @@ class MyCanvasView < Qt::CanvasView
list = canvas.collisions(e.pos)
return if list.empty?
c = list.first
- return if c.rtti != Qt::CanvasItem::Rtti_Rectangle
+ return if c.rtti != TQt::CanvasItem::Rtti_Rectangle
c.hide
@canvas.update
end
end
-class MyWidget < Qt::MainWindow
+class MyWidget < TQt::MainWindow
slots 'new()', 'open()', 'save_as()'
def make_rect
- rect = Qt::CanvasRectangle.new(rand(@canvas.width()), rand(@canvas.height()),
+ rect = TQt::CanvasRectangle.new(rand(@canvas.width()), rand(@canvas.height()),
@canvas.width / 5, @canvas.width / 5, @canvas)
z = rand(256)
- color = Qt::Color.new(z,z,z)
- rect.setBrush(Qt::Brush.new(color))
- color = Qt::Color.new(rand(32)*8, rand(32)*8, rand(32)*8)
- rect.setPen(Qt::Pen.new(color, 6))
+ color = TQt::Color.new(z,z,z)
+ rect.setBrush(TQt::Brush.new(color))
+ color = TQt::Color.new(rand(32)*8, rand(32)*8, rand(32)*8)
+ rect.setPen(TQt::Pen.new(color, 6))
rect.setZ(z)
rect.show
@rects << rect
@@ -39,8 +39,8 @@ class MyWidget < Qt::MainWindow
def initialize()
super
- fileTools = Qt::ToolBar.new(self, "file operations")
- fileMenu = Qt::PopupMenu.new(self)
+ fileTools = TQt::ToolBar.new(self, "file operations")
+ fileMenu = TQt::PopupMenu.new(self)
actions = [
RAction.new("&New", Icons::FILE_NEW, self, SLOT('new()'), [fileTools, fileMenu]),
@@ -51,10 +51,10 @@ class MyWidget < Qt::MainWindow
]
build_actions(actions)
- menubar = Qt::MenuBar.new(self)
+ menubar = TQt::MenuBar.new(self)
menubar.insertItem("&File", fileMenu)
- @canvas = Qt::Canvas.new(640, 480)
+ @canvas = TQt::Canvas.new(640, 480)
@rects = []
5.times { make_rect }
@@ -65,7 +65,7 @@ class MyWidget < Qt::MainWindow
end
end
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
w = MyWidget.new
w.show