Qtruby


Cute the ruby!
I'm experiment the Qtruby(my new affair), ruby whit the Qt toolkit.
The currently Qt version is the 4, I use the 4° version on this tutorial
First install the package: qt4-qtruby
Let's go to the "Hello World" :

require 'Qt4'
app = Qt::Application.new(ARGV)
hello = Qt::PushButton.new('Oba oba!')
hello.resize(100, 40)
hello.show()

app.exec()

And the magic started:


Learning the line by line:
require 'Qt4' - This line import the Qtruby extension
app = Qt::Application.new(ARGV) - It is essential, build the interface
hello = Qt::PushButton.new('Oba oba!') - Create a button whit the message: Oba oba!
hello.resize = The button's resize
hello.show = when you write this the widget can be visible.
app.exec() = it execute the app

The end of this post, but I will go write more tutorials about Qtruby.

0 comentários: