I'm looking for any! information about ruby and QT

Hi,
I tried it severaly times now but always failed. I want to make a ruby application that uses QT but I'm lacking information about it. I'm never succeding in getting that to work what I did. I know there is a ebook for 10$ but I really don't have the money and I'm no professional coder but a hobby coder.
So I wondered can anybody point me to free information about it ?

I know these links and the ones linked in them:
http://www.arachnoid.com/ruby/RubyGUIProject/index.html
http://developer.kde.org/language-bindings/ruby/index.html

If someone is itself familiar with ruby and qt maybe you can help me?
I generated with qt4-designer this rss.ui: http://nopaste.php-q.net/309650 and converted it with rbuic to this rss.rb: http://nopaste.php-q.net/309649

Now I try to show this Qt-window with that code:

#!/usr/bin/qtrubyinit
require '/home/myuser/Desktop/rss.rb'

class RssShow < MainWindow
    def initialize(app)
       super()
       @app = app
    end
end

# create and show dialog
if $0 == __FILE__
    app = Qt::Application.new(ARGV)
    dialog = RssShow.new(app)
    app.mainWidget = dialog
    dialog.show
    app.exec
end

but it always fails and gives me that error:
$ ./rss-show.rb
/home/myuser/Desktop/rss.rb:15:in `const_missing': uninitialized constant MainWindow::WType_TopLevel (NameError)
         from /home/myuser/Desktop/rss.rb:15:in `initialize'
         from ./rss-show.rb:6:in `initialize'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1682:in `call'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1682:in `try_initialize'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1681:in `catch'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1681:in `try_initialize'
         from ./rss-show.rb:14:in `new'
         from ./rss-show.rb:14

Does anybody know why? Or can point me to further information about ruby and Qt?

···

--
greets

                     one must still have chaos in oneself to be able to give birth to a dancing star

If someone is itself familiar with ruby and qt maybe you can help me?

You are mixing Qt versions, and that won't work. The UIC file you generated came
from Qt 4, but the Qtruby stuff that you're working with looks to be for Qt 3.
You'll need to pick one version or the other and stick with it from both the Qt side
and the QtRuby side.

Caleb

Sorry for some lobbying here, but maybe it helps.
What about Ruby Gnome2/GTK it is so well documented, or is it Qt for
some special reason? in that case please ignore this as noise on the
wire ...
http://ruby-gnome2.sourceforge.jp/

Cheers
Robert

···

On 7/12/07, anansi <kazaam@oleco.net> wrote:

Hi,
I tried it severaly times now but always failed. I want to make a ruby
application that uses QT but I'm lacking information about it. I'm never
succeding in getting that to work what I did. I know there is a ebook
for 10$ but I really don't have the money and I'm no professional coder
but a hobby coder.

--
I always knew that one day Smalltalk would replace Java.
I just didn't know it would be called Ruby
-- Kent Beck

Alle giovedì 12 luglio 2007, anansi ha scritto:

Hi,
I tried it severaly times now but always failed. I want to make a ruby
application that uses QT but I'm lacking information about it. I'm never
succeding in getting that to work what I did. I know there is a ebook
for 10$ but I really don't have the money and I'm no professional coder
but a hobby coder.
So I wondered can anybody point me to free information about it ?

I know these links and the ones linked in them:
http://www.arachnoid.com/ruby/RubyGUIProject/index.html
http://developer.kde.org/language-bindings/ruby/index.html

If someone is itself familiar with ruby and qt maybe you can help me?
I generated with qt4-designer this rss.ui:
http://nopaste.php-q.net/309650 and converted it with rbuic to this
rss.rb: http://nopaste.php-q.net/309649

Now I try to show this Qt-window with that code:

#!/usr/bin/qtrubyinit
require '/home/myuser/Desktop/rss.rb'

class RssShow < MainWindow
    def initialize(app)
       super()
       @app = app
    end
end

# create and show dialog
if $0 == __FILE__
    app = Qt::Application.new(ARGV)
    dialog = RssShow.new(app)
    app.mainWidget = dialog
    dialog.show
    app.exec
end

but it always fails and gives me that error:
$ ./rss-show.rb
/home/myuser/Desktop/rss.rb:15:in `const_missing': uninitialized
constant MainWindow::WType_TopLevel (NameError)
         from /home/myuser/Desktop/rss.rb:15:in `initialize'
         from ./rss-show.rb:6:in `initialize'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1682:in `call'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1682:in `try_initialize'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1681:in `catch'
         from /usr/lib/ruby/1.8/Qt/qtruby.rb:1681:in `try_initialize'
         from ./rss-show.rb:14:in `new'
         from ./rss-show.rb:14

Does anybody know why? Or can point me to further information about ruby
and Qt?

Qt is well documented. There's the qt reference
(http://doc.trolltech.com/4.3/index.html\), which, while witten for C++, can
be translated to ruby almost directly. Besides, in the qtruby distribution
(http://rubyforge.org/projects/korundum\), there are a lot of example written
in ruby (they're the ports to ruby of the C++ examples provided with Qt). The
examples include the tutorial described in the qt documentation
(http://doc.trolltech.com/4.3/examples.html#qt-tutorial\).

I hope this helps

Stefano

Alle venerdì 13 luglio 2007, Stefano Crocco ha scritto:

Qt is well documented. There's the qt reference
(http://doc.trolltech.com/4.3/index.html\), which, while witten for C++, can
be translated to ruby almost directly. Besides, in the qtruby distribution
(http://rubyforge.org/projects/korundum\), there are a lot of example
written in ruby (they're the ports to ruby of the C++ examples provided
with Qt). The examples include the tutorial described in the qt
documentation
(http://doc.trolltech.com/4.3/examples.html#qt-tutorial\).

I hope this helps

Stefano

I forgot, the examples are located in the ruby/qtruby/examples directory in
the qtruby source directory.

Stefano

Caleb Tennis wrote:

If someone is itself familiar with ruby and qt maybe you can help me?

You are mixing Qt versions, and that won't work. The UIC file you generated came
from Qt 4, but the Qtruby stuff that you're working with looks to be for Qt 3. You'll need to pick one version or the other and stick with it from both the Qt side
and the QtRuby side.

Caleb

Hi yes I did the ui file with qt4-designer but what do you mean with qtruby stuff? I just wanna use qt4 but where can I check which is used by ruby? I have qt4 installed!

@steffano: thanks for these links! I'ckeck them soon as this versioning problem is solved.

@robert: I heard a lot of good things about qt so I wanna work with it a bit :slight_smile:

Does anybody know how I can check that just qt4 is used?

I'm working under ubuntu linux.

···

--
greets

                     one must still have chaos in oneself to be able to give birth to a dancing star

Hi yes I did the ui file with qt4-designer but what do you mean with
qtruby stuff? I just wanna use qt4 but where can I check which is used
by ruby? I have qt4 installed!

I can tell just by looking at the .rb file you generated when you ran "rbuic". On
my system (which is not ubuntu, so it may be different), the one for Qt4 is called
"rbuic4", and it generates a completely different type of output. The ui stuff
between Qt3 and Qt4 changed dramatically, and my guess is that whatever tutorial or
information you're using is geared for Qt3.

But the fact that you have both sets of qtruby toolkits installed will probably lead
to confusion. I would get rid of the qtruby for Qt3 if you want to stick with the
Qt4 version. You can fire up irb to find out what you're using:

tc@tc12 ~/test $ irb
irb(main):001:0> require 'Qt'
Q=> true
irb(main):002:0> Qt::version
=> "3.3.6"

tc@tc12 ~/test $ irb
irb(main):001:0> require 'Qt4'
Qt=> true
irb(main):003:0> Qt::version
=> "4.3.0"

Caleb Tennis wrote:

@steffano: thanks for these links! I'ckeck them soon as this versioning
problem is solved.

@robert: I heard a lot of good things about qt so I wanna work with it a
bit :slight_smile:

Sure I did some lobbying because it was not completely clear what you
wanted and I thought it might be helpful...
Stefano firmly defended QT and that got you somewhere I hope.
I do not think at all that QT is bad and I did not say so (scusami
Stefano se avessi dato 'sta impressione), I have no idea how it
integrates with Ruby, let us know more about it will you?

Cheers
Robert

···

On 7/13/07, anansi <kazaam@oleco.net> wrote:
--
I always knew that one day Smalltalk would replace Java.
I just didn't know it would be called Ruby
-- Kent Beck

I got out what the mistake is. It's a ruby bug which makes it impossible to install libqt4-ruby and rbuic for qt4 at the same time: Bug #125865 “error when installing libqt0-ruby1.8-qt4 and libqt4...” : Bugs : libqt4-ruby package : Ubuntu

So I had qt3 and qt4 mixed.. I need to wait for a fix of these packages now.

Caleb Tennis wrote:

···

Hi yes I did the ui file with qt4-designer but what do you mean with
qtruby stuff? I just wanna use qt4 but where can I check which is used
by ruby? I have qt4 installed!

--
greets

                     one must still have chaos in oneself to be able to give birth to a dancing star

anansi wrote:

It's a ruby bug which makes it impossible

A Ubuntu bug I meant, no ruby bug..

···

--
greets

                     one must still have chaos in oneself to be able to give birth to a dancing star