Friday, July 8, 2011

Installing qtbindings on Ubuntu (11.04)

I installed qtbindings on my Ubuntu 11.04.

1. Resources
RubyGems.org: http://rubygems.org/gems/qtbindings
QtBindings Homepage: https://github.com/ryanmelt/qtbindings
Qt Homepage: http://qt.nokia.com/
My Previous Installation (Ubuntu 10.10): http://socrateos.blogspot.com/2011/05/installing-qtbindings.html
My Installation on Windows: http://socrateos.blogspot.com/2011/06/installing-qtbindings-alt-qt-ruby-on.html

2. Requirements
Qt 4.6.x -- already installed (via installation of Qt Creator)
cmake 2.6.3+ -- I used Synaptic to install (2.8.3)
gcc 4.x -- already installed
Ruby -- already installed (Installing Ruby 1.9.2 on Ubuntu (11.04))

3. Installation
WARNING: This takes really long time. It took over 5 min for me.
$ sudo gem install qtbindings
Building native extensions.  This could take a while...  # get some coffee
Successfully installed qtbindings-4.6.3.2
1 gem installed
Installing ri documentation for qtbindings-4.6.3.2...
Installing RDoc documentation for qtbindings-4.6.3.2...

4. Test
$ irb
irb(main):001:0> require 'Qt'
=> true
irb(main):002:0> a = Qt::Application.new(ARGV)
=> #<Qt::Application:0x97f20ac objectName="irb">
irb(main):003:0> button = Qt::PushButton.new('Hello World!',nil)
=> #<Qt::PushButton:0x97d199c objectName="", x=0, y=0, width=640, height=480>
irb(main):004:0> button.resize 300, 30
=> nil
irb(main):005:0> button.show
=> nil
irb(main):006:0> a.exec
=> true

5. Result

1 comment:

  1. thanks, I'm also new to ruby and this is really helpful

    ReplyDelete