From 6b0cf55d6252a256d9fc5bcb89837bec7f21f40d Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 7 Nov 2023 19:27:29 +0900 Subject: Replace Qt with TQt Signed-off-by: Michele Calgaro --- languages/ruby/app_templates/qtrubyapp/main.rb | 2 +- .../ruby/app_templates/qtrubyapp/qtrubyapp.rb | 86 +++++++++++----------- 2 files changed, 44 insertions(+), 44 deletions(-) (limited to 'languages/ruby/app_templates/qtrubyapp') diff --git a/languages/ruby/app_templates/qtrubyapp/main.rb b/languages/ruby/app_templates/qtrubyapp/main.rb index 6f4bceae..431ea442 100644 --- a/languages/ruby/app_templates/qtrubyapp/main.rb +++ b/languages/ruby/app_templates/qtrubyapp/main.rb @@ -1,7 +1,7 @@ require 'Qt' require '%{APPNAMELC}.rb' -a = Qt::Application.new( ARGV ) +a = TQt::Application.new( ARGV ) mw = %{APPNAMESC}.new mw.caption = "%{APPNAMESC}" mw.show diff --git a/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb b/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb index 26b0b378..df98824d 100644 --- a/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb +++ b/languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb @@ -1,4 +1,4 @@ -class %{APPNAMESC} < Qt::MainWindow +class %{APPNAMESC} < TQt::MainWindow Q_SLOTS 'newDoc()', 'choose()', @@ -11,61 +11,61 @@ class %{APPNAMESC} < Qt::MainWindow def initialize() super( nil, "%{APPNAMESC}", WDestructiveClose ) - @printer = Qt::Printer.new + @printer = TQt::Printer.new - fileTools = Qt::ToolBar.new( self, "file operations" ) + fileTools = TQt::ToolBar.new( self, "file operations" ) fileTools.setLabel( tr("File Operations") ) - openIcon = Qt::Pixmap.new( "fileopen.xpm" ) - fileOpen = Qt::ToolButton.new( Qt::IconSet.new(openIcon), tr("Open File"), nil, + openIcon = TQt::Pixmap.new( "fileopen.xpm" ) + fileOpen = TQt::ToolButton.new( TQt::IconSet.new(openIcon), tr("Open File"), nil, self, SLOT('choose()'), fileTools, "open file" ) - saveIcon = Qt::Pixmap.new( "filesave.xpm" ) - fileSave = Qt::ToolButton.new( Qt::IconSet.new(saveIcon), tr("Save File"), nil, + saveIcon = TQt::Pixmap.new( "filesave.xpm" ) + fileSave = TQt::ToolButton.new( TQt::IconSet.new(saveIcon), tr("Save File"), nil, self, SLOT('save()'), fileTools, "save file" ) - printIcon = Qt::Pixmap.new( "fileprint.xpm" ) - filePrint = Qt::ToolButton.new( Qt::IconSet.new(printIcon), tr("Print File"), nil, + printIcon = TQt::Pixmap.new( "fileprint.xpm" ) + filePrint = TQt::ToolButton.new( TQt::IconSet.new(printIcon), tr("Print File"), nil, self, SLOT('print()'), fileTools, "print file" ) - Qt::WhatsThis.whatsThisButton( fileTools ) + TQt::WhatsThis.whatsThisButton( fileTools ) fileOpenText = tr('

' + "Click this button to open a new file.
" + "You can also select the Open command " + "from the File menu.

") - Qt::WhatsThis.add( fileOpen, fileOpenText ) + TQt::WhatsThis.add( fileOpen, fileOpenText ) - Qt::MimeSourceFactory.defaultFactory().setPixmap( "fileopen", openIcon ) + TQt::MimeSourceFactory.defaultFactory().setPixmap( "fileopen", openIcon ) fileSaveText = tr("

Click this button to save the file you " + "are editing. You will be prompted for a file name.\n" + "You can also select the Save command " + "from the File menu.

") - Qt::WhatsThis.add( fileSave, fileSaveText ) + TQt::WhatsThis.add( fileSave, fileSaveText ) filePrintText = tr("Click this button to print the file you " + "are editing.\n You can also select the Print " + "command from the File menu.") - Qt::WhatsThis.add( filePrint, filePrintText ) + TQt::WhatsThis.add( filePrint, filePrintText ) - file = Qt::PopupMenu.new( self ) + file = TQt::PopupMenu.new( self ) menuBar().insertItem( tr("&File"), file ) - file.insertItem( tr("&New"), self, SLOT('newDoc()'), Qt::KeySequence.new(CTRL+Key_N) ) + file.insertItem( tr("&New"), self, SLOT('newDoc()'), TQt::KeySequence.new(CTRL+Key_N) ) - id = file.insertItem( Qt::IconSet.new(openIcon), tr("&Open..."), - self, SLOT('choose()'), Qt::KeySequence.new(CTRL+Key_O) ) + id = file.insertItem( TQt::IconSet.new(openIcon), tr("&Open..."), + self, SLOT('choose()'), TQt::KeySequence.new(CTRL+Key_O) ) file.setWhatsThis( id, fileOpenText ) - id = file.insertItem( Qt::IconSet.new(saveIcon), tr("&Save"), - self, SLOT('save()'), Qt::KeySequence.new(CTRL+Key_S) ) + id = file.insertItem( TQt::IconSet.new(saveIcon), tr("&Save"), + self, SLOT('save()'), TQt::KeySequence.new(CTRL+Key_S) ) file.setWhatsThis( id, fileSaveText ) id = file.insertItem( tr("Save &As..."), self, SLOT('saveAs()') ) @@ -73,27 +73,27 @@ class %{APPNAMESC} < Qt::MainWindow file.insertSeparator() - id = file.insertItem( Qt::IconSet.new(printIcon), tr("&Print..."), - self, SLOT('print()'), Qt::KeySequence.new(CTRL+Key_P) ) + id = file.insertItem( TQt::IconSet.new(printIcon), tr("&Print..."), + self, SLOT('print()'), TQt::KeySequence.new(CTRL+Key_P) ) file.setWhatsThis( id, filePrintText ) file.insertSeparator() - file.insertItem( tr("&Close"), self, SLOT('close()'), Qt::KeySequence.new(CTRL+Key_W) ) + file.insertItem( tr("&Close"), self, SLOT('close()'), TQt::KeySequence.new(CTRL+Key_W) ) - file.insertItem( tr("&Quit"), $tqApp, SLOT( 'closeAllWindows()' ), Qt::KeySequence.new(CTRL+Key_Q) ) + file.insertItem( tr("&Quit"), $tqApp, SLOT( 'closeAllWindows()' ), TQt::KeySequence.new(CTRL+Key_Q) ) menuBar().insertSeparator() - help = Qt::PopupMenu.new( self ) + help = TQt::PopupMenu.new( self ) menuBar().insertItem( tr("&Help"), help ) - help.insertItem( tr("&About"), self, SLOT('about()'), Qt::KeySequence.new(Key_F1) ) + help.insertItem( tr("&About"), self, SLOT('about()'), TQt::KeySequence.new(Key_F1) ) help.insertItem( tr("About &Qt"), self, SLOT('aboutQt()') ) help.insertSeparator() - help.insertItem( tr("What's &This"), self, SLOT('whatsThis()'), Qt::KeySequence.new(SHIFT+Key_F1) ) + help.insertItem( tr("What's &This"), self, SLOT('whatsThis()'), TQt::KeySequence.new(SHIFT+Key_F1) ) - @e = Qt::TextEdit.new( self, "editor" ) + @e = TQt::TextEdit.new( self, "editor" ) @e.setFocus() setCentralWidget( @e ) statusBar().message( tr("Ready"), 2000 ) @@ -110,7 +110,7 @@ class %{APPNAMESC} < Qt::MainWindow end def choose() - fn = Qt::FileDialog.getOpenFileName( nil, nil, + fn = TQt::FileDialog.getOpenFileName( nil, nil, self) if !fn.nil? load( fn ) @@ -121,12 +121,12 @@ class %{APPNAMESC} < Qt::MainWindow def load( filename ) - f = Qt::File.new( filename ) - if !f.open( Qt::IO_ReadOnly ) + f = TQt::File.new( filename ) + if !f.open( TQt::IO_ReadOnly ) return end - ts = Qt::TextStream.new( f ) + ts = TQt::TextStream.new( f ) @e.setText( ts.read() ) @e.setModified( false ) setCaption( filename ) @@ -141,14 +141,14 @@ class %{APPNAMESC} < Qt::MainWindow end text = @e.text() - f = Qt::File.new( @filename ) - if !f.open( Qt::IO_WriteOnly ) + f = TQt::File.new( @filename ) + if !f.open( TQt::IO_WriteOnly ) statusBar().message( tr("Could not write to %s" % @filename), 2000 ) return end - t = Qt::TextStream.new( f ) + t = TQt::TextStream.new( f ) t << text f.close() @@ -161,7 +161,7 @@ class %{APPNAMESC} < Qt::MainWindow def saveAs() - fn = Qt::FileDialog.getSaveFileName( nil, nil, + fn = TQt::FileDialog.getSaveFileName( nil, nil, self ) if !fn.nil? @filename = fn @@ -173,13 +173,13 @@ class %{APPNAMESC} < Qt::MainWindow def print() - # ###### Rewrite to use Qt::SimpleRichText to print here as well + # ###### Rewrite to use TQt::SimpleRichText to print here as well margin = 10 pageNo = 1 if @printer.setup(self) # @printer dialog statusBar().message( tr("Printing...") ) - p = Qt::Painter.new + p = TQt::Painter.new if !p.begin( @printer ) # paint on @printer return end @@ -187,7 +187,7 @@ class %{APPNAMESC} < Qt::MainWindow p.setFont( @e.font() ) yPos = 0 # y-position for each line fm = p.fontMetrics() - metrics = Qt::PaintDeviceMetrics.new( @printer ) # need width/height + metrics = TQt::PaintDeviceMetrics.new( @printer ) # need width/height # of @printer surface for i in 0...@e.lines() do if margin + yPos > metrics.height() - margin @@ -220,7 +220,7 @@ class %{APPNAMESC} < Qt::MainWindow return end - case Qt::MessageBox.information( self, tr("Qt Application Example"), + case TQt::MessageBox.information( self, tr("Qt Application Example"), tr("Do you want to save the changes" + " to the document?"), tr("Yes"), tr("No"), tr("Cancel"), @@ -240,14 +240,14 @@ class %{APPNAMESC} < Qt::MainWindow private def about() - Qt::MessageBox.about( self, tr("Qt Application Example"), + TQt::MessageBox.about( self, tr("Qt Application Example"), tr("This example demonstrates simple use of " + - "Qt::MainWindow,\nQt::MenuBar and Qt::ToolBar.")) + "TQt::MainWindow,\nTQt::MenuBar and TQt::ToolBar.")) end def aboutQt() - Qt::MessageBox.aboutQt( self, tr("Qt Application Example") ) + TQt::MessageBox.aboutQt( self, tr("Qt Application Example") ) end end -- cgit v1.2.1