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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
anansi (Guest)
on 2007-07-12 19:57
(Received via mailing list)
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
Caleb T. (Guest)
on 2007-07-12 20:14
(Received via mailing list)
> 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
Robert D. (Guest)
on 2007-07-12 23:36
(Received via mailing list)
On 7/12/07, anansi <removed_email_address@domain.invalid> 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.
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
Stefano C. (Guest)
on 2007-07-13 15:45
(Received via mailing list)
Alle giovedì 12 luglio 2007, anansi ha scritto:
> http://www.arachnoid.com/ruby/RubyGUIProject/index.html
> Now I try to show this Qt-window with that code:
>
> but it always fails and gives me that error:
>          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
Stefano C. (Guest)
on 2007-07-13 15:48
(Received via mailing list)
Alle venerdì 13 luglio 2007, Stefano C. ha scritto:
>
> Stefano

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

Stefano
anansi (Guest)
on 2007-07-13 21:11
(Received via mailing list)
Caleb T. 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 :)

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
Caleb T. (Guest)
on 2007-07-13 21:24
(Received via mailing list)
> 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"
Robert D. (Guest)
on 2007-07-14 00:10
(Received via mailing list)
On 7/13/07, anansi <removed_email_address@domain.invalid> wrote:
> Caleb T. 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 :)
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
anansi (Guest)
on 2007-07-15 14:32
(Received via mailing list)
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:
https://bugs.launchpad.net/ubuntu/+source/libqt4-r...

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

Caleb T. 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 (Guest)
on 2007-09-26 01:04
(Received via mailing list)
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
This topic is locked and can not be replied to.