summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/qt-examples/chart/chartform.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qtruby/rubylib/examples/qt-examples/chart/chartform.rb')
-rw-r--r--qtruby/rubylib/examples/qt-examples/chart/chartform.rb132
1 files changed, 66 insertions, 66 deletions
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