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