summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples
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
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/examples')
-rw-r--r--qtruby/rubylib/examples/base/kicons.rb8
-rw-r--r--qtruby/rubylib/examples/base/rui.rb2
-rw-r--r--qtruby/rubylib/examples/canvastest/canvastest.rb34
-rw-r--r--qtruby/rubylib/examples/killerfilter/killerfilter.rb18
-rw-r--r--qtruby/rubylib/examples/network/clientserver/client/client.rb24
-rw-r--r--qtruby/rubylib/examples/network/clientserver/server/server.rb34
-rw-r--r--qtruby/rubylib/examples/passivepopup/passivepopup.rb22
-rw-r--r--qtruby/rubylib/examples/qt-examples/aclock/aclock.rb28
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/aclock/main.rb6
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/README2
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/canvastext.rb2
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/canvasview.rb4
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/chartform.rb132
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb16
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb22
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/element.rb26
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk2
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/main.rb20
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/optionsform.rb68
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/setdataform.rb62
-rw-r--r--qtruby/rubylib/examples/qt-examples/checklists/checklists.rb48
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/checklists/main.rb6
-rw-r--r--qtruby/rubylib/examples/qt-examples/dclock/dclock.rb12
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/dclock/main.rb6
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb8
-rw-r--r--qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb46
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/forever/forever.rb18
-rw-r--r--qtruby/rubylib/examples/qt-examples/hello/hello.rb12
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/hello/main.rb10
-rw-r--r--qtruby/rubylib/examples/qt-examples/progress/progress.rb54
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/tictac/main.rb6
-rw-r--r--qtruby/rubylib/examples/qt-examples/tictac/tictac.rb38
-rwxr-xr-xqtruby/rubylib/examples/qt-examples/tooltip/main.rb6
-rw-r--r--qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb20
-rw-r--r--qtruby/rubylib/examples/qtscribble/scribble.rb76
-rw-r--r--qtruby/rubylib/examples/ruboids/README2
-rw-r--r--qtruby/rubylib/examples/ruboids/index.html4
-rwxr-xr-xqtruby/rubylib/examples/ruboids/release.rb10
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Boid.rb8
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb4
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Camera.rb2
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb40
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb24
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb6
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb12
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Flock.rb6
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb10
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Params.rb2
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Thing.rb2
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb2
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/World.rb20
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb14
-rwxr-xr-xqtruby/rubylib/examples/ruboids/ruboids/ruboids.rb14
-rw-r--r--qtruby/rubylib/examples/testcases/bugs.rb28
-rw-r--r--qtruby/rubylib/examples/testcases/error_reporting.rb22
-rw-r--r--qtruby/rubylib/examples/testcases/opoverloading.rb24
-rw-r--r--qtruby/rubylib/examples/textedit/textedit.rb36
57 files changed, 595 insertions, 595 deletions
diff --git a/qtruby/rubylib/examples/base/kicons.rb b/qtruby/rubylib/examples/base/kicons.rb
index 0d0a2c01..1922d70e 100644
--- a/qtruby/rubylib/examples/base/kicons.rb
+++ b/qtruby/rubylib/examples/base/kicons.rb
@@ -23,13 +23,13 @@ class KIconCollection
end
def get_icon_set(icon_type)
path = get_icon_path(icon_type)
- pixmap = Qt::Pixmap.new(path)
- icon_set = Qt::IconSet.new
- icon_set.setPixmap(pixmap, Qt::IconSet.Small)
+ pixmap = TQt::Pixmap.new(path)
+ icon_set = TQt::IconSet.new
+ icon_set.setPixmap(pixmap, TQt::IconSet.Small)
icon_set
end
def make_qt_action(parent, text_with_accel, icon_type)
- act = Qt::Action.new(parent)
+ act = TQt::Action.new(parent)
act.setIconSet(get_icon_set(icon_type))
act.setMenuText(text_with_accel)
act
diff --git a/qtruby/rubylib/examples/base/rui.rb b/qtruby/rubylib/examples/base/rui.rb
index ad14bc11..046bb637 100644
--- a/qtruby/rubylib/examples/base/rui.rb
+++ b/qtruby/rubylib/examples/base/rui.rb
@@ -1,4 +1,4 @@
-require '../base/kicons.rb'
+retquire '../base/kicons.rb'
RAction = Struct.new(:text_with_accel, :icon_type, :rec, :slot, :included_in, :action)
RSeperator = Struct.new(:included_in, :id)
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
diff --git a/qtruby/rubylib/examples/killerfilter/killerfilter.rb b/qtruby/rubylib/examples/killerfilter/killerfilter.rb
index 647dc079..51f62d08 100644
--- a/qtruby/rubylib/examples/killerfilter/killerfilter.rb
+++ b/qtruby/rubylib/examples/killerfilter/killerfilter.rb
@@ -2,12 +2,12 @@
# This is the EventFilter example from Chapter 16 of 'Programming with Qt'
-require 'Qt'
+retquire 'Qt'
-class KillerFilter < Qt::Object
+class KillerFilter < TQt::Object
def eventFilter( object, event )
- if event.type() == Qt::Event::MouseButtonPress
+ if event.type() == TQt::Event::MouseButtonPress
if event.button() == RightButton
object.close(false)
return true
@@ -21,29 +21,29 @@ class KillerFilter < Qt::Object
end
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
-toplevel = Qt::Widget.new
+toplevel = TQt::Widget.new
toplevel.resize(230, 130)
killerfilter = KillerFilter.new
-pb = Qt::PushButton.new(toplevel)
+pb = TQt::PushButton.new(toplevel)
pb.setGeometry( 10, 10, 100, 50 )
pb.text = "pushbutton"
pb.installEventFilter(killerfilter)
-le = Qt::LineEdit.new(toplevel)
+le = TQt::LineEdit.new(toplevel)
le.setGeometry( 10, 70, 100, 50 )
le.text = "Line edit"
le.installEventFilter(killerfilter)
-cb = Qt::CheckBox.new(toplevel)
+cb = TQt::CheckBox.new(toplevel)
cb.setGeometry( 120, 10, 100, 50 )
cb.text = "Check-box"
cb.installEventFilter(killerfilter)
-rb = Qt::RadioButton.new(toplevel)
+rb = TQt::RadioButton.new(toplevel)
rb.setGeometry( 120, 70, 100, 50 )
rb.text = "Radio button"
rb.installEventFilter(killerfilter)
diff --git a/qtruby/rubylib/examples/network/clientserver/client/client.rb b/qtruby/rubylib/examples/network/clientserver/client/client.rb
index 1f16b0ca..04c061e7 100644
--- a/qtruby/rubylib/examples/network/clientserver/client/client.rb
+++ b/qtruby/rubylib/examples/network/clientserver/client/client.rb
@@ -1,23 +1,23 @@
-require 'Qt'
+retquire 'Qt'
-class Client < Qt::VBox
+class Client < TQt::VBox
def initialize( host, port )
super()
# GUI layout
- @infoText = Qt::TextView.new( self )
- hb = Qt::HBox.new( self )
- @inputText = Qt::LineEdit.new( hb )
- send = Qt::PushButton.new( tr("Send") , hb )
- close = Qt::PushButton.new( tr("Close connection") , self )
- quit = Qt::PushButton.new( tr("Quit") , self )
+ @infoText = TQt::TextView.new( self )
+ hb = TQt::HBox.new( self )
+ @inputText = TQt::LineEdit.new( hb )
+ send = TQt::PushButton.new( tr("Send") , hb )
+ close = TQt::PushButton.new( tr("Close connection") , self )
+ quit = TQt::PushButton.new( tr("Quit") , self )
connect( send, SIGNAL('clicked()'), SLOT('sendToServer()') )
connect( close, SIGNAL('clicked()'), SLOT('closeConnection()') )
connect( quit, SIGNAL('clicked()'), $qApp, SLOT('quit()') )
# create the socket and connect various of its signals
- @socket = Qt::Socket.new( self )
+ @socket = TQt::Socket.new( self )
connect( @socket, SIGNAL('connected()'),
SLOT('socketConnected()') )
connect( @socket, SIGNAL('connectionClosed()'),
@@ -39,7 +39,7 @@ class Client < Qt::VBox
def closeConnection()
@socket.close()
- if @socket.state() == Qt::Socket::Closing
+ if @socket.state() == TQt::Socket::Closing
# We have a delayed close.
connect( @socket, SIGNAL('delayedCloseFinished()'),
SLOT('socketClosed()') )
@@ -51,7 +51,7 @@ class Client < Qt::VBox
def sendToServer()
# write to the server
- os = Qt::TextStream.new(@socket)
+ os = TQt::TextStream.new(@socket)
os << @inputText.text() << "\n"
@inputText.setText( "" )
os.dispose()
@@ -81,7 +81,7 @@ class Client < Qt::VBox
end
end
-app = Qt::Application.new( ARGV )
+app = TQt::Application.new( ARGV )
client = Client.new( ARGV.length < 1 ? "localhost" : ARGV[0], 4242 )
app.mainWidget = client
client.show
diff --git a/qtruby/rubylib/examples/network/clientserver/server/server.rb b/qtruby/rubylib/examples/network/clientserver/server/server.rb
index d8a937f4..a8248d63 100644
--- a/qtruby/rubylib/examples/network/clientserver/server/server.rb
+++ b/qtruby/rubylib/examples/network/clientserver/server/server.rb
@@ -1,11 +1,11 @@
-require 'Qt'
+retquire 'Qt'
=begin
The ClientSocket class provides a socket that is connected with a client.
For every client that connects to the server, the server creates a new
instance of this class.
=end
-class ClientSocket < Qt::Socket
+class ClientSocket < TQt::Socket
def initialize(sock, parent=nil, name=nil)
super( parent, name )
@line = 0
@@ -16,12 +16,12 @@ class ClientSocket < Qt::Socket
setSocket( sock )
end
- signals 'logText(const QString&)'
+ signals 'logText(const TQString&)'
slots 'readClient()'
def readClient()
- ts = Qt::TextStream.new( self )
+ ts = TQt::TextStream.new( self )
while canReadLine() do
str = ts.readLine()
emit logText( tr("Read: '%s'\n" % str) )
@@ -43,7 +43,7 @@ end
client that connects, it creates a new ClientSocket -- that instance is now
responsible for the communication with that client.
=end
-class SimpleServer < Qt::ServerSocket
+class SimpleServer < TQt::ServerSocket
def initialize( parent=nil )
super( 4242, 1, parent )
if !ok()
@@ -57,10 +57,10 @@ class SimpleServer < Qt::ServerSocket
emit newConnect( s )
end
- # The type of the argument is 'QSocket*', not
+ # The type of the argument is 'TQSocket*', not
# 'ClientSocket*' as only types in the Smoke
# library can be used for types in Signals
- signals 'newConnect(QSocket*)'
+ signals 'newConnect(TQSocket*)'
end
@@ -68,7 +68,7 @@ end
The ServerInfo class provides a small GUI for the server. It also creates the
SimpleServer and as a result the server.
=end
-class ServerInfo < Qt::VBox
+class ServerInfo < TQt::VBox
def initialize()
super
@server = SimpleServer.new( self )
@@ -77,25 +77,25 @@ class ServerInfo < Qt::VBox
"This is a small server example.\n" +
"Connect with the client now."
)
- lb = Qt::Label.new( itext, self )
+ lb = TQt::Label.new( itext, self )
lb.setAlignment( AlignHCenter )
- @infoText = Qt::TextView.new( self )
- quit = Qt::PushButton.new( tr("Quit") , self )
+ @infoText = TQt::TextView.new( self )
+ quit = TQt::PushButton.new( tr("Quit") , self )
# See the comment above about why the 'ClientSocket*'
# type cannot be used
- connect( @server, SIGNAL('newConnect(QSocket*)'),
- SLOT('newConnect(QSocket*)') )
+ connect( @server, SIGNAL('newConnect(TQSocket*)'),
+ SLOT('newConnect(TQSocket*)') )
connect( quit, SIGNAL('clicked()'), $qApp,
SLOT('quit()') )
end
- slots 'newConnect(QSocket*)', 'connectionClosed()'
+ slots 'newConnect(TQSocket*)', 'connectionClosed()'
def newConnect( s )
@infoText.append( tr("New connection\n") )
- connect( s, SIGNAL('logText(const QString&)'),
- @infoText, SLOT('append(const QString&)') )
+ connect( s, SIGNAL('logText(const TQString&)'),
+ @infoText, SLOT('append(const TQString&)') )
connect( s, SIGNAL('connectionClosed()'),
SLOT('connectionClosed()') )
end
@@ -106,7 +106,7 @@ class ServerInfo < Qt::VBox
end
-app = Qt::Application.new( ARGV )
+app = TQt::Application.new( ARGV )
info = ServerInfo.new
app.mainWidget = info
info.show
diff --git a/qtruby/rubylib/examples/passivepopup/passivepopup.rb b/qtruby/rubylib/examples/passivepopup/passivepopup.rb
index 37f60c1f..6041d277 100644
--- a/qtruby/rubylib/examples/passivepopup/passivepopup.rb
+++ b/qtruby/rubylib/examples/passivepopup/passivepopup.rb
@@ -1,38 +1,38 @@
#!/usr/bin/env ruby
-require 'Qt'
+retquire 'Qt'
-class PassiveWindow < Qt::Frame
+class PassiveWindow < TQt::Frame
MARGIN = 20
def initialize(message)
super(nil, "passivedlg",
- Qt::WStyle_Customize | Qt::WX11BypassWM | Qt::WStyle_StaysOnTop |
- Qt::WStyle_Tool | Qt::WStyle_NoBorder)
+ TQt::WStyle_Customize | TQt::WX11BypassWM | TQt::WStyle_StaysOnTop |
+ TQt::WStyle_Tool | TQt::WStyle_NoBorder)
- setFrameStyle(Qt::Frame::Box| Qt::Frame::Plain)
+ setFrameStyle(TQt::Frame::Box| TQt::Frame::Plain)
setLineWidth(2)
setMinimumWidth(100)
- layout=Qt::VBoxLayout.new(self, 6, 11)
+ layout=TQt::VBoxLayout.new(self, 6, 11)
layout.setAutoAdd(true)
- Qt::Label.new(message, self)
+ TQt::Label.new(message, self)
- quit=Qt::PushButton.new(tr("Close"), self)
+ quit=TQt::PushButton.new(tr("Close"), self)
connect(quit, SIGNAL("clicked()"), SLOT("close()"))
end
def show
super
- move(Qt::Application.desktop().width() - width() - MARGIN,
- Qt::Application.desktop().height() - height() - MARGIN)
+ move(TQt::Application.desktop().width() - width() - MARGIN,
+ TQt::Application.desktop().height() - height() - MARGIN)
end
end
if (Process.fork != nil)
exit
end
-app = Qt::Application.new(ARGV)
+app = TQt::Application.new(ARGV)
win = PassiveWindow.new(ARGV[0])
app.mainWidget = win
win.show
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
diff --git a/qtruby/rubylib/examples/qt-examples/aclock/main.rb b/qtruby/rubylib/examples/qt-examples/aclock/main.rb
index dadbee15..1b07a91c 100755
--- a/qtruby/rubylib/examples/qt-examples/aclock/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/aclock/main.rb
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
-require 'Qt'
-require 'aclock'
+retquire 'Qt'
+retquire 'aclock'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
clock = AnalogClock.new
ARGV.each {|arg|
clock.setAutoMask(true) if arg == '-transparent'
diff --git a/qtruby/rubylib/examples/qt-examples/chart/README b/qtruby/rubylib/examples/qt-examples/chart/README
index 921437c5..b1cf673c 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/README
+++ b/qtruby/rubylib/examples/qt-examples/chart/README
@@ -2,7 +2,7 @@
A Complete Canvas Application
This is a complete example program with a main window, menus and
-toolbars. The main widget is a Qt::Canvas, and this example
+toolbars. The main widget is a TQt::Canvas, and this example
demonstrates basic canvas usage.
This example is the subject of Qt Tutorial #2
diff --git a/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb b/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb
index 8a298faa..aecb171e 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/canvastext.rb
@@ -1,5 +1,5 @@
-class CanvasText < Qt::CanvasText
+class CanvasText < TQt::CanvasText
CANVAS_TEXT = 1100
attr :index
diff --git a/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb b/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb
index 416b0de7..296d6913 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/canvasview.rb
@@ -1,4 +1,4 @@
-class CanvasView < Qt::CanvasView
+class CanvasView < TQt::CanvasView
def initialize(canvas, elements, parent = nil, name = "canvas view", f = 0)
super(canvas, parent, name, f)
@@ -7,7 +7,7 @@ class CanvasView < Qt::CanvasView
end
def contentsContextMenuEvent( e )
- parent().optionsMenu.exec( Qt::Cursor.pos() )
+ parent().optionsMenu.exec( TQt::Cursor.pos() )
end
diff --git a/qtruby/rubylib/examples/qt-examples/chart/chartform.rb b/qtruby/rubylib/examples/qt-examples/chart/chartform.rb
index a649ce12..45d8d1ed 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/chartform.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/chartform.rb
@@ -1,4 +1,4 @@
-class ChartForm < Qt::MainWindow
+class ChartForm < TQt::MainWindow
slots 'fileNew()',
'fileOpen()',
@@ -9,7 +9,7 @@ class ChartForm < Qt::MainWindow
'filePrint()',
'fileQuit()',
'optionsSetData()',
- 'updateChartType( QAction * )',
+ 'updateChartType( TQAction * )',
'optionsSetFont()',
'optionsSetOptions()',
'helpHelp()',
@@ -37,85 +37,85 @@ class ChartForm < Qt::MainWindow
def initialize( filename )
super( nil, nil, WDestructiveClose )
@filename = filename
- setIcon( Qt::Pixmap.new( "images/options_piechart.xpm" ) )
+ setIcon( TQt::Pixmap.new( "images/options_piechart.xpm" ) )
- fileNewAction = Qt::Action.new(
- "New Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_new.xpm" )),
- "&New", Qt::KeySequence.new(CTRL+Key_N), self, "new" )
+ fileNewAction = TQt::Action.new(
+ "New Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_new.xpm" )),
+ "&New", TQt::KeySequence.new(CTRL+Key_N), self, "new" )
connect( fileNewAction, SIGNAL( 'activated()' ), self, SLOT( 'fileNew()' ) )
- fileOpenAction = Qt::Action.new(
- "Open Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_open.xpm" )),
- "&Open...", Qt::KeySequence.new(CTRL+Key_O), self, "open" )
+ fileOpenAction = TQt::Action.new(
+ "Open Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_open.xpm" )),
+ "&Open...", TQt::KeySequence.new(CTRL+Key_O), self, "open" )
connect( fileOpenAction, SIGNAL( 'activated()' ), self, SLOT( 'fileOpen()' ) )
- fileSaveAction = Qt::Action.new(
- "Save Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_save.xpm" )),
- "&Save", Qt::KeySequence.new(CTRL+Key_S), self, "save" )
+ fileSaveAction = TQt::Action.new(
+ "Save Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_save.xpm" )),
+ "&Save", TQt::KeySequence.new(CTRL+Key_S), self, "save" )
connect( fileSaveAction, SIGNAL( 'activated()' ), self, SLOT( 'fileSave()' ) )
- fileSaveAsAction = Qt::Action.new(
- "Save Chart As", Qt::IconSet.new(Qt::Pixmap.new( "images/file_save.xpm" )),
- "Save &As...", Qt::KeySequence.new(0), self, "save as" )
+ fileSaveAsAction = TQt::Action.new(
+ "Save Chart As", TQt::IconSet.new(TQt::Pixmap.new( "images/file_save.xpm" )),
+ "Save &As...", TQt::KeySequence.new(0), self, "save as" )
connect( fileSaveAsAction, SIGNAL( 'activated()' ),
self, SLOT( 'fileSaveAs()' ) )
- fileSaveAsPixmapAction = Qt::Action.new(
- "Save Chart As Bitmap", Qt::IconSet.new(Qt::Pixmap.new( "images/file_save.xpm" )),
- "Save As &Bitmap...", Qt::KeySequence.new(CTRL+Key_B), self, "save as bitmap" )
+ fileSaveAsPixmapAction = TQt::Action.new(
+ "Save Chart As Bitmap", TQt::IconSet.new(TQt::Pixmap.new( "images/file_save.xpm" )),
+ "Save As &Bitmap...", TQt::KeySequence.new(CTRL+Key_B), self, "save as bitmap" )
connect( fileSaveAsPixmapAction, SIGNAL( 'activated()' ),
self, SLOT( 'fileSaveAsPixmap()' ) )
- filePrintAction = Qt::Action.new(
- "Print Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/file_print.xpm" )),
- "&Print Chart...", Qt::KeySequence.new(CTRL+Key_P), self, "print chart" )
+ filePrintAction = TQt::Action.new(
+ "Print Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/file_print.xpm" )),
+ "&Print Chart...", TQt::KeySequence.new(CTRL+Key_P), self, "print chart" )
connect( filePrintAction, SIGNAL( 'activated()' ),
self, SLOT( 'filePrint()' ) )
- optionsSetDataAction = Qt::Action.new(
- "Set Data", Qt::IconSet.new(Qt::Pixmap.new( "images/options_setdata.xpm" )),
- "Set &Data...", Qt::KeySequence.new(CTRL+Key_D), self, "set data" )
+ optionsSetDataAction = TQt::Action.new(
+ "Set Data", TQt::IconSet.new(TQt::Pixmap.new( "images/options_setdata.xpm" )),
+ "Set &Data...", TQt::KeySequence.new(CTRL+Key_D), self, "set data" )
connect( optionsSetDataAction, SIGNAL( 'activated()' ),
self, SLOT( 'optionsSetData()' ) )
- chartGroup = Qt::ActionGroup.new( self ) # Connected later
+ chartGroup = TQt::ActionGroup.new( self ) # Connected later
chartGroup.setExclusive( true )
- @optionsPieChartAction = Qt::Action.new(
- "Pie Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/options_piechart.xpm" )),
- "&Pie Chart", Qt::KeySequence.new(CTRL+Key_I), chartGroup, "pie chart" )
+ @optionsPieChartAction = TQt::Action.new(
+ "Pie Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/options_piechart.xpm" )),
+ "&Pie Chart", TQt::KeySequence.new(CTRL+Key_I), chartGroup, "pie chart" )
@optionsPieChartAction.setToggleAction( true )
- @optionsHorizontalBarChartAction = Qt::Action.new(
- "Horizontal Bar Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/options_horizontalbarchart.xpm" )),
- "&Horizontal Bar Chart", Qt::KeySequence.new(CTRL+Key_H), chartGroup,
+ @optionsHorizontalBarChartAction = TQt::Action.new(
+ "Horizontal Bar Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/options_horizontalbarchart.xpm" )),
+ "&Horizontal Bar Chart", TQt::KeySequence.new(CTRL+Key_H), chartGroup,
"horizontal bar chart" )
@optionsHorizontalBarChartAction.setToggleAction( true )
- @optionsVerticalBarChartAction = Qt::Action.new(
- "Vertical Bar Chart", Qt::IconSet.new(Qt::Pixmap.new( "images/options_verticalbarchart.xpm" )),
- "&Vertical Bar Chart", Qt::KeySequence.new(CTRL+Key_V), chartGroup, "Vertical bar chart" )
+ @optionsVerticalBarChartAction = TQt::Action.new(
+ "Vertical Bar Chart", TQt::IconSet.new(TQt::Pixmap.new( "images/options_verticalbarchart.xpm" )),
+ "&Vertical Bar Chart", TQt::KeySequence.new(CTRL+Key_V), chartGroup, "Vertical bar chart" )
@optionsVerticalBarChartAction.setToggleAction( true )
- optionsSetFontAction = Qt::Action.new(
- "Set Font", Qt::IconSet.new(Qt::Pixmap.new( "images/options_setfont.xpm" )),
- "Set &Font...", Qt::KeySequence.new(CTRL+Key_F), self, "set font" )
+ optionsSetFontAction = TQt::Action.new(
+ "Set Font", TQt::IconSet.new(TQt::Pixmap.new( "images/options_setfont.xpm" )),
+ "Set &Font...", TQt::KeySequence.new(CTRL+Key_F), self, "set font" )
connect( optionsSetFontAction, SIGNAL( 'activated()' ),
self, SLOT( 'optionsSetFont()' ) )
- optionsSetOptionsAction = Qt::Action.new(
- "Set Options", Qt::IconSet.new(Qt::Pixmap.new( "images/options_setoptions.xpm" )),
- "Set &Options...", Qt::KeySequence.new(0), self, "set options" )
+ optionsSetOptionsAction = TQt::Action.new(
+ "Set Options", TQt::IconSet.new(TQt::Pixmap.new( "images/options_setoptions.xpm" )),
+ "Set &Options...", TQt::KeySequence.new(0), self, "set options" )
connect( optionsSetOptionsAction, SIGNAL( 'activated()' ),
self, SLOT( 'optionsSetOptions()' ) )
- fileQuitAction = Qt::Action.new( "Quit", "&Quit", Qt::KeySequence.new(CTRL+Key_Q), self, "quit" )
+ fileQuitAction = TQt::Action.new( "Quit", "&Quit", TQt::KeySequence.new(CTRL+Key_Q), self, "quit" )
connect( fileQuitAction, SIGNAL( 'activated()' ), self, SLOT( 'fileQuit()' ) )
- fileTools = Qt::ToolBar.new( self, "file operations" )
+ fileTools = TQt::ToolBar.new( self, "file operations" )
fileTools.setLabel( "File Operations" )
fileNewAction.addTo( fileTools )
fileOpenAction.addTo( fileTools )
@@ -123,7 +123,7 @@ class ChartForm < Qt::MainWindow
fileTools.addSeparator()
filePrintAction.addTo( fileTools )
- optionsTools = Qt::ToolBar.new( self, "options operations" )
+ optionsTools = TQt::ToolBar.new( self, "options operations" )
optionsTools.setLabel( "Options Operations" )
optionsSetDataAction.addTo( optionsTools )
optionsTools.addSeparator()
@@ -135,7 +135,7 @@ class ChartForm < Qt::MainWindow
optionsTools.addSeparator()
optionsSetOptionsAction.addTo( optionsTools )
- @fileMenu = Qt::PopupMenu.new( self )
+ @fileMenu = TQt::PopupMenu.new( self )
menuBar().insertItem( "&File", @fileMenu )
fileNewAction.addTo( @fileMenu )
fileOpenAction.addTo( @fileMenu )
@@ -148,7 +148,7 @@ class ChartForm < Qt::MainWindow
@fileMenu.insertSeparator()
fileQuitAction.addTo( @fileMenu )
- @optionsMenu = Qt::PopupMenu.new( self )
+ @optionsMenu = TQt::PopupMenu.new( self )
menuBar().insertItem( "&Options", @optionsMenu )
optionsSetDataAction.addTo( @optionsMenu )
@optionsMenu.insertSeparator()
@@ -162,9 +162,9 @@ class ChartForm < Qt::MainWindow
menuBar().insertSeparator()
- helpMenu = Qt::PopupMenu.new( self )
+ helpMenu = TQt::PopupMenu.new( self )
menuBar().insertItem( "&Help", helpMenu )
- helpMenu.insertItem( "&Help", self, SLOT('helpHelp()'), Qt::KeySequence.new(Key_F1) )
+ helpMenu.insertItem( "&Help", self, SLOT('helpHelp()'), TQt::KeySequence.new(Key_F1) )
helpMenu.insertItem( "&About", self, SLOT('helpAbout()') )
helpMenu.insertItem( "About &Qt", self, SLOT('helpAboutQt()') )
@@ -172,8 +172,8 @@ class ChartForm < Qt::MainWindow
@printer = nil
@elements = Array.new(MAX_ELEMENTS)
- settings = Qt::Settings.new
- settings.insertSearchPath( Qt::Settings::Windows, WINDOWS_REGISTRY )
+ settings = TQt::Settings.new
+ settings.insertSearchPath( TQt::Settings::Windows, WINDOWS_REGISTRY )
windowWidth = settings.readNumEntry( APP_KEY + "WindowWidth", 460 )
windowHeight = settings.readNumEntry( APP_KEY + "WindowHeight", 530 )
windowX = settings.readNumEntry( APP_KEY + "WindowX", -1 )
@@ -181,7 +181,7 @@ class ChartForm < Qt::MainWindow
setChartType( settings.readNumEntry( APP_KEY + "ChartType", PIE ) )
@addValues = settings.readNumEntry( APP_KEY + "AddValues", NO )
@decimalPlaces = settings.readNumEntry( APP_KEY + "Decimals", 2 )
- @font = Qt::Font.new( "Helvetica", 18, Qt::Font::Bold )
+ @font = TQt::Font.new( "Helvetica", 18, TQt::Font::Bold )
@font.fromString(
settings.readEntry( APP_KEY + "Font", @font.toString() ) )
@recentFiles = []
@@ -198,15 +198,15 @@ class ChartForm < Qt::MainWindow
# Connect *after* we've set the chart type on so we don't call
# drawElements() prematurely.
- connect( chartGroup, SIGNAL( 'selected(QAction*)' ),
- self, SLOT( 'updateChartType(QAction*)' ) )
+ connect( chartGroup, SIGNAL( 'selected(TQAction*)' ),
+ self, SLOT( 'updateChartType(TQAction*)' ) )
resize( windowWidth, windowHeight )
if windowX != -1 || windowY != -1
move( windowX, windowY )
end
- @canvas = Qt::Canvas.new( self )
+ @canvas = TQt::Canvas.new( self )
@canvas.resize( width(), height() )
@canvasView = CanvasView.new( @canvas, @elements, self )
setCentralWidget( @canvasView )
@@ -250,7 +250,7 @@ class ChartForm < Qt::MainWindow
x = (i.to_f / MAX_ELEMENTS) * 360
y = ((x * 256) % 105) + 151
z = ((i * 17) % 105) + 151;
- @elements[i] = Element.new( Element::INVALID, Qt::Color.new( x, y, z, Qt::Color::Hsv ) )
+ @elements[i] = Element.new( Element::INVALID, TQt::Color.new( x, y, z, TQt::Color::Hsv ) )
end
end
@@ -272,7 +272,7 @@ class ChartForm < Qt::MainWindow
return
end
- filename = Qt::FileDialog.getOpenFileName(
+ filename = TQt::FileDialog.getOpenFileName(
nil, "Charts (*.cht)", self,
"file open", "Chart -- File Open" )
if !filename.nil?
@@ -284,13 +284,13 @@ class ChartForm < Qt::MainWindow
def fileSaveAs()
- filename = Qt::FileDialog.getSaveFileName(
+ filename = TQt::FileDialog.getSaveFileName(
nil, "Charts (*.cht)", self,
"file save as", "Chart -- File Save As" )
if !filename.nil?
answer = 0
- if Qt::File.exists( filename )
- answer = Qt::MessageBox.warning(
+ if TQt::File.exists( filename )
+ answer = TQt::MessageBox.warning(
self, "Chart -- Overwrite File",
"Overwrite\n\'#{filename}\'?",
"&Yes", "&No", nil, 1, 1 )
@@ -337,7 +337,7 @@ class ChartForm < Qt::MainWindow
if i < @recentFiles.length()
@fileMenu.insertItem( "&%d %s" % [i + 1, @recentFiles[i]],
self, SLOT( 'fileOpenRecent(int)' ),
- Qt::KeySequence.new(0), i )
+ TQt::KeySequence.new(0), i )
end
end
end
@@ -360,7 +360,7 @@ class ChartForm < Qt::MainWindow
end
msg += "has been changed."
- x = Qt::MessageBox.information( self, "Chart -- Unsaved Changes",
+ x = TQt::MessageBox.information( self, "Chart -- Unsaved Changes",
msg, "&Save", "Cancel", "&Abandon",
0, 1 )
case x
@@ -377,8 +377,8 @@ class ChartForm < Qt::MainWindow
def saveOptions()
- settings = Qt::Settings.new
- settings.insertSearchPath( Qt::Settings::Windows, WINDOWS_REGISTRY )
+ settings = TQt::Settings.new
+ settings.insertSearchPath( TQt::Settings::Windows, WINDOWS_REGISTRY )
settings.writeEntry( APP_KEY + "WindowWidth", width() )
settings.writeEntry( APP_KEY + "WindowHeight", height() )
settings.writeEntry( APP_KEY + "WindowX", x() )
@@ -430,8 +430,8 @@ class ChartForm < Qt::MainWindow
def optionsSetFont()
- ok = Qt::Boolean.new
- font = Qt::FontDialog.getFont( ok, @font, self )
+ ok = TQt::Boolean.new
+ font = TQt::FontDialog.getFont( ok, @font, self )
if !ok.nil?
@font = font
drawElements()
@@ -474,14 +474,14 @@ class ChartForm < Qt::MainWindow
def helpAbout()
- Qt::MessageBox.about( self, "Chart -- About",
+ TQt::MessageBox.about( self, "Chart -- About",
"<center><h1><font color=blue>Chart<font></h1></center>" +
"<p>Chart your data with <i>chart</i>.</p>" )
end
def helpAboutQt()
- Qt::MessageBox.aboutQt( self, "Chart -- About Qt" )
+ TQt::MessageBox.aboutQt( self, "Chart -- About Qt" )
end
end
diff --git a/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb b/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb
index 86c66f76..e97d542f 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/chartform_canvas.rb
@@ -64,11 +64,11 @@ class ChartForm
for i in 0...MAX_ELEMENTS
if @elements[i].isValid()
extent = scales[i]
- arc = Qt::CanvasEllipse.new( size, size, angle, extent, @canvas )
+ arc = TQt::CanvasEllipse.new( size, size, angle, extent, @canvas )
arc.setX( x )
arc.setY( y )
arc.setZ( 0 )
- arc.setBrush( Qt::Brush.new( @elements[i].valueColor(),
+ arc.setBrush( TQt::Brush.new( @elements[i].valueColor(),
@elements[i].valuePattern() ) )
arc.show()
angle += extent
@@ -109,15 +109,15 @@ class ChartForm
height = @canvas.height().to_f
prowidth = width / count
x = 0
- pen = Qt::Pen.new
+ pen = TQt::Pen.new
pen.style = NoPen
for i in 0...MAX_ELEMENTS
if @elements[i].isValid()
extent = scales[i]
y = height - extent
- rect = Qt::CanvasRectangle.new(x, y, prowidth, extent, @canvas )
- rect.setBrush( Qt::Brush.new( @elements[i].valueColor(),
+ rect = TQt::CanvasRectangle.new(x, y, prowidth, extent, @canvas )
+ rect.setBrush( TQt::Brush.new( @elements[i].valueColor(),
@elements[i].valuePattern() ) )
rect.setPen( pen )
rect.setZ( 0 )
@@ -151,14 +151,14 @@ class ChartForm
height = @canvas.height().to_f
proheight = height / count
y = 0
- pen = Qt::Pen.new
+ pen = TQt::Pen.new
pen.style = NoPen
for i in 0...MAX_ELEMENTS
if @elements[i].isValid()
extent = scales[i]
- rect = Qt::CanvasRectangle.new(0, y, extent, proheight, @canvas )
- rect.setBrush( Qt::Brush.new( @elements[i].valueColor(),
+ rect = TQt::CanvasRectangle.new(0, y, extent, proheight, @canvas )
+ rect.setBrush( TQt::Brush.new( @elements[i].valueColor(),
@elements[i].valuePattern() ) )
rect.setPen( pen )
rect.setZ( 0 )
diff --git a/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb b/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb
index 648aba62..3063bb07 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/chartform_files.rb
@@ -1,15 +1,15 @@
class ChartForm
def load( filename )
- file = Qt::File.new( filename )
- if !file.open( Qt::IO_ReadOnly )
+ file = TQt::File.new( filename )
+ if !file.open( TQt::IO_ReadOnly )
statusBar().message( "Failed to load \'%s\'" % filename, 2000 )
return
end
init() # Make sure we have colours
@filename = filename
- ts = Qt::TextStream.new( file )
+ ts = TQt::TextStream.new( file )
errors = 0
i = 0
while !ts.eof()
@@ -52,12 +52,12 @@ class ChartForm
return
end
- file = Qt::File.new( @filename )
- if !file.open( Qt::IO_WriteOnly )
+ file = TQt::File.new( @filename )
+ if !file.open( TQt::IO_WriteOnly )
statusBar().message( "Failed to save \'%s\'" % @filename, 2000 )
return
end
- ts = Qt::TextStream.new( file )
+ ts = TQt::TextStream.new( file )
for i in 0...MAX_ELEMENTS
if @elements[i].isValid()
ts << @elements[i]
@@ -73,10 +73,10 @@ class ChartForm
def fileSaveAsPixmap()
- filename = Qt::FileDialog.getSaveFileName(nil, "Images (*.png *.xpm *.jpg)",
+ filename = TQt::FileDialog.getSaveFileName(nil, "Images (*.png *.xpm *.jpg)",
self, "file save as bitmap",
"Chart -- File Save As Bitmap" )
- if Qt::Pixmap.grabWidget( @canvasView ).save( filename,
+ if TQt::Pixmap.grabWidget( @canvasView ).save( filename,
filename.sub(/.*\.([^.]*)$/, '\1').upcase() )
statusBar().message( "Wrote \'%s\'" % filename, 2000 )
else
@@ -86,11 +86,11 @@ class ChartForm
def filePrint()
if !@printer
- @printer = Qt::Printer.new
+ @printer = TQt::Printer.new
end
if @printer.setup()
- painter = Qt::Painter.new( @printer )
- @canvas.drawArea( Qt::Rect.new( 0, 0, @canvas.width(), @canvas.height() ),
+ painter = TQt::Painter.new( @printer )
+ @canvas.drawArea( TQt::Rect.new( 0, 0, @canvas.width(), @canvas.height() ),
painter, false )
if !@printer.outputFileName().empty?
statusBar().message( "Printed \'%s\'" % @printer.outputFileName(), 2000 )
diff --git a/qtruby/rubylib/examples/qt-examples/chart/element.rb b/qtruby/rubylib/examples/qt-examples/chart/element.rb
index ba135632..bc6c0d51 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/element.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/element.rb
@@ -12,10 +12,10 @@ class Element
attr_accessor :value, :valueColor, :valuePattern, :label, :labelColor
- def initialize( value = INVALID, valueColor = Qt::gray,
- valuePattern = Qt::SolidPattern,
+ def initialize( value = INVALID, valueColor = TQt::gray,
+ valuePattern = TQt::SolidPattern,
label = nil,
- labelColor = Qt::black )
+ labelColor = TQt::black )
init( value, valueColor, valuePattern, label, labelColor )
@propoints = []
for i in 0...MAX_PROPOINTS * 2
@@ -30,24 +30,24 @@ class Element
label, labelColor )
@value = value
@valueColor = valueColor
- if Qt::SolidPattern >= valuePattern || Qt::DiagCrossPattern <= valuePattern
- valuePattern = Qt::SolidPattern
+ if TQt::SolidPattern >= valuePattern || TQt::DiagCrossPattern <= valuePattern
+ valuePattern = TQt::SolidPattern
end
@valuePattern = valuePattern
@label = label
@labelColor = labelColor
end
- def set( value = INVALID, valueColor = Qt::gray,
- valuePattern = Qt::SolidPattern,
+ def set( value = INVALID, valueColor = TQt::gray,
+ valuePattern = TQt::SolidPattern,
label = nil,
- labelColor = Qt::black )
+ labelColor = TQt::black )
init( value, valueColor, valuePattern, label, labelColor )
end
def setValuePattern( valuePattern )
- if valuePattern < Qt::SolidPattern.to_i || valuePattern > Qt::DiagCrossPattern.to_i
- valuePattern = Qt::SolidPattern
+ if valuePattern < TQt::SolidPattern.to_i || valuePattern > TQt::DiagCrossPattern.to_i
+ valuePattern = TQt::SolidPattern
end
@valuePattern = valuePattern
end
@@ -74,7 +74,7 @@ class Element
end
-class Qt::TextStream
+class TQt::TextStream
alias op_write <<
@@ -117,7 +117,7 @@ class Qt::TextStream
if value.nil?
errors += 1
end
- valueColor = Qt::Color.new( fields[1] )
+ valueColor = TQt::Color.new( fields[1] )
if !valueColor.isValid()
errors += 1
end
@@ -125,7 +125,7 @@ class Qt::TextStream
if valuePattern.nil?
errors += 1
end
- labelColor = Qt::Color.new( fields[3] )
+ labelColor = TQt::Color.new( fields[3] )
if !labelColor.isValid()
errors += 1
end
diff --git a/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk b/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk
index d9087b48..89d6ff9f 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk
+++ b/qtruby/rubylib/examples/qt-examples/chart/images/chart-forms.sk
@@ -84,7 +84,7 @@ le()
lw(1)
Fn('Helvetica-Narrow-Bold')
Fs(18)
-txt('QCanvas',(580.906,-614.774))
+txt('TQCanvas',(580.906,-614.774))
G_()
lw(1.41732)
la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1))
diff --git a/qtruby/rubylib/examples/qt-examples/chart/main.rb b/qtruby/rubylib/examples/qt-examples/chart/main.rb
index db395a3e..4c5c9a91 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/main.rb
@@ -1,15 +1,15 @@
-require 'Qt'
+retquire 'Qt'
-require 'canvasview.rb'
-require 'canvastext.rb'
-require 'element.rb'
-require 'chartform.rb'
-require 'chartform_canvas.rb'
-require 'chartform_files.rb'
-require 'optionsform.rb'
-require 'setdataform.rb'
+retquire 'canvasview.rb'
+retquire 'canvastext.rb'
+retquire 'element.rb'
+retquire 'chartform.rb'
+retquire 'chartform_canvas.rb'
+retquire 'chartform_files.rb'
+retquire 'optionsform.rb'
+retquire 'setdataform.rb'
-app = Qt::Application.new( ARGV )
+app = TQt::Application.new( ARGV )
if app.ARGV.length > 0
filename = app.ARGV[0]
diff --git a/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb b/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb
index 6b2eeac4..35c2aea8 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/optionsform.rb
@@ -1,4 +1,4 @@
-class OptionsForm < Qt::Dialog
+class OptionsForm < TQt::Dialog
slots 'chooseFont()'
attr_reader :chartTypeComboBox,
@@ -14,65 +14,65 @@ class OptionsForm < Qt::Dialog
setCaption( "Chart -- Options" )
resize( 320, 290 )
- @optionsFormLayout = Qt::VBoxLayout.new( self, 11, 6 )
+ @optionsFormLayout = TQt::VBoxLayout.new( self, 11, 6 )
- @chartTypeLayout = Qt::HBoxLayout.new( nil, 0, 6 )
+ @chartTypeLayout = TQt::HBoxLayout.new( nil, 0, 6 )
- @chartTypeTextLabel = Qt::Label.new( "&Chart Type", self )
+ @chartTypeTextLabel = TQt::Label.new( "&Chart Type", self )
@chartTypeLayout.addWidget( @chartTypeTextLabel )
- @chartTypeComboBox = Qt::ComboBox.new( false, self )
- @chartTypeComboBox.insertItem( Qt::Pixmap.new( "images/options_piechart.xpm" ), "Pie Chart" )
- @chartTypeComboBox.insertItem( Qt::Pixmap.new( "images/options_verticalbarchart.xpm" ),
+ @chartTypeComboBox = TQt::ComboBox.new( false, self )
+ @chartTypeComboBox.insertItem( TQt::Pixmap.new( "images/options_piechart.xpm" ), "Pie Chart" )
+ @chartTypeComboBox.insertItem( TQt::Pixmap.new( "images/options_verticalbarchart.xpm" ),
"Vertical Bar Chart" )
- @chartTypeComboBox.insertItem( Qt::Pixmap.new( "images/options_horizontalbarchart.xpm" ),
+ @chartTypeComboBox.insertItem( TQt::Pixmap.new( "images/options_horizontalbarchart.xpm" ),
"Horizontal Bar Chart" )
@chartTypeLayout.addWidget( @chartTypeComboBox )
@optionsFormLayout.addLayout( @chartTypeLayout )
- @fontLayout = Qt::HBoxLayout.new( nil, 0, 6 )
+ @fontLayout = TQt::HBoxLayout.new( nil, 0, 6 )
- @fontPushButton = Qt::PushButton.new( "&Font...", self )
+ @fontPushButton = TQt::PushButton.new( "&Font...", self )
@fontLayout.addWidget( @fontPushButton )
- @spacer = Qt::SpacerItem.new( 0, 0, Qt::SizePolicy::Expanding,
- Qt::SizePolicy::Minimum )
+ @spacer = TQt::SpacerItem.new( 0, 0, TQt::SizePolicy::Expanding,
+ TQt::SizePolicy::Minimum )
@fontLayout.addItem( @spacer )
- @fontTextLabel = Qt::Label.new( self ) # Must be set by caller via setFont()
+ @fontTextLabel = TQt::Label.new( self ) # Must be set by caller via setFont()
@fontLayout.addWidget( @fontTextLabel )
@optionsFormLayout.addLayout( @fontLayout )
- @addValuesFrame = Qt::Frame.new( self )
- @addValuesFrame.setFrameShape( Qt::Frame::StyledPanel )
- @addValuesFrame.setFrameShadow( Qt::Frame::Sunken )
- @addValuesFrameLayout = Qt::VBoxLayout.new( @addValuesFrame, 11, 6 )
+ @addValuesFrame = TQt::Frame.new( self )
+ @addValuesFrame.setFrameShape( TQt::Frame::StyledPanel )
+ @addValuesFrame.setFrameShadow( TQt::Frame::Sunken )
+ @addValuesFrameLayout = TQt::VBoxLayout.new( @addValuesFrame, 11, 6 )
- @addValuesButtonGroup = Qt::ButtonGroup.new( "Show Values", @addValuesFrame )
- @addValuesButtonGroup.setColumnLayout(0, Qt::Vertical )
+ @addValuesButtonGroup = TQt::ButtonGroup.new( "Show Values", @addValuesFrame )
+ @addValuesButtonGroup.setColumnLayout(0, TQt::Vertical )
@addValuesButtonGroup.layout().setSpacing( 6 )
@addValuesButtonGroup.layout().setMargin( 11 )
- @addValuesButtonGroupLayout = Qt::VBoxLayout.new(
+ @addValuesButtonGroupLayout = TQt::VBoxLayout.new(
@addValuesButtonGroup.layout() )
- @addValuesButtonGroupLayout.setAlignment( Qt::AlignTop )
+ @addValuesButtonGroupLayout.setAlignment( TQt::AlignTop )
- @noRadioButton = Qt::RadioButton.new( "&No", @addValuesButtonGroup )
+ @noRadioButton = TQt::RadioButton.new( "&No", @addValuesButtonGroup )
@noRadioButton.setChecked( true )
@addValuesButtonGroupLayout.addWidget( @noRadioButton )
- @yesRadioButton = Qt::RadioButton.new( "&Yes", @addValuesButtonGroup )
+ @yesRadioButton = TQt::RadioButton.new( "&Yes", @addValuesButtonGroup )
@addValuesButtonGroupLayout.addWidget( @yesRadioButton )
- @asPercentageRadioButton = Qt::RadioButton.new( "As &Percentage",
+ @asPercentageRadioButton = TQt::RadioButton.new( "As &Percentage",
@addValuesButtonGroup )
@addValuesButtonGroupLayout.addWidget( @asPercentageRadioButton )
@addValuesFrameLayout.addWidget( @addValuesButtonGroup )
- @decimalPlacesLayout = Qt::HBoxLayout.new( nil, 0, 6 )
+ @decimalPlacesLayout = TQt::HBoxLayout.new( nil, 0, 6 )
- @decimalPlacesTextLabel = Qt::Label.new( "&Decimal Places", @addValuesFrame )
+ @decimalPlacesTextLabel = TQt::Label.new( "&Decimal Places", @addValuesFrame )
@decimalPlacesLayout.addWidget( @decimalPlacesTextLabel )
- @decimalPlacesSpinBox = Qt::SpinBox.new( @addValuesFrame )
+ @decimalPlacesSpinBox = TQt::SpinBox.new( @addValuesFrame )
@decimalPlacesSpinBox.setMinValue( 0 )
@decimalPlacesSpinBox.setMaxValue( 9 )
@decimalPlacesLayout.addWidget( @decimalPlacesSpinBox )
@@ -81,16 +81,16 @@ class OptionsForm < Qt::Dialog
@optionsFormLayout.addWidget( @addValuesFrame )
- @buttonsLayout = Qt::HBoxLayout.new( nil, 0, 6 )
- @spacer = Qt::SpacerItem.new( 0, 0,
- Qt::SizePolicy::Expanding, Qt::SizePolicy::Minimum )
+ @buttonsLayout = TQt::HBoxLayout.new( nil, 0, 6 )
+ @spacer = TQt::SpacerItem.new( 0, 0,
+ TQt::SizePolicy::Expanding, TQt::SizePolicy::Minimum )
@buttonsLayout.addItem( @spacer )
- @okPushButton = Qt::PushButton.new( "OK", self )
+ @okPushButton = TQt::PushButton.new( "OK", self )
@okPushButton.setDefault( true )
@buttonsLayout.addWidget( @okPushButton )
- @cancelPushButton = Qt::PushButton.new( "Cancel", self )
+ @cancelPushButton = TQt::PushButton.new( "Cancel", self )
@buttonsLayout.addWidget( @cancelPushButton )
@optionsFormLayout.addLayout( @buttonsLayout )
@@ -104,8 +104,8 @@ class OptionsForm < Qt::Dialog
def chooseFont()
- ok = Qt::Boolean.new
- font = Qt::FontDialog.getFont( ok, @font, self )
+ ok = TQt::Boolean.new
+ font = TQt::FontDialog.getFont( ok, @font, self )
if !ok.nil?
setFont( font )
end
diff --git a/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb b/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb
index 81a9403b..3f361061 100644
--- a/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb
+++ b/qtruby/rubylib/examples/qt-examples/chart/setdataform.rb
@@ -1,4 +1,4 @@
-class SetDataForm < Qt::Dialog
+class SetDataForm < TQt::Dialog
slots 'setColor()',
'setChosenColor( int, int )',
@@ -20,9 +20,9 @@ class SetDataForm < Qt::Dialog
setCaption( "Chart -- Set Data" )
resize( 540, 440 )
- @tableButtonBox = Qt::VBoxLayout.new( self, 11, 6, "@table button box layout" )
+ @tableButtonBox = TQt::VBoxLayout.new( self, 11, 6, "@table button box layout" )
- @table = Qt::Table.new( self, "data @table" )
+ @table = TQt::Table.new( self, "data @table" )
@table.setNumCols( 5 )
@table.setNumRows( ChartForm::MAX_ELEMENTS )
@table.setColumnReadOnly( 1, true )
@@ -41,30 +41,30 @@ class SetDataForm < Qt::Dialog
th.setLabel( 4, "Color" )
@tableButtonBox.addWidget( @table )
- @buttonBox = Qt::HBoxLayout.new( nil, 0, 6, "button box layout" )
+ @buttonBox = TQt::HBoxLayout.new( nil, 0, 6, "button box layout" )
- @colorPushButton = Qt::PushButton.new( self, "color button" )
+ @colorPushButton = TQt::PushButton.new( self, "color button" )
@colorPushButton.setText( "&Color..." )
@colorPushButton .setEnabled( false )
@buttonBox.addWidget( @colorPushButton )
- spacer = Qt::SpacerItem.new( 0, 0, Qt::SizePolicy::Expanding,
- Qt::SizePolicy::Minimum )
+ spacer = TQt::SpacerItem.new( 0, 0, TQt::SizePolicy::Expanding,
+ TQt::SizePolicy::Minimum )
@buttonBox.addItem( spacer )
- okPushButton = Qt::PushButton.new( self, "ok button" )
+ okPushButton = TQt::PushButton.new( self, "ok button" )
okPushButton.setText( "OK" )
okPushButton.setDefault( true )
@buttonBox.addWidget( okPushButton )
- cancelPushButton = Qt::PushButton.new( self, "cancel button" )
+ cancelPushButton = TQt::PushButton.new( self, "cancel button" )
cancelPushButton.setText( "Cancel" )
- cancelPushButton.setAccel( Qt::KeySequence.new(Key_Escape) )
+ cancelPushButton.setAccel( TQt::KeySequence.new(Key_Escape) )
@buttonBox.addWidget( cancelPushButton )
@tableButtonBox.addLayout( @buttonBox )
- connect( @table, SIGNAL( 'clicked(int,int,int,const QPoint&)' ),
+ connect( @table, SIGNAL( 'clicked(int,int,int,const TQPoint&)' ),
self, SLOT( 'setChosenColor(int,int)' ) )
connect( @table, SIGNAL( 'currentChanged(int,int)' ),
self, SLOT( 'currentChanged(int,int)' ) )
@@ -75,23 +75,23 @@ class SetDataForm < Qt::Dialog
connect( cancelPushButton, SIGNAL( 'clicked()' ), self, SLOT( 'reject()' ) )
patterns = Array.new(MAX_PATTERNS)
- patterns[0] = Qt::Pixmap.new( "images/pattern01.xpm" )
- patterns[1] = Qt::Pixmap.new( "images/pattern02.xpm" )
- patterns[2] = Qt::Pixmap.new( "images/pattern03.xpm" )
- patterns[3] = Qt::Pixmap.new( "images/pattern04.xpm" )
- patterns[4] = Qt::Pixmap.new( "images/pattern05.xpm" )
- patterns[5] = Qt::Pixmap.new( "images/pattern06.xpm" )
- patterns[6] = Qt::Pixmap.new( "images/pattern07.xpm" )
- patterns[7] = Qt::Pixmap.new( "images/pattern08.xpm" )
- patterns[8] = Qt::Pixmap.new( "images/pattern09.xpm" )
- patterns[9] = Qt::Pixmap.new( "images/pattern10.xpm" )
- patterns[10] = Qt::Pixmap.new( "images/pattern11.xpm" )
- patterns[11] = Qt::Pixmap.new( "images/pattern12.xpm" )
- patterns[12] = Qt::Pixmap.new( "images/pattern13.xpm" )
- patterns[13] = Qt::Pixmap.new( "images/pattern14.xpm" )
+ patterns[0] = TQt::Pixmap.new( "images/pattern01.xpm" )
+ patterns[1] = TQt::Pixmap.new( "images/pattern02.xpm" )
+ patterns[2] = TQt::Pixmap.new( "images/pattern03.xpm" )
+ patterns[3] = TQt::Pixmap.new( "images/pattern04.xpm" )
+ patterns[4] = TQt::Pixmap.new( "images/pattern05.xpm" )
+ patterns[5] = TQt::Pixmap.new( "images/pattern06.xpm" )
+ patterns[6] = TQt::Pixmap.new( "images/pattern07.xpm" )
+ patterns[7] = TQt::Pixmap.new( "images/pattern08.xpm" )
+ patterns[8] = TQt::Pixmap.new( "images/pattern09.xpm" )
+ patterns[9] = TQt::Pixmap.new( "images/pattern10.xpm" )
+ patterns[10] = TQt::Pixmap.new( "images/pattern11.xpm" )
+ patterns[11] = TQt::Pixmap.new( "images/pattern12.xpm" )
+ patterns[12] = TQt::Pixmap.new( "images/pattern13.xpm" )
+ patterns[13] = TQt::Pixmap.new( "images/pattern14.xpm" )
rect = @table.cellRect( 0, 1 )
- pix = Qt::Pixmap.new( rect.width(), rect.height() )
+ pix = TQt::Pixmap.new( rect.width(), rect.height() )
for i in 0...ChartForm::MAX_ELEMENTS
element = @elements[i]
@@ -105,7 +105,7 @@ class SetDataForm < Qt::Dialog
@table.setPixmap( i, 1, pix )
@table.setText( i, 1, color.name() )
- combobox = Qt::ComboBox.new
+ combobox = TQt::ComboBox.new
for j in 0...MAX_PATTERNS
combobox.insertItem( patterns[j] )
end
@@ -151,8 +151,8 @@ class SetDataForm < Qt::Dialog
return
end
- color = Qt::ColorDialog.getColor(
- Qt::Color.new( @table.text( row, col ) ),
+ color = TQt::ColorDialog.getColor(
+ TQt::Color.new( @table.text( row, col ) ),
self, "color dialog" )
if color.isValid()
pix = @table.pixmap( row, col )
@@ -172,10 +172,10 @@ class SetDataForm < Qt::Dialog
else
element.value = Element::INVALID
end
- element.valueColor = Qt::Color.new( @table.text( i, 1 ) )
+ element.valueColor = TQt::Color.new( @table.text( i, 1 ) )
element.valuePattern = (@table.cellWidget( i, 2 )).currentItem() + 1
element.label = @table.text( i, 3 )
- element.labelColor = Qt::Color.new( @table.text( i, 4 ) )
+ element.labelColor = TQt::Color.new( @table.text( i, 4 ) )
end
super
diff --git a/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb b/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
index 8f67d9aa..3912c61b 100644
--- a/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
+++ b/qtruby/rubylib/examples/qt-examples/checklists/checklists.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class CheckLists < Qt::Widget
+class CheckLists < TQt::Widget
slots 'copy1to2()', 'copy2to3()'
# Constructor
@@ -9,18 +9,18 @@ class CheckLists < Qt::Widget
def initialize
super()
- lay = Qt::HBoxLayout.new(self)
+ lay = TQt::HBoxLayout.new(self)
lay.setMargin(5)
# create a widget which layouts its childs in a column
- vbox1 = Qt::VBoxLayout.new(lay)
+ vbox1 = TQt::VBoxLayout.new(lay)
vbox1.setMargin(5)
# First child: a Label
- vbox1.addWidget(Qt::Label.new('Check some items!', self))
+ vbox1.addWidget(TQt::Label.new('Check some items!', self))
# Second child: the ListView
- @lv1 = Qt::ListView.new(self)
+ @lv1 = TQt::ListView.new(self)
vbox1.addWidget(@lv1)
@lv1.addColumn('Items')
@lv1.setRootIsDecorated(true)
@@ -29,10 +29,10 @@ class CheckLists < Qt::Widget
parentList = Array.new
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 1'))
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 2'))
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 3'))
- parentList.push(Qt::ListViewItem.new(@lv1, 'Parent Item 4'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 1'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 2'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 3'))
+ parentList.push(TQt::ListViewItem.new(@lv1, 'Parent Item 4'))
item = 0
num = 1
@@ -42,51 +42,51 @@ class CheckLists < Qt::Widget
# ...and create 5 checkable child ListViewItems for each parent item
for i in 1..5
str = sprintf('%s. Child of Parent %s', i, num)
- Qt::CheckListItem.new(item, str, Qt::CheckListItem.CheckBox)
+ TQt::CheckListItem.new(item, str, TQt::CheckListItem.CheckBox)
end
num = num + 1
}
# Create another widget for layouting
- tmp = Qt::VBoxLayout.new(lay)
+ tmp = TQt::VBoxLayout.new(lay)
tmp.setMargin(5)
# create a pushbutton
- copy1 = Qt::PushButton.new(' -> ', self)
+ copy1 = TQt::PushButton.new(' -> ', self)
tmp.addWidget(copy1)
copy1.setMaximumWidth(copy1.sizeHint.width)
# connect the SIGNAL clicked() of the pushbutton with the SLOT copy1to2()
connect(copy1, SIGNAL('clicked()'), self, SLOT('copy1to2()'))
# another widget for layouting
- vbox2 = Qt::VBoxLayout.new(lay)
+ vbox2 = TQt::VBoxLayout.new(lay)
vbox2.setMargin(5)
# and another label
- vbox2.addWidget(Qt::Label.new('Check one item!', self))
+ vbox2.addWidget(TQt::Label.new('Check one item!', self))
# create the second listview
- @lv2 = Qt::ListView.new(self)
+ @lv2 = TQt::ListView.new(self)
vbox2.addWidget(@lv2)
@lv2.addColumn('Items')
@lv2.setRootIsDecorated(true)
# another widget needed for layouting only
- tmp = Qt::VBoxLayout.new(lay)
+ tmp = TQt::VBoxLayout.new(lay)
tmp.setMargin(5)
# create another pushbutton...
- copy2 = Qt::PushButton.new(' -> ', self)
+ copy2 = TQt::PushButton.new(' -> ', self)
lay.addWidget( copy2 )
copy2.setMaximumWidth(copy2.sizeHint.width)
# ...and connect its clicked() SIGNAL to the copy2to3() SLOT
connect(copy2, SIGNAL('clicked()'), self, SLOT('copy2to3()'))
- tmp = Qt::VBoxLayout.new(lay)
+ tmp = TQt::VBoxLayout.new(lay)
tmp.setMargin(5)
# and create a label which will be at the right of the window
- @label = Qt::Label.new('No Item yet...', self)
+ @label = TQt::Label.new('No Item yet...', self)
tmp.addWidget(@label)
end
@@ -96,10 +96,10 @@ class CheckLists < Qt::Widget
# the second one, and inserts them as Radio-ListViewItem.
def copy1to2
@lv2.clear
- it = Qt::ListViewItemIterator.new(@lv1)
+ it = TQt::ListViewItemIterator.new(@lv1)
# Insert first a controller Item into the second ListView. Always if Radio-ListViewItems
# are inserted into a Listview, the parent item of these MUST be a controller Item!
- item = Qt::CheckListItem.new(@lv2, 'Controller', Qt::CheckListItem::Controller );
+ item = TQt::CheckListItem.new(@lv2, 'Controller', TQt::CheckListItem::Controller );
item.setOpen(true);
# iterate through the first ListView...
@@ -109,7 +109,7 @@ class CheckLists < Qt::Widget
# ...if the item is checked...
if (it.current.isOn)
# ...insert a Radio-ListViewItem with the same text into the second ListView
- Qt::CheckListItem.new(item, it.current.text(0), Qt::CheckListItem::RadioButton)
+ TQt::CheckListItem.new(item, it.current.text(0), TQt::CheckListItem::RadioButton)
end
end
it += 1
@@ -127,7 +127,7 @@ class CheckLists < Qt::Widget
# Label at the right.
def copy2to3
# create an iterator which operates on the second ListView
- it = Qt::ListViewItemIterator.new(@lv2)
+ it = TQt::ListViewItemIterator.new(@lv2)
@label.setText('No Item checked')
diff --git a/qtruby/rubylib/examples/qt-examples/checklists/main.rb b/qtruby/rubylib/examples/qt-examples/checklists/main.rb
index 0c0e755c..14166acd 100755
--- a/qtruby/rubylib/examples/qt-examples/checklists/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/checklists/main.rb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
-require 'Qt'
+retquire 'Qt'
-require 'checklists'
+retquire 'checklists'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
checklists = CheckLists.new
checklists.resize(650, 350)
diff --git a/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb b/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb
index 6ac52c4c..8d5fcc2e 100644
--- a/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb
+++ b/qtruby/rubylib/examples/qt-examples/dclock/dclock.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class DigitalClock < Qt::LCDNumber
+class DigitalClock < TQt::LCDNumber
slots 'stopDate()', 'showTime()'
@@ -9,7 +9,7 @@ class DigitalClock < Qt::LCDNumber
super
@showingColon = false
- setFrameStyle(Qt::Frame.Panel | Qt::Frame.Raised)
+ setFrameStyle(TQt::Frame.Panel | TQt::Frame.Raised)
setLineWidth(2) # set frame line width
showTime # display the current time
@normalTimer = startTimer(500) # 1/2 second timer events
@@ -31,7 +31,7 @@ class DigitalClock < Qt::LCDNumber
# Enters date mode when the left mouse button is pressed.
def mousePressEvent (e)
- if (e.button == Qt::MouseEvent.LeftButton) # left button pressed
+ if (e.button == TQt::MouseEvent.LeftButton) # left button pressed
showDate
end
end
@@ -44,7 +44,7 @@ class DigitalClock < Qt::LCDNumber
def showTime
@showingColon = !@showingColon # toggle/blink colon
- s = Qt::Time.currentTime.toString[0..4]
+ s = TQt::Time.currentTime.toString[0..4]
if (!@showingColon)
s[2] = ' '
end
@@ -58,7 +58,7 @@ class DigitalClock < Qt::LCDNumber
if (@showDateTimer != -1) # already showing date
return
end
- date = Qt::Date.currentDate
+ date = TQt::Date.currentDate
s = sprintf('%2d %2d', date.month, date.day)
display(s) # sets the LCD number/text
@showDateTimer = startTimer(2000) # keep this state for 2 secs
diff --git a/qtruby/rubylib/examples/qt-examples/dclock/main.rb b/qtruby/rubylib/examples/qt-examples/dclock/main.rb
index c76ae55d..4d73dfea 100755
--- a/qtruby/rubylib/examples/qt-examples/dclock/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/dclock/main.rb
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
-require 'Qt'
-require 'dclock'
+retquire 'Qt'
+retquire 'dclock'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
clock = DigitalClock.new
clock.resize(170,80)
a.setMainWidget(clock)
diff --git a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb
index 9559a921..ec72b01c 100755
--- a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/main.rb
@@ -1,14 +1,14 @@
#!/usr/bin/env ruby
-require 'Qt'
-require 'viewer'
+retquire 'Qt'
+retquire 'viewer'
$KCODE='u'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
textViewer = Viewer.new
-textViewer.setCaption('QtRuby Example - Simple QFont Demo')
+textViewer.setCaption('QtRuby Example - Simple TQFont Demo')
a.setMainWidget(textViewer)
textViewer.show
a.exec()
diff --git a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb
index d9c16a62..feed96f0 100644
--- a/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb
+++ b/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo/viewer.rb
@@ -1,4 +1,4 @@
-class Viewer < Qt::Widget
+class Viewer < TQt::Widget
slots 'setDefault()', 'setSansSerif()', 'setItalics()'
def initialize
@@ -6,7 +6,7 @@ class Viewer < Qt::Widget
setFontSubstitutions
- codec = Qt::TextCodec::codecForName("utf8")
+ codec = TQt::TextCodec::codecForName("utf8")
# Shouldn't 'pack("U*")' for UTF-8 work here? - Richard
# The 'U' option packs each element into two bytes and doesn't work
@@ -15,36 +15,36 @@ class Viewer < Qt::Widget
greeting_ru = codec.toUnicode([0320, 0227, 0320, 0264, 0321, 0200, 0320, 0260, 0320, 0262, 0321, 0201, 0321, 0202, 0320, 0262, 0321, 0203, 0320, 0271, 0321, 0202, 0320, 0265].pack("C*"))
greeting_en = 'Hello'
- @greetings = Qt::TextView.new(self, 'textview')
+ @greetings = TQt::TextView.new(self, 'textview')
@greetings.setText(
greeting_en + "\n" +
greeting_ru + "\n" +
greeting_heb)
- @fontInfo = Qt::TextView.new(self, 'fontinfo')
+ @fontInfo = TQt::TextView.new(self, 'fontinfo')
setDefault
- @defaultButton = Qt::PushButton.new('Default', self, 'pushbutton1')
- @defaultButton.setFont(Qt::Font.new('times'))
+ @defaultButton = TQt::PushButton.new('Default', self, 'pushbutton1')
+ @defaultButton.setFont(TQt::Font.new('times'))
connect(@defaultButton, SIGNAL('clicked()'), self, SLOT('setDefault()'))
- @sansSerifButton = Qt::PushButton.new('Sans Serif', self, 'pushbutton2')
- @sansSerifButton.setFont(Qt::Font.new('Helvetica', 12))
+ @sansSerifButton = TQt::PushButton.new('Sans Serif', self, 'pushbutton2')
+ @sansSerifButton.setFont(TQt::Font.new('Helvetica', 12))
connect(@sansSerifButton, SIGNAL('clicked()'), self, SLOT('setSansSerif()'))
- @italicsButton = Qt::PushButton.new('Italics', self, 'pushbutton1')
- @italicsButton.setFont(Qt::Font.new('lucida', 12, Qt::Font.Bold, true))
+ @italicsButton = TQt::PushButton.new('Italics', self, 'pushbutton1')
+ @italicsButton.setFont(TQt::Font.new('lucida', 12, TQt::Font.Bold, true))
connect(@italicsButton, SIGNAL('clicked()'), self, SLOT('setItalics()'))
layout
end
def setDefault
- font = Qt::Font.new('Bavaria')
+ font = TQt::Font.new('Bavaria')
font.setPointSize(24)
- font.setWeight(Qt::Font.Bold)
+ font.setWeight(TQt::Font.Bold)
font.setUnderline(true)
@greetings.setFont(font)
@@ -52,17 +52,17 @@ class Viewer < Qt::Widget
end
def setSansSerif
- font = Qt::Font.new('Newyork', 18)
- font.setStyleHint(Qt::Font.SansSerif)
+ font = TQt::Font.new('Newyork', 18)
+ font.setStyleHint(TQt::Font.SansSerif)
@greetings.setFont(font)
showFontInfo(font)
end
def setItalics
- font = Qt::Font.new('Tokyo')
+ font = TQt::Font.new('Tokyo')
font.setPointSize(32)
- font.setWeight(Qt::Font.Bold)
+ font.setWeight(TQt::Font.Bold)
font.setItalic(true)
@greetings.setFont(font)
@@ -77,16 +77,16 @@ class Viewer < Qt::Widget
substitutes.push('Arabic Newspaper')
substitutes.push('crox')
- Qt::Font.insertSubstitutions('Bavaria', substitutes)
- Qt::Font.insertSubstitution('Tokyo', 'Lucida')
+ TQt::Font.insertSubstitutions('Bavaria', substitutes)
+ TQt::Font.insertSubstitution('Tokyo', 'Lucida')
end
def layout
- textViewContainer = Qt::HBoxLayout.new
+ textViewContainer = TQt::HBoxLayout.new
textViewContainer.addWidget(@greetings)
textViewContainer.addWidget(@fontInfo)
- buttonContainer = Qt::HBoxLayout.new
+ buttonContainer = TQt::HBoxLayout.new
buttonContainer.addWidget(@defaultButton)
buttonContainer.addWidget(@sansSerifButton)
buttonContainer.addWidget(@italicsButton)
@@ -105,7 +105,7 @@ class Viewer < Qt::Widget
@sansSerifButton.setFixedHeight(maxButtonHeight)
@italicsButton.setFixedHeight(maxButtonHeight)
- container = Qt::VBoxLayout.new(self)
+ container = TQt::VBoxLayout.new(self)
container.addLayout(textViewContainer)
container.addLayout(buttonContainer)
@@ -113,7 +113,7 @@ class Viewer < Qt::Widget
end
def showFontInfo (font)
- info = Qt::FontInfo.new(font)
+ info = TQt::FontInfo.new(font)
messageText =
'Font requested: "' +
font.family + '" ' +
@@ -122,7 +122,7 @@ class Viewer < Qt::Widget
info.family.to_s + '" ' +
info.pointSize.to_s + 'pt<P>'
- substitutions = Qt::Font.substitutes(font.family)
+ substitutions = TQt::Font.substitutes(font.family)
unless substitutions.size == 0
messageText = messageText + 'The following substitutions exist for ' +
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
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
diff --git a/qtruby/rubylib/examples/qt-examples/progress/progress.rb b/qtruby/rubylib/examples/qt-examples/progress/progress.rb
index 02116958..1469934e 100644
--- a/qtruby/rubylib/examples/qt-examples/progress/progress.rb
+++ b/qtruby/rubylib/examples/qt-examples/progress/progress.rb
@@ -1,13 +1,13 @@
#!/usr/bin/env ruby -w
-require 'Qt'
+retquire 'Qt'
-class AnimatedThingy < Qt::Label
+class AnimatedThingy < TQt::Label
attr_accessor :label, :step
attr_accessor :ox0, :oy0, :ox1, :oy1
attr_accessor :x0, :y0, :x1, :y1
attr_accessor :dx0, :dx1, :dy0, :dy1
- NQIX = 10
+ NTQIX = 10
def initialize(*k)
super(*k)
@@ -32,7 +32,7 @@ class AnimatedThingy < Qt::Label
end
def sizeHint
- Qt::Size.new(120,100)
+ TQt::Size.new(120,100)
end
def inc(x, dx, b)
@@ -48,13 +48,13 @@ class AnimatedThingy < Qt::Label
end
def timerEvent(e)
- p = Qt::Painter.new(self)
+ p = TQt::Painter.new(self)
pn = p.pen
pn.setWidth(2)
pn.setColor(backgroundColor)
p.setPen(pn)
- @step = (@step + 1) % NQIX
+ @step = (@step + 1) % NTQIX
p.drawLine(@ox0[@step], @oy0[@step], @ox1[@step], @oy1[@step])
@@ -67,8 +67,8 @@ class AnimatedThingy < Qt::Label
@ox1[@step] = @x1
@oy1[@step] = @y1
- c = Qt::Color.new
- c.setHsv( (@step*255)/NQIX, 255, 255 ) # rainbow effect
+ c = TQt::Color.new
+ c.setHsv( (@step*255)/NTQIX, 255, 255 ) # rainbow effect
pn.setColor(c)
pn.setWidth(2)
p.setPen(pn)
@@ -79,14 +79,14 @@ class AnimatedThingy < Qt::Label
end
def paintEvent(event)
- p = Qt::Painter.new(self)
+ p = TQt::Painter.new(self)
pn = p.pen()
pn.setWidth(2)
p.setPen(pn)
p.setClipRect(event.rect())
- 0.upto(NQIX-1) do |i|
- c = Qt::Color.new()
- c.setHsv( (i*255)/NQIX, 255, 255 ) # rainbow effect
+ 0.upto(NTQIX-1) do |i|
+ c = TQt::Color.new()
+ c.setHsv( (i*255)/NTQIX, 255, 255 ) # rainbow effect
pn.setColor(c)
p.setPen(pn)
p.drawLine(@ox0[i], @oy0[i], @ox1[i], @oy1[i])
@@ -97,7 +97,7 @@ class AnimatedThingy < Qt::Label
end
end
-class CPUWaster < Qt::Widget
+class CPUWaster < TQt::Widget
attr_accessor :menubar, :file, :options, :rects, :pb
attr_accessor :td_id , :ld_id, :dl_id, :cl_id, :md_id
attr_accessor :got_stop, :timer_driven, :default_label
@@ -110,10 +110,10 @@ class CPUWaster < Qt::Widget
def initialize(*k)
super(*k)
- @menubar = Qt::MenuBar.new(self, "menu")
+ @menubar = TQt::MenuBar.new(self, "menu")
@pb = nil
- @file = Qt::PopupMenu.new
+ @file = TQt::PopupMenu.new
@menubar.insertItem( "&File", file )
FIRST_DRAW_ITEM.upto(LAST_DRAW_ITEM) {
|i| file.insertItem( "#{drawItemRects(i)} Rectangles", i)
@@ -121,7 +121,7 @@ class CPUWaster < Qt::Widget
connect( menubar, SIGNAL('activated(int)'), self, SLOT('doMenuItem(int)') )
@file.insertSeparator
@file.insertItem("Quit", $qApp, SLOT('quit()'))
- @options = Qt::PopupMenu.new
+ @options = TQt::PopupMenu.new
@menubar.insertItem("&Options", options)
@td_id = options.insertItem("Timer driven", self, SLOT('timerDriven()'))
@ld_id = options.insertItem("Loop driven", self, SLOT('loopDriven()'))
@@ -189,26 +189,26 @@ class CPUWaster < Qt::Widget
@pb.setProgress( @pb.totalSteps - @rects ) if @rects % 100 == 0
@rects -= 1
- painter = Qt::Painter.new(self)
+ painter = TQt::Painter.new(self)
ww = width
wh = height
if ww > 8 and wh > 8
- c = Qt::Color.new(rand(255), rand(255), rand(255))
+ c = TQt::Color.new(rand(255), rand(255), rand(255))
x = rand(ww - 8)
y = rand(wh - 8)
w = rand(ww - x)
h = rand(wh - y)
- painter.fillRect(x, y, w, h, Qt::Brush.new(c))
+ painter.fillRect(x, y, w, h, TQt::Brush.new(c))
end
painter.end()
if @rects == 0 || @got_stop
@pb.setProgress(@pb.totalSteps)
- painter = Qt::Painter.new(self)
- painter.fillRect(0, 0, width(), height(), Qt::Brush.new(backgroundColor))
+ painter = TQt::Painter.new(self)
+ painter.fillRect(0, 0, width(), height(), TQt::Brush.new(backgroundColor))
painter.end()
enableDrawingItems(true)
killTimers()
@@ -217,7 +217,7 @@ class CPUWaster < Qt::Widget
end
def newProgressDialog(label, steps, modal)
- d = Qt::ProgressDialog.new(label, "Cancel", steps, self, "progress", modal)
+ d = TQt::ProgressDialog.new(label, "Cancel", steps, self, "progress", modal)
d.setMinimumDuration(0) if @options.isItemChecked(@md_id)
d.setLabel( AnimatedThingy.new(d, label) ) unless @default_label
d.show
@@ -247,28 +247,28 @@ class CPUWaster < Qt::Widget
lpb = newProgressDialog("Drawing rectangles.\nUsing loop.", n, true)
lpb.setCaption("Please Wait")
- painter = Qt::Painter.new(self)
+ painter = TQt::Painter.new(self)
0.upto(n) { |i|
if (i % 100) == 0
lpb.setProgress(i)
break if lpb.wasCancelled
end
cw, ch = width, height
- c = Qt::Color.new(rand(255), rand(255), rand(255))
+ c = TQt::Color.new(rand(255), rand(255), rand(255))
x = rand(cw - 8)
y = rand(cw - 8)
w = rand(cw - x)
h = rand(cw - y)
- painter.fillRect(x, y, w, h, Qt::Brush.new(c))
+ painter.fillRect(x, y, w, h, TQt::Brush.new(c))
}
lpb.cancel
- painter.fillRect(0, 0, width, height, Qt::Brush.new(backgroundColor))
+ painter.fillRect(0, 0, width, height, TQt::Brush.new(backgroundColor))
painter.end()
end
end
end
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
w = CPUWaster.new
w.show
a.setMainWidget(w)
diff --git a/qtruby/rubylib/examples/qt-examples/tictac/main.rb b/qtruby/rubylib/examples/qt-examples/tictac/main.rb
index 024ae70c..98f57393 100755
--- a/qtruby/rubylib/examples/qt-examples/tictac/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/tictac/main.rb
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby -w
-require 'Qt'
-require 'tictac'
+retquire 'Qt'
+retquire 'tictac'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
n = 3 # get board size n
ttt = TicTacToe.new(n)
diff --git a/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb b/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb
index 04ab8b9d..354e22ef 100644
--- a/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb
+++ b/qtruby/rubylib/examples/qt-examples/tictac/tictac.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class TicTacButton < Qt::PushButton
+class TicTacButton < TQt::PushButton
attr_accessor :btype
@@ -13,18 +13,18 @@ class TicTacButton < Qt::PushButton
def drawButtonLabel(p)
r = rect()
- p.setPen( Qt::Pen.new( Qt::white,2 ) ) # set fat pen
+ p.setPen( TQt::Pen.new( TQt::white,2 ) ) # set fat pen
if (@btype == Circle)
p.drawEllipse( r.left()+4, r.top()+4, r.width()-8, r.height()-8 )
elsif (@btype == Cross) # draw cross
- p.drawLine( r.topLeft() +Qt::Point.new(4,4), r.bottomRight()-Qt::Point.new(4,4))
- p.drawLine( r.bottomLeft()+Qt::Point.new(4,-4),r.topRight() -Qt::Point.new(4,-4))
+ p.drawLine( r.topLeft() +TQt::Point.new(4,4), r.bottomRight()-TQt::Point.new(4,4))
+ p.drawLine( r.bottomLeft()+TQt::Point.new(4,-4),r.topRight() -TQt::Point.new(4,-4))
end
super(p)
end
end
-class TicTacGameBoard < Qt::Widget
+class TicTacGameBoard < TQt::Widget
signals 'finished()'
slots 'buttonClicked()'
@@ -41,8 +41,8 @@ class TicTacGameBoard < Qt::Widget
@buttons = Array.new(n)
@btArray = Array.new(n)
- grid = Qt::GridLayout.new(self, n, n, 4)
- p = Qt::Palette.new(Qt::blue)
+ grid = TQt::GridLayout.new(self, n, n, 4)
+ p = TQt::Palette.new(TQt::blue)
for i in (0..n-1)
ttb = TicTacButton.new(self)
@@ -238,13 +238,13 @@ class TicTacGameBoard < Qt::Widget
end
-class TicTacToe < Qt::Widget
+class TicTacToe < TQt::Widget
slots 'newGameClicked()', 'gameOver()'
def initialize (boardSize)
super()
- l = Qt::VBoxLayout.new(self, 6)
+ l = TQt::VBoxLayout.new(self, 6)
@state_msg = [
'Click Play to start',
@@ -254,9 +254,9 @@ class TicTacToe < Qt::Widget
'It\'s a draw']
# Create a message label
- @message = Qt::Label.new(self)
- @message.setFrameStyle((Qt::Frame.WinPanel|Qt::Frame.Sunken))
- @message.setAlignment(Qt::AlignCenter)
+ @message = TQt::Label.new(self)
+ @message.setFrameStyle((TQt::Frame.WinPanel|TQt::Frame.Sunken))
+ @message.setAlignment(TQt::AlignCenter)
l.addWidget(@message)
# Create the game board and connect the signal finished()
@@ -266,23 +266,23 @@ class TicTacToe < Qt::Widget
l.addWidget(@board)
# Create a horizontal frame line
- line = Qt::Frame.new(self)
- line.setFrameStyle(Qt::Frame.HLine|Qt::Frame.Sunken)
+ line = TQt::Frame.new(self)
+ line.setFrameStyle(TQt::Frame.HLine|TQt::Frame.Sunken)
l.addWidget(line)
# Create the combo box for deciding who should start
# and connect its clicked() signals to the buttonClicked() slot
- @whoStarts = Qt::ComboBox.new(self)
+ @whoStarts = TQt::ComboBox.new(self)
@whoStarts.insertItem('Computer starts')
@whoStarts.insertItem('Human starts')
l.addWidget(@whoStarts);
# Create the push buttons and connect their signals to the right slots
- @newGame = Qt::PushButton.new('Play!', self)
+ @newGame = TQt::PushButton.new('Play!', self)
connect(@newGame, SIGNAL('clicked()'), self, SLOT('newGameClicked()'))
- @quit = Qt::PushButton.new('Quit', self)
+ @quit = TQt::PushButton.new('Quit', self)
connect(@quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
- b = Qt::HBoxLayout.new
+ b = TQt::HBoxLayout.new
l.addLayout(b)
b.addWidget(@newGame)
b.addWidget(@quit)
diff --git a/qtruby/rubylib/examples/qt-examples/tooltip/main.rb b/qtruby/rubylib/examples/qt-examples/tooltip/main.rb
index f1f9ccda..c3774a42 100755
--- a/qtruby/rubylib/examples/qt-examples/tooltip/main.rb
+++ b/qtruby/rubylib/examples/qt-examples/tooltip/main.rb
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
-require 'Qt'
-require 'tooltip'
+retquire 'Qt'
+retquire 'tooltip'
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
mw = TellMe.new
mw.setCaption('QtRuby Example - Dynamic Tool Tips')
diff --git a/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb b/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb
index 181816da..4b805102 100644
--- a/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb
+++ b/qtruby/rubylib/examples/qt-examples/tooltip/tooltip.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class DynamicTip < Qt::ToolTip
+class DynamicTip < TQt::ToolTip
def initialize(p)
super(p)
end
@@ -20,7 +20,7 @@ class DynamicTip < Qt::ToolTip
end
end
-class TellMe < Qt::Widget
+class TellMe < TQt::Widget
def initialize
super
@@ -33,7 +33,7 @@ class TellMe < Qt::Widget
@t = DynamicTip.new(self)
- Qt::ToolTip.add(self, @r3, 'this color is called red') #TT says this is helpful, I'm not so sure
+ TQt::ToolTip.add(self, @r3, 'this color is called red') #TT says this is helpful, I'm not so sure
end
def tip(point)
@@ -42,25 +42,25 @@ class TellMe < Qt::Widget
elsif (@r2.contains(point))
@r2
else
- Qt::Rect.new(0,0, -1, -1)
+ TQt::Rect.new(0,0, -1, -1)
end
end
def paintEvent(e)
- p = Qt::Painter.new(self)
+ p = TQt::Painter.new(self)
if (e.rect.intersects(@r1))
- p.setBrush(Qt::blue)
+ p.setBrush(TQt::blue)
p.drawRect(@r1)
end
if (e.rect.intersects(@r2))
- p.setBrush(Qt::blue)
+ p.setBrush(TQt::blue)
p.drawRect(@r2)
end
if (e.rect.intersects(@r3))
- p.setBrush(Qt::red)
+ p.setBrush(TQt::red)
p.drawRect(@r3)
end
@@ -90,6 +90,6 @@ class TellMe < Qt::Widget
end
def randomRect
- Qt::Rect.new(rand(width - 20), rand(height - 20), 20, 20)
+ TQt::Rect.new(rand(width - 20), rand(height - 20), 20, 20)
end
end
diff --git a/qtruby/rubylib/examples/qtscribble/scribble.rb b/qtruby/rubylib/examples/qtscribble/scribble.rb
index 7c6e1ca5..2d931088 100644
--- a/qtruby/rubylib/examples/qtscribble/scribble.rb
+++ b/qtruby/rubylib/examples/qtscribble/scribble.rb
@@ -5,11 +5,11 @@
# window knows how to redraw itself.
#
-require 'Qt'
+retquire 'Qt'
- class ScribbleArea < Qt::Widget
+ class ScribbleArea < TQt::Widget
- slots "setColor(QColor)", "slotLoad(const QString&)", "slotSave(const QString&)", "slotClearArea()"
+ slots "setColor(TQColor)", "slotLoad(const TQString&)", "slotSave(const TQString&)", "slotClearArea()"
#
# The constructor. Initializes the member variables.
@@ -17,21 +17,21 @@ require 'Qt'
def initialize()
super
# initialize member variables
- @_buffer = Qt::Pixmap.new()
- @_last = Qt::Point.new()
+ @_buffer = TQt::Pixmap.new()
+ @_last = TQt::Point.new()
@_currentcolor = black
# don't blank the window before repainting
setBackgroundMode( NoBackground )
# create a pop-up menu
- @_popupmenu = Qt::PopupMenu.new()
+ @_popupmenu = TQt::PopupMenu.new()
@_popupmenu.insertItem( "&Clear", self, SLOT( "slotClearArea()" ) )
end
#
# This slot sets the curren color for the scribble area. It will be
- # connected with the colorChanged( Qt::Color ) signal from the
+ # connected with the colorChanged( TQt::Color ) signal from the
# ScribbleWindow.
#
def setColor( new_color )
@@ -52,12 +52,12 @@ require 'Qt'
#
- # This method does the actual loading. It relies on Qt::Pixmap (and the
+ # This method does the actual loading. It relies on TQt::Pixmap (and the
# underlying I/O machinery) to determine the filetype.
#
def slotLoad( filename )
if !@_buffer.load( filename )
- Qt::MessageBox.warning( nil, "Load error", "Could not load file" )
+ TQt::MessageBox.warning( nil, "Load error", "Could not load file" )
end
repaint() # refresh the window
@@ -70,7 +70,7 @@ require 'Qt'
#
def slotSave( filename )
if !@_buffer.save( filename, "BMP" )
- Qt::MessageBox.warning( nil, "Save error", "Could not save file" )
+ TQt::MessageBox.warning( nil, "Save error", "Could not save file" )
end
end
@@ -82,7 +82,7 @@ require 'Qt'
#
def mousePressEvent(event)
if event.button() == RightButton
- @_popupmenu.exec( Qt::Cursor.pos() )
+ @_popupmenu.exec( TQt::Cursor.pos() )
else
@_last = event.pos() # retrieve the coordinates from the event
end
@@ -98,10 +98,10 @@ require 'Qt'
# pressed.
#
def mouseMoveEvent(event)
- # create a Qt::Painter object for drawing onto the window
- windowpainter = Qt::Painter.new()
- # and another Qt::Painter object for drawing int an off-screen pixmap
- bufferpainter = Qt::Painter.new()
+ # create a TQt::Painter object for drawing onto the window
+ windowpainter = TQt::Painter.new()
+ # and another TQt::Painter object for drawing int an off-screen pixmap
+ bufferpainter = TQt::Painter.new()
# start painting
windowpainter.begin( self ) # This painter paints onto the window
@@ -136,17 +136,17 @@ require 'Qt'
# painting, for example, when it has been obscured and then revealed again.
#
def resizeEvent(event)
- save = Qt::Pixmap.new( @_buffer )
+ save = TQt::Pixmap.new( @_buffer )
@_buffer.resize( event.size() )
@_buffer.fill( white )
bitBlt( @_buffer, 0, 0, save )
end
end
-class ScribbleWindow < Qt::Widget
+class ScribbleWindow < TQt::Widget
slots "slotAbout()", "slotAboutQt()", "slotColorMenu(int)", "slotLoad()", "slotSave()"
- signals "colorChanged(QColor)", "load(const QString&)", "save(const QString&)"
+ signals "colorChanged(TQColor)", "load(const TQString&)", "save(const TQString&)"
COLOR_MENU_ID_BLACK = 0
COLOR_MENU_ID_RED = 1
@@ -158,44 +158,44 @@ class ScribbleWindow < Qt::Widget
super
# The next lines build the menu bar. We first create the menus
# one by one, then add them to the menu bar. #
- @_filemenu = Qt::PopupMenu.new() # create a file menu
+ @_filemenu = TQt::PopupMenu.new() # create a file menu
@_filemenu.insertItem( "&Load", self, SLOT( "slotLoad()" ) )
@_filemenu.insertItem( "&Save", self, SLOT( "slotSave()" ) )
@_filemenu.insertSeparator()
@_filemenu.insertItem( "&Quit", $qApp, SLOT( "quit()" ) )
- @_colormenu = Qt::PopupMenu.new() # create a color menu
+ @_colormenu = TQt::PopupMenu.new() # create a color menu
@_colormenu.insertItem( "B&lack", COLOR_MENU_ID_BLACK)
@_colormenu.insertItem( "&Red", COLOR_MENU_ID_RED)
@_colormenu.insertItem( "&Blue", COLOR_MENU_ID_BLUE)
@_colormenu.insertItem( "&Green", COLOR_MENU_ID_GREEN)
@_colormenu.insertItem( "&Yellow", COLOR_MENU_ID_YELLOW)
- Qt::Object.connect( @_colormenu, SIGNAL( "activated( int )" ),
+ TQt::Object.connect( @_colormenu, SIGNAL( "activated( int )" ),
self, SLOT( "slotColorMenu( int )" ) )
- @_helpmenu = Qt::PopupMenu.new() # create a help menu
+ @_helpmenu = TQt::PopupMenu.new() # create a help menu
@_helpmenu.insertItem( "&About QtScribble", self, SLOT( "slotAbout()" ) )
@_helpmenu.insertItem( "&About Qt", self, SLOT( "slotAboutQt()" ) )
- @_menubar = Qt::MenuBar.new( self, "" ) # create a menu bar
+ @_menubar = TQt::MenuBar.new( self, "" ) # create a menu bar
@_menubar.insertItem( "&File", @_filemenu )
@_menubar.insertItem( "&Color", @_colormenu )
@_menubar.insertItem( "&Help", @_helpmenu )
- # We create a Qt::ScrollView and a ScribbleArea. The ScribbleArea will
+ # We create a TQt::ScrollView and a ScribbleArea. The ScribbleArea will
# be managed by the scroll view.#
- @_scrollview = Qt::ScrollView.new( self )
+ @_scrollview = TQt::ScrollView.new( self )
@_scrollview.setGeometry( 0, @_menubar.height(),
width(), height() - @_menubar.height() )
@_scribblearea = ScribbleArea.new()
@_scribblearea.setGeometry( 0, 0, 1000, 1000 )
@_scrollview.addChild( @_scribblearea )
- Qt::Object.connect( self, SIGNAL( "colorChanged(QColor)" ),
- @_scribblearea, SLOT( "setColor(QColor)" ) )
- Qt::Object.connect( self, SIGNAL( "save(const QString&)" ),
- @_scribblearea, SLOT( "slotSave(const QString&)" ) )
- Qt::Object.connect( self, SIGNAL( "load(const QString&)" ),
- @_scribblearea, SLOT( "slotLoad(const QString&)" ) )
+ TQt::Object.connect( self, SIGNAL( "colorChanged(TQColor)" ),
+ @_scribblearea, SLOT( "setColor(TQColor)" ) )
+ TQt::Object.connect( self, SIGNAL( "save(const TQString&)" ),
+ @_scribblearea, SLOT( "slotSave(const TQString&)" ) )
+ TQt::Object.connect( self, SIGNAL( "load(const TQString&)" ),
+ @_scribblearea, SLOT( "slotLoad(const TQString&)" ) )
end
def resizeEvent( event )
@@ -209,13 +209,13 @@ class ScribbleWindow < Qt::Widget
def slotAbout()
- Qt::MessageBox.information( self, "About QtScribble 5",
+ TQt::MessageBox.information( self, "About QtScribble 5",
"This is the Scribble 5 application\n" +
"Copyright 1998 by Mathias Kalle Dalheimer\n")
end
def slotAboutQt()
- Qt::MessageBox.aboutQt( self, "About Qt" )
+ TQt::MessageBox.aboutQt( self, "About Qt" )
end
def slotColorMenu( item )
@@ -236,14 +236,14 @@ class ScribbleWindow < Qt::Widget
#
# This is the slot for the menu item File/Load. It opens a
- # Qt::FileDialog to ask the user for a filename, then emits a save()
+ # TQt::FileDialog to ask the user for a filename, then emits a save()
# signal with the filename as parameter.
#
def slotLoad()
# Open a file dialog for loading. The default directory is the
# current directory, the filter *.bmp.
#
- filename = Qt::FileDialog.getOpenFileName( ".", "*.bmp", self )
+ filename = TQt::FileDialog.getOpenFileName( ".", "*.bmp", self )
if !filename.nil?
emit load( filename )
end
@@ -251,21 +251,21 @@ class ScribbleWindow < Qt::Widget
#
# This is the slot for the menu item File/Load. It opens a
- # Qt::FileDialog to ask the user for a filename, then emits a save()
+ # TQt::FileDialog to ask the user for a filename, then emits a save()
# signal with the filename as parameter.
#
def slotSave()
# Open a file dialog for saving. The default directory is the
# current directory, the filter *.bmp.
#
- filename = Qt::FileDialog.getSaveFileName( ".", "*.bmp", self )
+ filename = TQt::FileDialog.getSaveFileName( ".", "*.bmp", self )
if !filename.nil?
emit save( filename )
end
end
end
-myapp = Qt::Application.new(ARGV)
+myapp = TQt::Application.new(ARGV)
mywidget = ScribbleWindow.new()
mywidget.setGeometry(50, 500, 400, 400)
diff --git a/qtruby/rubylib/examples/ruboids/README b/qtruby/rubylib/examples/ruboids/README
index 5417037a..fa99399d 100644
--- a/qtruby/rubylib/examples/ruboids/README
+++ b/qtruby/rubylib/examples/ruboids/README
@@ -30,7 +30,7 @@ directory:
DEPENDENCIES
============
-RuBoids requires the OpenGL and Qt packages, which can be found on the Ruby
+RuBoids retquires the OpenGL and Qt packages, which can be found on the Ruby
Application Archive.
COPYING
diff --git a/qtruby/rubylib/examples/ruboids/index.html b/qtruby/rubylib/examples/ruboids/index.html
index 9b320f8e..778fefb0 100644
--- a/qtruby/rubylib/examples/ruboids/index.html
+++ b/qtruby/rubylib/examples/ruboids/index.html
@@ -21,7 +21,7 @@ PREFIX = "../../"; // -->
<IMG src="../../images/KeyMaster.gif"
width="32" height="32" alt="Home" border="0"></A><BR>
<A href="../../index.html">Home</A><BR>
-<A href="../nqxml/index.html">NQXML</A><BR>
+<A href="../nqxml/index.html">NTQXML</A><BR>
RuBoids<BR>
<A href="../../computers.html">Computers</A><BR>
<A href="../../java.html">Java</A><BR>
@@ -82,7 +82,7 @@ where the latest release may be found.
<h1>Dependencies</h1>
<p>
-RuBoids requires the OpenGL and Qt packages, which can be found on the <a
+RuBoids retquires the OpenGL and Qt packages, which can be found on the <a
href="html://www.ruby-lang.org/en/raa.html">Ruby Application Archive</a>.
</p>
diff --git a/qtruby/rubylib/examples/ruboids/release.rb b/qtruby/rubylib/examples/ruboids/release.rb
index d82ba154..10e10c18 100755
--- a/qtruby/rubylib/examples/ruboids/release.rb
+++ b/qtruby/rubylib/examples/ruboids/release.rb
@@ -16,16 +16,16 @@
# to the Web site.
#
-require 'net/ftp'
-require 'ftools' # For makedirs and install
-require 'generateManifest' # For--you guessed it--generating the Manifest
+retquire 'net/ftp'
+retquire 'ftools' # For makedirs and install
+retquire 'generateManifest' # For--you guessed it--generating the Manifest
# Start looking for RUBOIDS classes in this directory.
# This forces us to use the local copy of RUBOIDS, even if there is
# a previously installed version out there somewhere.
$LOAD_PATH[0, 0] = '.'
-require 'ruboids/info' # For Version string
+retquire 'ruboids/info' # For Version string
FILE_PERMISSION = 0644
DIR_PERMISSION = 0755
@@ -135,7 +135,7 @@ File.rename(RUBOIDS_DIR_WITH_VERSION, RUBOIDS_DIR)
# ftp files if requested
if !ARGV.empty? && ARGV[0] == PUBLISH_FLAG
- require 'net/ftp'
+ retquire 'net/ftp'
# Ask for ftp username and password
guess = ENV['LOGNAME'] || ENV['USER']
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb b/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb
index 38ac7bcc..ff28a043 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Boid.rb
@@ -5,10 +5,10 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'BoidView'
-require 'Flock'
-require 'Point'
-require 'Params'
+retquire 'BoidView'
+retquire 'Flock'
+retquire 'Point'
+retquire 'Params'
class Boid < Thing
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb b/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb
index f2fc1288..45db74ed 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/BoidView.rb
@@ -5,7 +5,7 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'View'
+retquire 'View'
class BoidView < View
@@ -93,7 +93,7 @@ class BoidView < View
groundLevel = -($PARAMS['world_height'] / 2) + 1
Color(SHADOW_COLOR)
- Begin(QUADS)
+ Begin(TQUADS)
Vertex(p1.x, groundLevel, p0.z)
Vertex(p0.x, groundLevel, p0.z)
Vertex(p0.x, groundLevel, p1.z)
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb b/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb
index 787fc4af..6db98321 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Camera.rb
@@ -5,7 +5,7 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Params'
+retquire 'Params'
class Camera
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb b/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb
index 6e01db15..775b8507 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/CameraDialog.rb
@@ -5,9 +5,9 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Qt'
-require 'World'
-require 'Camera'
+retquire 'Qt'
+retquire 'World'
+retquire 'Camera'
class Adjustor
attr_accessor :slider, :num, :origValue
@@ -28,7 +28,7 @@ class Adjustor
end
end
-class CameraDialog < Qt::Dialog
+class CameraDialog < TQt::Dialog
slots 'slotReset()', 'slotLocXChanged(int)',
'slotLocYChanged(int)', 'slotLocZChanged(int)',
'slotRotationXChanged(int)', 'slotRotationYChanged(int)',
@@ -47,16 +47,16 @@ class CameraDialog < Qt::Dialog
@origCamera = @camera.dup()
# Group and layout widgets
- vLayout = Qt::VBoxLayout.new(self, 5)
+ vLayout = TQt::VBoxLayout.new(self, 5)
- locBox = Qt::GroupBox.new('Location', self, 'locBox')
- rotationBox = Qt::GroupBox.new('Rotation', self, 'rotationBox')
- otherBox = Qt::GroupBox.new('Other', self, 'otherBox')
+ locBox = TQt::GroupBox.new('Location', self, 'locBox')
+ rotationBox = TQt::GroupBox.new('Rotation', self, 'rotationBox')
+ otherBox = TQt::GroupBox.new('Other', self, 'otherBox')
- locLayout = Qt::GridLayout.new(locBox, 5, 3, 20)
- rotationLayout = Qt::GridLayout.new(rotationBox, 5, 3, 20)
- otherLayout = Qt::GridLayout.new(otherBox, 3, 3, 20)
- buttonLayout = Qt::HBoxLayout.new()
+ locLayout = TQt::GridLayout.new(locBox, 5, 3, 20)
+ rotationLayout = TQt::GridLayout.new(rotationBox, 5, 3, 20)
+ otherLayout = TQt::GridLayout.new(otherBox, 3, 3, 20)
+ buttonLayout = TQt::HBoxLayout.new()
vLayout.addWidget(locBox)
vLayout.addWidget(rotationBox)
@@ -65,7 +65,7 @@ class CameraDialog < Qt::Dialog
vLayout.addLayout(buttonLayout)
# Add extra space at the top of each layout so the group box title
- # doesn't get squished.
+ # doesn't get stquished.
locLayout.addRowSpacing(0, 15)
rotationLayout.addRowSpacing(0, 15)
otherLayout.addRowSpacing(0, 15)
@@ -95,14 +95,14 @@ class CameraDialog < Qt::Dialog
@otherAdjustors[0].origValue = @camera.zoom
# The Close button
- button = Qt::PushButton.new('Close', self, 'Dialog Close')
+ button = TQt::PushButton.new('Close', self, 'Dialog Close')
connect(button, SIGNAL('clicked()'), self, SLOT('close()'))
button.setDefault(true)
button.setFixedSize(button.sizeHint())
buttonLayout.addWidget(button)
# The Close button
- button = Qt::PushButton.new('Reset', self, 'Dialog Reset')
+ button = TQt::PushButton.new('Reset', self, 'Dialog Reset')
connect(button, SIGNAL('clicked()'), self, SLOT('slotReset()'))
button.setFixedSize(button.sizeHint())
buttonLayout.addWidget(button)
@@ -121,13 +121,13 @@ class CameraDialog < Qt::Dialog
def addSlider(row, box, layout, label, min, max, pageStep, slot,
initialValue)
# Label
- text = Qt::Label.new(label, box)
+ text = TQt::Label.new(label, box)
text.setMinimumSize(text.sizeHint())
layout.addWidget(text, row, 0)
# Slider
- slider = Qt::Slider.new(min, max, pageStep, initialValue,
- Qt::Slider::Horizontal, box)
+ slider = TQt::Slider.new(min, max, pageStep, initialValue,
+ TQt::Slider::Horizontal, box)
slider.setMinimumSize(slider.sizeHint())
slider.setMinimumWidth(180)
layout.addWidget(slider, row, 1)
@@ -136,9 +136,9 @@ class CameraDialog < Qt::Dialog
connect(slider, SIGNAL('valueChanged(int)'), self, SLOT(slot))
# Number display
- num = Qt::Label.new('XXXXX', box)
+ num = TQt::Label.new('XXXXX', box)
num.setMinimumSize(num.sizeHint())
- num.setFrameStyle(Qt::Frame::Panel | Qt::Frame::Sunken)
+ num.setFrameStyle(TQt::Frame::Panel | TQt::Frame::Sunken)
num.setAlignment(AlignRight | AlignVCenter)
num.setNum(initialValue)
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb b/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb
index 91ed934b..f2f0b836 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Canvas.rb
@@ -5,17 +5,17 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Qt'
-require 'opengl'
-require 'World'
-require 'Cloud'
-require 'Flock'
-require 'Params'
-require 'Camera'
+retquire 'Qt'
+retquire 'opengl'
+retquire 'World'
+retquire 'Cloud'
+retquire 'Flock'
+retquire 'Params'
+retquire 'Camera'
include GL
-class Canvas < Qt::GLWidget
+class Canvas < TQt::GLWidget
GRASS_COLOR = [0, 0.75, 0]
MDA_ROTATE = :MDA_ROTATE
@@ -87,7 +87,7 @@ class Canvas < Qt::GLWidget
list = GenLists(1)
NewList(list, COMPILE)
LineWidth(2.0)
- Begin(QUADS)
+ Begin(TQUADS)
Color(GRASS_COLOR)
# Counter-clockwise
@@ -104,11 +104,11 @@ class Canvas < Qt::GLWidget
def mousePressEvent(e)
@mouseLoc = e.pos()
case e.button()
- when Qt::LeftButton
+ when TQt::LeftButton
@mouseDragAction = MDA_ZOOM
- when Qt::RightButton
+ when TQt::RightButton
@mouseDragAction = MDA_ROTATE
- when Qt::MidButton
+ when TQt::MidButton
@mouseDragAction = MDA_CHANGE_FOCUS
end
end
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb b/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb
index 5d30222a..7b9288fb 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Cloud.rb
@@ -5,9 +5,9 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Thing'
-require 'CloudView'
-require 'Params'
+retquire 'Thing'
+retquire 'CloudView'
+retquire 'Params'
class Bubble
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb b/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb
index 75c62177..1472a0d5 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/CloudView.rb
@@ -5,12 +5,12 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Qt'
-require 'View'
-require 'Cloud'
-require 'Params'
-require 'World'
-require 'Graphics'
+retquire 'Qt'
+retquire 'View'
+retquire 'Cloud'
+retquire 'Params'
+retquire 'World'
+retquire 'Graphics'
class CloudView < View
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb b/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb
index 4d476a2b..feb44b83 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Flock.rb
@@ -5,9 +5,9 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Flock'
-require 'Boid'
-require 'Params'
+retquire 'Flock'
+retquire 'Boid'
+retquire 'Params'
class Flock
attr_reader :members
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb b/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb
index 5e982208..475e503c 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Graphics.rb
@@ -5,7 +5,7 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Triangle'
+retquire 'Triangle'
class Graphics
@@ -32,7 +32,7 @@ class Graphics
# Defines counter-clockwise points used in OpenGL TRIANGLE_STRIP to
# create a circle on the X/Z plane. Don't include center point here;
# It is added when outputting the circle.
- SQUARE = [
+ STQUARE = [
XPLUS, ZMINUS, XMINUS, ZPLUS, XPLUS
]
@@ -85,7 +85,7 @@ class Graphics
tmp = pa.z; pa.z = pb.z; pb.z = tmp
end
- Begin(QUAD_STRIP)
+ Begin(TQUAD_STRIP)
# top
Vertex(pb.x, pb.y, pa.z)
@@ -105,7 +105,7 @@ class Graphics
End()
- Begin(QUADS)
+ Begin(TQUADS)
# left
Vertex(pa.x, pa.y, pb.z)
@@ -225,7 +225,7 @@ class Graphics
def Graphics.circle(iterations = DEFAULT_SPHERE_ITERATIONS,
counterClockwise = true)
if @@circles[iterations].nil?
- @@circles[iterations] = buildCircle(iterations, SQUARE)
+ @@circles[iterations] = buildCircle(iterations, STQUARE)
end
circle = @@circles[iterations]
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Params.rb b/qtruby/rubylib/examples/ruboids/ruboids/Params.rb
index 9ff57851..ac9677a4 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Params.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Params.rb
@@ -5,7 +5,7 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'singleton'
+retquire 'singleton'
$PARAMS = {
'world_sleep_millis' => 75,
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb b/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb
index 9b6bfe5b..738a200c 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Thing.rb
@@ -5,7 +5,7 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Point'
+retquire 'Point'
class Thing
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb b/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb
index eedf69f9..6123c3cd 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb
@@ -5,7 +5,7 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Point'
+retquire 'Point'
class Triangle
attr_accessor :points
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/World.rb b/qtruby/rubylib/examples/ruboids/ruboids/World.rb
index 17608bca..6530f0b5 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/World.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/World.rb
@@ -5,16 +5,16 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'singleton'
-require 'Qt'
-require 'Params'
-require 'Cloud'
-require 'Flock'
-require 'Boid'
-require 'Camera'
-require 'Canvas'
+retquire 'singleton'
+retquire 'Qt'
+retquire 'Params'
+retquire 'Cloud'
+retquire 'Flock'
+retquire 'Boid'
+retquire 'Camera'
+retquire 'Canvas'
-class World < Qt::Object
+class World < TQt::Object
slots 'slotMove()'
include Singleton
@@ -50,7 +50,7 @@ class World < Qt::Object
@flock.add(b) # flock will delete boid
}
- @clock = Qt::Timer.new()
+ @clock = TQt::Timer.new()
connect(@clock, SIGNAL('timeout()'), self, SLOT('slotMove()'))
@camera = Camera.new # Reads values from params
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb b/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb
index 56650ece..eff95aef 100644
--- a/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/WorldWindow.rb
@@ -5,11 +5,11 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Qt'
-require 'Canvas'
-require 'CameraDialog'
+retquire 'Qt'
+retquire 'Canvas'
+retquire 'CameraDialog'
-class WorldWindow < Qt::MainWindow
+class WorldWindow < TQt::MainWindow
slots 'slotMenuActivated(int)'
MENU_CAMERA_DIALOG = 1
@@ -30,14 +30,14 @@ class WorldWindow < Qt::MainWindow
def setupMenubar
# Create and populate file menu
- menu = Qt::PopupMenu.new(self)
- menu.insertItem("Exit", $qApp, SLOT("quit()"), Qt::KeySequence.new(CTRL+Key_Q))
+ menu = TQt::PopupMenu.new(self)
+ menu.insertItem("Exit", $qApp, SLOT("quit()"), TQt::KeySequence.new(CTRL+Key_Q))
# Add file menu to menu bar
menuBar.insertItem("&File", menu)
# Create and populate options menu
- menu = Qt::PopupMenu.new(self)
+ menu = TQt::PopupMenu.new(self)
menu.insertItem("&Camera...", MENU_CAMERA_DIALOG, -1)
# Add options menu to menu bar and link it to method below
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb b/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb
index b9bdecba..960c5542 100755
--- a/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb
+++ b/qtruby/rubylib/examples/ruboids/ruboids/ruboids.rb
@@ -6,14 +6,14 @@
# http://www.ruby-lang.org/en/LICENSE.txt.
#
-require 'Qt'
-require 'World'
-require 'WorldWindow'
-require 'Canvas'
-require 'Params'
+retquire 'Qt'
+retquire 'World'
+retquire 'WorldWindow'
+retquire 'Canvas'
+retquire 'Params'
-app = Qt::Application.new(ARGV)
-if (!Qt::GLFormat::hasOpenGL())
+app = TQt::Application.new(ARGV)
+if (!TQt::GLFormat::hasOpenGL())
warning("This system has no OpenGL support. Exiting.")
exit -1
end
diff --git a/qtruby/rubylib/examples/testcases/bugs.rb b/qtruby/rubylib/examples/testcases/bugs.rb
index 6b5e3153..aba5b5cc 100644
--- a/qtruby/rubylib/examples/testcases/bugs.rb
+++ b/qtruby/rubylib/examples/testcases/bugs.rb
@@ -1,10 +1,10 @@
-require 'Qt'
+retquire 'Qt'
#### TODO ###
# dup of qobject crash
def bug1
- p1 = Qt::Point.new(5,5)
+ p1 = TQt::Point.new(5,5)
p1.setX 5
p p1
p3 = p1.dup
@@ -16,10 +16,10 @@ end
#### FIXED ###
def bug3
- a = Qt::Application.new(ARGV)
- @file = Qt::PopupMenu.new
+ a = TQt::Application.new(ARGV)
+ @file = TQt::PopupMenu.new
@file.insertSeparator
- Qt::debug_level = Qt::DebugLevel::High
+ TQt::debug_level = TQt::DebugLevel::High
p $qApp
@file.insertItem("Quit", $qApp, SLOT('quit()'))
@file.exec
@@ -27,29 +27,29 @@ end
#bug3
-class CPUWaster < Qt::Widget
+class CPUWaster < TQt::Widget
def initialize(*k)
super(*k)
end
def draw
- painter = Qt::Painter.new(self)
+ painter = TQt::Painter.new(self)
0.upto(1000) { |i|
cw, ch = width, height
- c = Qt::Color.new(rand(255), rand(255), rand(255))
+ c = TQt::Color.new(rand(255), rand(255), rand(255))
x = rand(cw - 8)
y = rand(cw - 8)
w = rand(cw - x)
h = rand(cw - y)
- brush = Qt::Brush.new(c)
- brush.setStyle(Qt::Dense6Pattern)
- Qt::debug_level = Qt::DebugLevel::High
- painter.fillRect(Qt::Rect.new(x, y, w, h), brush)
- Qt::debug_level = Qt::DebugLevel::Off
+ brush = TQt::Brush.new(c)
+ brush.setStyle(TQt::Dense6Pattern)
+ TQt::debug_level = TQt::DebugLevel::High
+ painter.fillRect(TQt::Rect.new(x, y, w, h), brush)
+ TQt::debug_level = TQt::DebugLevel::Off
}
end
end
def bug4
- Qt::Application.new(ARGV)
+ TQt::Application.new(ARGV)
w = CPUWaster.new
w.show
w.draw
diff --git a/qtruby/rubylib/examples/testcases/error_reporting.rb b/qtruby/rubylib/examples/testcases/error_reporting.rb
index e2012447..4be39e4a 100644
--- a/qtruby/rubylib/examples/testcases/error_reporting.rb
+++ b/qtruby/rubylib/examples/testcases/error_reporting.rb
@@ -1,14 +1,14 @@
-require 'Qt'
+retquire 'Qt'
#### CRASH ###
# param mismatch?
-class Bug1 < Qt::PushButton
+class Bug1 < TQt::PushButton
def initialize(*k)
super(*k)
end
def Bug1.test
- a = Qt::Application.new(ARGV)
- w = Qt::VBox.new
+ a = TQt::Application.new(ARGV)
+ w = TQt::VBox.new
hello = Bug1.new(a)
hello.resize(100, 30)
a.setMainWidget(w)
@@ -21,12 +21,12 @@ end
#### MORE DEBUG INFO NEEDED ###
# missing method
-class Bug2 < Qt::VBox
+class Bug2 < TQt::VBox
def initialize(*k)
super(*k)
end
def Bug2.test
- a = Qt::Application.new(ARGV)
+ a = TQt::Application.new(ARGV)
w = Bug2.new
a.setMainWidget(w)
w.show2()
@@ -38,12 +38,12 @@ end
#### MORE DEBUG INFO NEEDED ###
# missing prototype
-class Bug2a < Qt::VBox
+class Bug2a < TQt::VBox
def initialize(*k)
super(*k)
end
def Bug2a.test
- a = Qt::Application.new(ARGV)
+ a = TQt::Application.new(ARGV)
w = Bug2a.new
a.setMainWidget(w)
w.show(p)
@@ -55,12 +55,12 @@ Bug2a.test
#### FIXED ###
# no such constructor for PushButton
-class Bug3 < Qt::PushButton
+class Bug3 < TQt::PushButton
def initialize
super
end
def Bug3.test
- a = Qt::Application.new(ARGV)
+ a = TQt::Application.new(ARGV)
hello = Bug3.new
hello.resize(100, 30)
a.setMainWidget(hello)
@@ -73,7 +73,7 @@ end
#### FIXED ###
# no *class* variable/method resize in PushButton
-class Bug4 < Qt::PushButton
+class Bug4 < TQt::PushButton
def initialize
super
end
diff --git a/qtruby/rubylib/examples/testcases/opoverloading.rb b/qtruby/rubylib/examples/testcases/opoverloading.rb
index 1798a995..c6d7cb49 100644
--- a/qtruby/rubylib/examples/testcases/opoverloading.rb
+++ b/qtruby/rubylib/examples/testcases/opoverloading.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class Qt::Point
+class TQt::Point
def to_s
"(#{x}, #{y})"
end
@@ -11,8 +11,8 @@ def test(str)
puts "#{str.ljust 25} => #{eval(str, $t)}"
end
-test("p1 = Qt::Point.new(5,5)")
-test("p2 = Qt::Point.new(20,20)")
+test("p1 = TQt::Point.new(5,5)")
+test("p2 = TQt::Point.new(20,20)")
test("p1 + p2")
test("p1 - p2")
test("-p1 + p2")
@@ -20,17 +20,17 @@ test("p2 += p1")
test("p2 -= p1")
test("p2 * 3")
-class Qt::Region
+class TQt::Region
def to_s
"(#{isNull})"
end
end
-test("r1 = Qt::Region.new()")
-test("r2 = Qt::Region.new( 100,100,200,80, Qt::Region::Ellipse )")
+test("r1 = TQt::Region.new()")
+test("r2 = TQt::Region.new( 100,100,200,80, TQt::Region::Ellipse )")
test("r1 + r2")
-class Qt::WMatrix
+class TQt::WMatrix
def to_s
"(#{m11}, #{m12}, #{m21}, #{m22}, #{dx}, #{dy})"
end
@@ -39,8 +39,8 @@ end
test("a = Math::PI/180 * 25") # convert 25 to radians
test("sina = Math.sin(a)")
test("cosa = Math.cos(a)")
-test("m1 = Qt::WMatrix.new(1, 0, 0, 1, 10, -20)") # translation matrix
-test("m2 = Qt::WMatrix.new( cosa, sina, -sina, cosa, 0, 0 )")
-test("m3 = Qt::WMatrix.new(1.2, 0, 0, 0.7, 0, 0)") # scaling matrix
-test("m = Qt::WMatrix.new")
+test("m1 = TQt::WMatrix.new(1, 0, 0, 1, 10, -20)") # translation matrix
+test("m2 = TQt::WMatrix.new( cosa, sina, -sina, cosa, 0, 0 )")
+test("m3 = TQt::WMatrix.new(1.2, 0, 0, 0.7, 0, 0)") # scaling matrix
+test("m = TQt::WMatrix.new")
test("m = m3 * m2 * m1") # combine all transformations
diff --git a/qtruby/rubylib/examples/textedit/textedit.rb b/qtruby/rubylib/examples/textedit/textedit.rb
index db905b4f..bf496383 100644
--- a/qtruby/rubylib/examples/textedit/textedit.rb
+++ b/qtruby/rubylib/examples/textedit/textedit.rb
@@ -1,18 +1,18 @@
#!/usr/bin/ruby -w
-require 'Qt'
-require 'rexml/document'
+retquire 'Qt'
+retquire 'rexml/document'
-require '../base/rui.rb'
+retquire '../base/rui.rb'
-class MyTextEditor < Qt::TextEdit
+class MyTextEditor < TQt::TextEdit
signals 'saved()'
slots 'insert_icon()', 'new()', 'open()', 'save_as()'
def initialize(w = nil)
@images = {}
@@next_image_id = 0
super(w)
- self.setTextFormat(Qt::RichText)
+ self.setTextFormat(TQt::RichText)
end
def insert_richtext(richtext)
# todo, use a rand string
@@ -25,21 +25,21 @@ class MyTextEditor < Qt::TextEdit
@@next_image_id += 1
end
def load_image(fname, image_id)
- pixmap = Qt::Pixmap.new(fname)
- msfactory = Qt::MimeSourceFactory.defaultFactory
+ pixmap = TQt::Pixmap.new(fname)
+ msfactory = TQt::MimeSourceFactory.defaultFactory
msfactory.setPixmap(image_id, pixmap)
@images[image_id] = fname
image_id
end
def insert_icon
- fname = Qt::FileDialog.getOpenFileName
+ fname = TQt::FileDialog.getOpenFileName
return if fname.nil?
image_id = "image_#{next_image_id}"
load_image(fname, image_id)
insert_richtext('<qt><img source="'+image_id+'"></qt>')
end
def createPopupMenu(pos) # virtual
- pm = Qt::PopupMenu.new
+ pm = TQt::PopupMenu.new
pm.insertItem("Insert Image!", self, SLOT('insert_icon()'))
pm
end
@@ -79,10 +79,10 @@ class MyTextEditor < Qt::TextEdit
self.setText(txt)
end
def open
- fname = Qt::FileDialog.getOpenFileName
+ fname = TQt::FileDialog.getOpenFileName
return if fname.nil?
unless File.exists?(fname)
- Qt::MessageBox.critical(self, "File Does Not Exist", "Sorry, unable to find the requested file!")
+ TQt::MessageBox.critical(self, "File Does Not Exist", "Sorry, unable to find the requested file!")
return
end
return if fname.nil?
@@ -92,10 +92,10 @@ class MyTextEditor < Qt::TextEdit
self.setText(txt)
end
def save_as
- fname = Qt::FileDialog.getSaveFileName
+ fname = TQt::FileDialog.getSaveFileName
return if fname.nil?
if File.exists?(fname)
- Qt::MessageBox.critical(self, "File Already Exists", "Sorry, file already exists. Please choose a non-existing filename!")
+ TQt::MessageBox.critical(self, "File Already Exists", "Sorry, file already exists. Please choose a non-existing filename!")
return save_as
end
file = File.new(fname, "w")
@@ -106,7 +106,7 @@ class MyTextEditor < Qt::TextEdit
end
end
-class MyWidget < Qt::MainWindow
+class MyWidget < TQt::MainWindow
slots 'text_changed()', 'saved()'
def initialize()
super
@@ -114,8 +114,8 @@ class MyWidget < Qt::MainWindow
connect(@editor, SIGNAL('textChanged()'), self, SLOT('text_changed()'))
connect(@editor, SIGNAL('saved()'), self, SLOT('saved()'))
- 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, @editor, SLOT('new()'), [fileTools, fileMenu]),
@@ -127,7 +127,7 @@ class MyWidget < Qt::MainWindow
build_actions(actions)
- menubar = Qt::MenuBar.new(self)
+ menubar = TQt::MenuBar.new(self)
menubar.insertItem("&File", fileMenu)
self.setCentralWidget(@editor)
@@ -140,7 +140,7 @@ class MyWidget < Qt::MainWindow
end
end
-a = Qt::Application.new(ARGV)
+a = TQt::Application.new(ARGV)
w = MyWidget.new
w.show