Saturday, December 18, 2010

Installing Qt-Ruby

[Update] Currently I use qtbindings instead of Qt-Ruby. The main reason I switched is that Qt-Ruby is not in active development and has not support for Ruby 1.9.x. See "Installing qtbindings on Ubuntu" (http://socrateos.blogspot.com/2011/05/installing-qtbindings.html). So the instruction below is no longer relevant for me.


1. Install Qt
Open Ubuntu Software Center from Application menu.
Find Qt Creator in Development/IDE group and install it.

2. Install Qt-Ruby
Open Synaptic Package Manager
Search for qt-ruby
Install libqt4-ruby

3. Test Qt-Ruby installation
$ irb
irb(main):001:0>require 'Qt4'
=> true
irb(main):002:0> 

4. Write simple program.
# helloworld.rb
# based on tutorial on http://www.darshancomputing.com/qt4-qtruby-tutorial/ 
# 
require 'Qt4'

app = Qt::Application.new ARGV
btn = Qt::PushButton.new 'Hello, World!'
btn.resize 100,30
btn.show

app.exec

5. Run it






6. Resouces
http://www.darshancomputing.com/qt4-qtruby-tutorial/

7. Notes.
There is no Qt-Ruby for Ruby 1.9.1 in the repositories.
Is there any, somewhere?

No comments:

Post a Comment