Upgrade to Pro — share decks privately, control downloads, hide ads and more …

QtRuby In Action

ynonperek
August 03, 2012

QtRuby In Action

My talk at August Penguin 2012.
Introducing how to use Qt with Ruby programming language

ynonperek

August 03, 2012
Tweet

More Decks by ynonperek

Other Decks in Technology

Transcript

  1. Introducing QtRuby
    Ynon Perek
    http://qtcollege.co.il
    Friday, August 3, 12

    View full-size slide

  2. Friday, August 3, 12

    View full-size slide

  3. Friday, August 3, 12

    View full-size slide

  4. sudo apt-get install lynx
    Friday, August 3, 12

    View full-size slide

  5. Friday, August 3, 12

    View full-size slide

  6. Agenda
    • GUI Programming
    • Qt Framework
    • QtRuby In Action
    Friday, August 3, 12

    View full-size slide

  7. About Me
    • Ynon Perek
    [email protected]
    • http://qtcollege.co.il
    Friday, August 3, 12

    View full-size slide

  8. Desktop UI
    Friday, August 3, 12

    View full-size slide

  9. GUI Frameworks
    Friday, August 3, 12

    View full-size slide

  10. Choose Qt
    • Easy To Start
    Friday, August 3, 12

    View full-size slide

  11. Choose Qt
    • Easy To Start
    • Mature and widely used
    Friday, August 3, 12

    View full-size slide

  12. Famous Qt Apps
    Friday, August 3, 12

    View full-size slide

  13. Famous Qt Apps
    Friday, August 3, 12

    View full-size slide

  14. Choose Qt
    • Easy To Start
    • Mature and widely used
    • True Cross Platform
    Friday, August 3, 12

    View full-size slide

  15. Choose Qt
    Friday, August 3, 12

    View full-size slide

  16. Choose Qt
    • Easy To Start
    • Mature and widely used
    • True Cross Platform
    • Cross Language
    Friday, August 3, 12

    View full-size slide

  17. Choose Qt
    • C++
    • Java
    • Ruby
    • Perl
    • Python
    • And More...
    Friday, August 3, 12

    View full-size slide

  18. Q & A
    Friday, August 3, 12

    View full-size slide

  19. 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
    Friday, August 3, 12

    View full-size slide

  20. Qt Terminology
    • a Widget is a visible
    component
    • Label, Button,
    Table, List, ...
    Friday, August 3, 12

    View full-size slide

  21. Qt Terminology
    Widget
    Friday, August 3, 12

    View full-size slide

  22. Qt Widgets
    Friday, August 3, 12

    View full-size slide

  23. Qt Widgets
    http://doc.qt.nokia.com/4.7-snapshot/gallery.html
    Friday, August 3, 12

    View full-size slide

  24. Qt Layouts
    • A top level widget
    may contain other
    widgets
    • Child widgets are
    arranged in a
    layout
    Friday, August 3, 12

    View full-size slide

  25. DEMO: UI Designer
    Friday, August 3, 12

    View full-size slide

  26. Qt Terminology
    • Signal specifies a
    semantic event
    Friday, August 3, 12

    View full-size slide

  27. Qt Terminology
    • Signals are
    connected to slots
    which are the
    handling code
    Friday, August 3, 12

    View full-size slide

  28. 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
    Friday, August 3, 12

    View full-size slide

  29. 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
    Friday, August 3, 12

    View full-size slide

  30. Qt Stock Dialogs
    • Qt::MessageBox.about
    • Qt::FileDialog.get_open_file_name
    • Qt::FileDialog.get_save_file_name
    Friday, August 3, 12

    View full-size slide

  31. 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
    Friday, August 3, 12

    View full-size slide

  32. Q & A
    Friday, August 3, 12

    View full-size slide

  33. QtRuby
    • Easy UI for your programs
    • Solid Foundations
    Friday, August 3, 12

    View full-size slide

  34. What Next
    • Qt Developers Meetup
    • August 7, 19:00
    • http://meetup.com/QtEverywhere/
    Tel-Aviv-Yafo-IL/740512/
    Friday, August 3, 12

    View full-size slide

  35. Resources
    • Ruby Qt/KDE Guide
    http://techbase.kde.org/Development/
    Languages/Ruby
    • Qt Tutorial Videos
    http://qt-project.org/videos
    Friday, August 3, 12

    View full-size slide

  36. About Me
    • Ynon Perek
    [email protected]
    • http://qtcollege.co.il
    Friday, August 3, 12

    View full-size slide