Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

QtRuby for Qt Developers

ynonperek
August 06, 2012
250

QtRuby for Qt Developers

ynonperek

August 06, 2012
Tweet

Transcript

  1. Non-Virtual By Default int main(int argc, char **argv) { Foo

    *f = new Bar(); // Calls Foo::doSomething by default f->doSomething(); } Monday, August 6, 12
  2. Implicit Copy Ctor int printData( Foo f ) { }

    int printRef ( Foo& f ) { } int main(int argc, char **argv) { Foo f; printData( f ); printRef( f ); } Monday, August 6, 12
  3. Implicit Type Coercion int printData( Foo f ) { }

    int printRef ( Foo& f ) { } int main(int argc, char **argv) { Foo f; // Convert to Foo printData( 5 ); } Monday, August 6, 12
  4. C++ Alternatives • Perl • Ruby • Java • Python

    they all got Monday, August 6, 12
  5. Hello Qt require 'Qt' app = Qt::Application.new( ARGV ) w

    = Qt::Label.new( "Hello World" ) w.set_alignment( Qt::AlignHCenter | Qt::AlignVCenter ) w.show app.exec Monday, August 6, 12
  6. Qt Terminology • Signals are connected to slots which are

    the handling code Monday, August 6, 12
  7. Designer Takeaways • Drag & Drop to create UI •

    Save as .ui file • Run: rbuic4 file.ui -x -o file_ui.rb • Use resulting .rb file but don’t modify it Monday, August 6, 12
  8. Qt Actions require 'Qt' require './demo1_ui.rb' a = Qt::Application.new(ARGV) u

    = Ui_Form.new w = Qt::Widget.new u.setupUi(w) w.show u.btn1.connect( SIGNAL :clicked ) { u.list1.add_item( "Qt FTW" ) } a.exec Monday, August 6, 12
  9. Qt Actions require 'Qt' app = Qt::Application.new( ARGV ) s1

    = Qt::Slider.new( Qt::Horizontal ) s2 = Qt::Slider.new( Qt::Horizontal ) Qt::Object.connect( s1, SIGNAL("valueChanged(int)"), s2, SLOT( "setValue(int)") ) Qt::Object.connect( s2, SIGNAL("valueChanged(int)"), s1, SLOT( "setValue(int)") ) s1.show s2.show app.exec Monday, August 6, 12
  10. Qt Stock Dialogs require 'Qt' require './demo1_ui.rb' a = Qt::Application.new(ARGV)

    u = Ui_Form.new w = Qt::Widget.new u.setupUi(w) w.show u.btn1.connect( SIGNAL :clicked ) { filename = Qt::FileDialog.get_open_file_name; u.list1.add_item( filename ) } a.exec Monday, August 6, 12
  11. QtRuby • Easy UI for your programs • Solid Foundations

    • Use existing Qt knowledge Monday, August 6, 12