diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtruby/rubylib/designer/examples/colortool/mainform.ui.rb | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/designer/examples/colortool/mainform.ui.rb')
-rw-r--r-- | qtruby/rubylib/designer/examples/colortool/mainform.ui.rb | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb b/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb index 471233bd..3f4f5945 100644 --- a/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb +++ b/qtruby/rubylib/designer/examples/colortool/mainform.ui.rb @@ -10,7 +10,7 @@ class MainForm APP_KEY = "/ColorTool/" def init() - @clipboard = Qt::Application.clipboard() + @clipboard = TQt::Application.clipboard() if @clipboard.supportsSelection() @clipboard.selectionMode = true end @@ -33,23 +33,23 @@ def clearData( fillWithDefaults ) @comments.clear() if fillWithDefaults - @colors["black"] = Qt::black - @colors["blue"] = Qt::blue - @colors["cyan"] = Qt::cyan - @colors["darkblue"] = Qt::darkBlue - @colors["darkcyan"] = Qt::darkCyan - @colors["darkgray"] = Qt::darkGray - @colors["darkgreen"] = Qt::darkGreen - @colors["darkmagenta"] = Qt::darkMagenta - @colors["darkred"] = Qt::darkRed - @colors["darkyellow"] = Qt::darkYellow - @colors["gray"] = Qt::gray - @colors["green"] = Qt::green - @colors["lightgray"] = Qt::lightGray - @colors["magenta"] = Qt::magenta - @colors["red"] = Qt::red - @colors["white"] = Qt::white - @colors["yellow"] = Qt::yellow + @colors["black"] = TQt::black + @colors["blue"] = TQt::blue + @colors["cyan"] = TQt::cyan + @colors["darkblue"] = TQt::darkBlue + @colors["darkcyan"] = TQt::darkCyan + @colors["darkgray"] = TQt::darkGray + @colors["darkgreen"] = TQt::darkGreen + @colors["darkmagenta"] = TQt::darkMagenta + @colors["darkred"] = TQt::darkRed + @colors["darkyellow"] = TQt::darkYellow + @colors["gray"] = TQt::gray + @colors["green"] = TQt::green + @colors["lightgray"] = TQt::lightGray + @colors["magenta"] = TQt::magenta + @colors["red"] = TQt::red + @colors["white"] = TQt::white + @colors["yellow"] = TQt::yellow end populate() @@ -65,7 +65,7 @@ def populate() @colorTable.numRows = @colors.length if ! @colors.empty? - pixmap = Qt::Pixmap.new( 22, 22 ) + pixmap = TQt::Pixmap.new( 22, 22 ) row = 0 @colors.sort.each do |pair| key = pair[0] @@ -75,7 +75,7 @@ def populate() @colorTable.setPixmap( row, COL_NAME, pixmap ); @colorTable.setText( row, COL_HEX, color.name().upcase() ) if @show_web - item = Qt::CheckTableItem.new( @colorTable, "" ) + item = TQt::CheckTableItem.new( @colorTable, "" ) item.checked = webColor?( color ) @colorTable.setItem( row, COL_WEB, item ) end @@ -98,16 +98,16 @@ def populate() @colorIconView.clear() @colors.each do |key, data| - Qt::IconViewItem.new( @colorIconView, key, colorSwatch(data) ) + TQt::IconViewItem.new( @colorIconView, key, colorSwatch(data) ) end @icons_dirty = false end end def colorSwatch( color ) - pixmap = Qt::Pixmap.new( 80, 80 ) + pixmap = TQt::Pixmap.new( 80, 80 ) pixmap.fill( white ) - painter = Qt::Painter.new + painter = TQt::Painter.new painter.begin( pixmap ) painter.pen = NoPen painter.brush = color @@ -131,7 +131,7 @@ def fileOpen() return end - filename = Qt::FileDialog.getOpenFileName( + filename = TQt::FileDialog.getOpenFileName( nil, "Colors (*.txt)", self, "file open", "Color Tool -- File Open" ) if ! filename.nil? @@ -147,9 +147,9 @@ def fileSave() return end - file = Qt::File.new( @filename ) - if file.open( Qt::IO_WriteOnly ) - stream = Qt::TextStream.new( file ) + file = TQt::File.new( @filename ) + if file.open( TQt::IO_WriteOnly ) + stream = TQt::TextStream.new( file ) if ! @comments.empty? stream << @comments + "\n" << "\n" end @@ -167,13 +167,13 @@ def fileSave() end def fileSaveAs() - filename = Qt::FileDialog.getSaveFileName( + filename = TQt::FileDialog.getSaveFileName( nil, "Colors (*.txt)", self, "file save as", "Color Tool -- File Save As" ) if ! filename.nil? ans = 0 - if Qt::File.exists( filename ) - ans = Qt::MessageBox.warning( + if TQt::File.exists( filename ) + ans = TQt::MessageBox.warning( self, "Color Tool -- Overwrite File", "Overwrite\n'#{filename}'?" , "&Yes", "&No", nil, 1, 1 ) @@ -191,17 +191,17 @@ def load( filename ) clearData( false ) @filename = filename regex = Regexp.new( "^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+.*)$" ) - file = Qt::File.new( filename ) - if file.open( Qt::IO_ReadOnly ) + file = TQt::File.new( filename ) + if file.open( TQt::IO_ReadOnly ) statusBar().message( "Loading '#{filename}'..." ) - stream = Qt::TextStream.new( file ) + stream = TQt::TextStream.new( file ) while ! stream.eof() line = stream.readLine() m = regex.match( line ) if m.nil? @comments += line else - @colors[m[4]] = Qt::Color.new(m[1].to_i,m[2].to_i,m[3].to_i ) + @colors[m[4]] = TQt::Color.new(m[1].to_i,m[2].to_i,m[3].to_i ) end end file.close() @@ -227,7 +227,7 @@ def okToClear() msg = "Colors '#{@filename}'\n" end msg += "has been changed." - ans = Qt::MessageBox.information( + ans = TQt::MessageBox.information( self, "Color Tool -- Unsaved Changes", msg, "&Save", "Cancel", "&Abandon", @@ -249,7 +249,7 @@ end def fileExit() if okToClear() saveSettings() - Qt::Application.exit( 0 ) + TQt::Application.exit( 0 ) end end @@ -321,8 +321,8 @@ end def editFind() if ! @findForm @findForm = FindForm.new( self ) - connect( @findForm, SIGNAL( 'lookfor(const QString&)' ), - self, SLOT( 'lookfor(const QString&)' ) ) + connect( @findForm, SIGNAL( 'lookfor(const TQString&)' ), + self, SLOT( 'lookfor(const TQString&)' ) ) end @findForm.show() end @@ -425,19 +425,19 @@ end def editAdd() - color = Qt::white + color = TQt::white if ! @colors.empty? visible = @colorWidgetStack.visibleWidget() if visible == @tablePage - color = Qt::Color.new(@colorTable.text( @colorTable.currentRow(), + color = TQt::Color.new(@colorTable.text( @colorTable.currentRow(), @colorTable.currentColumn() )) else - color = Qt::Color.new(@colorIconView.currentItem().text()) + color = TQt::Color.new(@colorIconView.currentItem().text()) end end - color = Qt::ColorDialog.getColor( color, self ) + color = TQt::ColorDialog.getColor( color, self ) if color.valid? - pixmap = Qt::Pixmap.new( 80, 10 ) + pixmap = TQt::Pixmap.new( 80, 10 ) pixmap.fill( color ) colorForm = ColorNameForm.new( self, "color", true ) colorForm.setColors( @colors ) @@ -445,7 +445,7 @@ def editAdd() if colorForm.exec() name = colorForm.colorLineEdit.text() @colors[name] = color - pixmap = Qt::Pixmap.new( 22, 22 ) + pixmap = TQt::Pixmap.new( 22, 22 ) pixmap.fill( color ) row = @colorTable.currentRow() @colorTable.insertRows( row, 1 ) @@ -453,13 +453,13 @@ def editAdd() @colorTable.setPixmap( row, COL_NAME, pixmap ) @colorTable.setText( row, COL_HEX, color.name().upcase() ) if @show_web - item = Qt::CheckTableItem.new( @colorTable, "" ) + item = TQt::CheckTableItem.new( @colorTable, "" ) item.checked = webColor?( color ) @colorTable.setItem( row, COL_WEB, item ) end @colorTable.setCurrentCell( row, 0 ) - Qt::IconViewItem.new( @colorIconView, name, + TQt::IconViewItem.new( @colorIconView, name, colorSwatch( color ) ) @changed = true end @@ -493,8 +493,8 @@ def editOptions() end def loadSettings() - 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", 550 ) windowHeight = settings.readNumEntry( APP_KEY + "WindowHeight", 500 ) windowX = settings.readNumEntry( APP_KEY + "WindowX", 0 ) @@ -511,8 +511,8 @@ def loadSettings() end def saveSettings() - 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() ) |