[Kde-bindings] QtRuby section in my book

Jason D. Clinton me at jasonclinton.com
Wed Apr 5 19:47:13 UTC 2006


Hello list;

I've been lurking for quite some time but I finally have something to
say. I have a section in my upcoming book on using QtRuby for RAD. The
book is a 'quick reference/pocket reference' style of book called Ruby
Phrasebook (it's up on Amazon.com). Anyway, it covers Qt4 since that's
the first release that's GPL for all platforms. Below I have a "Hello
World" example that I wanted to run by you guys: see any major problems
with my approach WRT Qt4? There's no documentation out there, yet ...


require 'Qt'

app = Qt::Application.new ARGV

class MyDialog < Qt::Widget
  slots 'button_clicked()'
  
  def initialize(parent=nil)
    super(parent)
        
    @vgroup = Qt::VBoxLayout.new
    @button = Qt::PushButton.new "Hello World!"
    @edit   = Qt::LineEdit.new "Hello?"
    
    @vgroup.addWidget @button
    @vgroup.addWidget @edit
    
    connect @button, SIGNAL('clicked()'), self,
            SLOT('button_clicked()')
    
    self.setLayout @vgroup
  end
  
  def button_clicked()
    @edit.text = 'Hello! Hello!'
  end
end
  
window = MyDialog.new
window.show

app.exec

-- 
Jason D. Clinton <me at jasonclinton.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20060405/e0d42dfd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20060405/e0d42dfd/attachment.sig>


More information about the Kde-bindings mailing list