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/README | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtruby/README')
-rw-r--r-- | qtruby/README | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/qtruby/README b/qtruby/README index 22dee743..40643d37 100644 --- a/qtruby/README +++ b/qtruby/README @@ -35,18 +35,18 @@ Here is 'Hello World' in QtRuby: #!/usr/bin/ruby -w -require 'Qt' +retquire 'Qt' -a = Qt::Application.new(ARGV) -hello = Qt::PushButton.new("Hello World!", nil) +a = TQt::Application.new(ARGV) +hello = TQt::PushButton.new("Hello World!", nil) hello.resize(100, 30) a.setMainWidget(hello) hello.show() a.exec() -Ruby 1.8 is unfortunately implicitly required as with 1.6.x it is not possible to: +Ruby 1.8 is unfortunately implicitly retquired as with 1.6.x it is not possible to: - Make dynamic constants available (thus forcing syntax such as Qt.RichText rather than Qt::RichText)<br> + Make dynamic constants available (thus forcing syntax such as Qt.RichText rather than TQt::RichText)<br> Call super in the initialize method thus making subclassing of non trivial classes impossible QtRuby features a very complete coverage of the Qt api: @@ -75,14 +75,14 @@ QtRuby features a very complete coverage of the Qt api: - Operator overloading The full range of Qt operator methods is available, for example: - p1 = Qt::Point.new(5,5) => (5, 5) - p2 = Qt::Point.new(20,20) => (20, 20) + p1 = TQt::Point.new(5,5) => (5, 5) + p2 = TQt::Point.new(20,20) => (20, 20) p1 + p2 => (25, 25) - Declare signals and slots Signals and slots are declared as list of strings like this: - slots 'setColor(QColor)', 'slotLoad(const QString&)'.. + slots 'setColor(TQColor)', 'slotLoad(const TQString&)'.. signals 'clicked()'.. Currently C++ type signatures must be used, a future version of QtRuby @@ -90,7 +90,7 @@ QtRuby features a very complete coverage of the Qt api: Connect slots and signals like this: - Qt::Object.connect( @_colormenu, SIGNAL( "activated( int )" ), + TQt::Object.connect( @_colormenu, SIGNAL( "activated( int )" ), self, SLOT( "slotColorMenu( int )" ) ) And emit signals like this: @@ -100,7 +100,7 @@ QtRuby features a very complete coverage of the Qt api: - Constructors You can call constructors in the conventional style: - quit = Qt::PushButton.new("Quit", self, "quit") + quit = TQt::PushButton.new("Quit", self, "quit") Or you can pass a block if you prefer: @@ -132,24 +132,24 @@ QtRuby features a very complete coverage of the Qt api: - C++ 'int*' and 'int&' argument types Ruby passes numeric values by value, and so they can't be changed when passed to a - method. The Qt::Integer class provides a mutable numeric type which does get updated + method. The TQt::Integer class provides a mutable numeric type which does get updated when passed as an argument. For example, this C++ method 'findByFileContent()': - # static Ptr findByFileContent( const QString &fileName, int *accuracy=0 ); + # static Ptr findByFileContent( const TQString &fileName, int *accuracy=0 ); - acc = Qt::Integer.new(0) + acc = TQt::Integer.new(0) fc = KDE::MimeType.findByFileContent("mimetype.rb", acc) It supports the arithmetic operators, and so expressions such as 'acc + 3' will work. - C++ 'bool*' and 'bool&' argument types - There is a similar problem for bool arg types, and the mutable Qt::Boolean class can be + There is a similar problem for bool arg types, and the mutable TQt::Boolean class can be used like this: - # QFont getFont(bool * ok, const QFont&initial, QWidget* parent = 0, const char *name = 0); + # TQFont getFont(bool * ok, const TQFont&initial, TQWidget* parent = 0, const char *name = 0); - ok = Qt::Boolean.new - font = Qt::FontDialog.getFont(ok, Qt::Font.new("Helvetica [Cronyx]", 10), self) + ok = TQt::Boolean.new + font = TQt::FontDialog.getFont(ok, TQt::Font.new("Helvetica [Cronyx]", 10), self) if !ok.nil? # font is set to the font the user selected else @@ -162,18 +162,18 @@ QtRuby features a very complete coverage of the Qt api: If a method call can't be matched in the Smoke library giving a 'method_missing' error, you can turn on debugging to trace the matching process: - a = Qt::Application.new(ARGV) - Qt.debug_level = Qt::DebugLevel::High + a = TQt::Application.new(ARGV) + Qt.debug_level = TQt::DebugLevel::High a.loadLibrary("foo") # Non existent method Will give the following output: - classname == QApplication + classname == TQApplication :: method == loadLibrary$ -> methodIds == [] candidate list: Possible prototypes: - static QWidget* QApplication::widgetAt(int, int, bool) + static TQWidget* TQApplication::widgetAt(int, int, bool) ... Here, the list of candidate methods 'methodIds' is empty @@ -181,10 +181,10 @@ QtRuby features a very complete coverage of the Qt api: Another debugging mechanism allows various trace 'channels' to be switched on. You can trace virtual method callbacks: - Qt::Internal::setDebug(Qt::QtDebugChannel::QTDB_VIRTUAL) + TQt::Internal::setDebug(TQt::QtDebugChannel::TQTDB_VIRTUAL) Or trace QtRuby garbage collection: - Qt::Internal::setDebug(Qt::QtDebugChannel::QTDB_GC) + TQt::Internal::setDebug(TQt::QtDebugChannel::TQTDB_GC) - String i18n @@ -204,7 +204,7 @@ QtRuby features a very complete coverage of the Qt api: Will add this to the end of the generated code: if $0 == __FILE__ - a = Qt::Application.new(ARGV) + a = TQt::Application.new(ARGV) w = MainForm.new a.setMainWidget(w) w.show @@ -215,21 +215,21 @@ QtRuby features a very complete coverage of the Qt api: $ ruby mainform.rb - - Loading .ui files at runtime with QWidgetFactory - You can load a Qt Designer .ui file at runtime with the qui extension, + - Loading .ui files at runtime with TQWidgetFactory + You can load a Qt Designer .ui file at runtime with the tqui extension, for example: - require 'Qt' - require 'qui' + retquire 'Qt' + retquire 'tqui' - a = Qt::Application.new(ARGV) + a = TQt::Application.new(ARGV) if ARGV.length == 0 exit end if ARGV.length == 2 - QUI::WidgetFactory.loadImages( ARGV[ 0 ] ) - w = QUI::WidgetFactory.create( ARGV[ 1 ] ) + TQUI::WidgetFactory.loadImages( ARGV[ 0 ] ) + w = TQUI::WidgetFactory.create( ARGV[ 1 ] ) if w.nil? exit end @@ -251,7 +251,7 @@ QtRuby features a very complete coverage of the Qt api: code and start messing with it.. The are various samples under qtruby/rubylib/examples. - - Optional QScintilla text editing widget support + - Optional TQScintilla text editing widget support Great for building your own ruby IDE.. Have Fun! |