summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/qt-examples/chart
diff options
context:
space:
mode:
Diffstat (limited to 'qtruby/rubylib/examples/qt-examples/chart')
-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
11 files changed, 178 insertions, 178 deletions
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