summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo
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/fonts/simple-qfont-demo
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/examples/qt-examples/fonts/simple-qfont-demo')
-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
2 files changed, 27 insertions, 27 deletions
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 ' +