>> require 'Qt'
>> require 'qtuitools'
>> app = Qt::Application.new 
>> ui = Qt::UiLoader.new
>That helps a bit! I'm only one step further however:
>ruby-1.9.2-p0 > require 'Qt'
> => true
>ruby-1.9.2-p0 > require 'qtuitools'
> => true
>ruby-1.9.2-p0 > app = Qt::Application.new 
> => #<Qt::Application:0x000000026b7590 objectName="irb">
>ruby-1.9.2-p0 > ui = Qt::UiLoader.new
> => #<Qt::UiLoader:0x000000026a81a8 objectName="">
>ruby-1.9.2-p0 > ui.load
>NoMethodError: private method `load' called for
> from (irb):6:in `method_missing'
> from (irb):6
> from /home/mfischer/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'
You're calling the load method with the wrong arguments. I think that, due to
the way the qt bindings work, this ends up calling Kernel#load, which is a
private method and therefore can't be called with a receiver. To have your
code work, you just need to follow the example you posted in your previous
app = Qt::Application.new 
loader = Qt::UiLoader.new
#Create a file pointing to the .ui file you want to load. Unfortunately, you
#can't use a ruby file here
file = Qt::File.new '/path/to/ui/file.ui'
#open the file
#At last, load the ui file. If the widget contained in the ui file should be
#a child of another widget, pass that widget as secon argument instead of nil
widget = loader.load file, nil
#Close the file
#Now do whatever you like with the widget. For example,
>It's a bit hard currently to not get lost with these different QT ruby
>So there's the qtruby4 gem which only contains binaries for mswin32 (and
>it's not mingw32, either). If you want qtruby4 anywhere else, manual
>source compilation is required.
>Then we've the gem "qtbindings" which attempts to address the
>shortcoming of qtruby4 not available on non-windows platforms, which is
>fairly new and which I'm using.
>Sometimes skimming through the docs I also find references to korundum
>(e.g. http://rubyforge.org/projects/korundum/ ) which I've no clue what
>Is the rubyforge project related to the qtruby4 gem or is it something
>That's all really confusing.
Actually, there's only one qt ruby bindings. The situation is the following.
The Qt ruby bindings have been born as a part of the ruby bindings for KDE (in
case you don't know, KDE is a desktop environment born for Linux and based on
the Qt libraries). This is "korundum".
Since KDE is based on Qt, korundum also contains bindings for all of the Qt
classes, so the developers decided to allow users who don't have KDE to
install only the parts of korundum containing the bindings to Qt. This is Qt
ruby (or qtruby).
Originally, the build system of qtruby was the same as the KDE one, based on
the cmake utility. This wasn't very easy, expecially on windows (this also
happened because new releases of qtruby weren't released very often, so to
obtain a newer version, you often needed to start from the korundum sources
and modify the build system to remove anythig related to KDE before starting
compiling). To make things easier for windows users, a windows binary gem of
qtruby was created and called qtruby4.
Now, it seems, the korundum developers have decided to create a proper gem for
qtruby, which is what you're using. I can't say much on this, as I didn't know
about it until I read your mail
>Stefano: if I may ask, in which environment are you developing?
I'm using the ruby bindings for KDE (that is, korundum) on gentoo linux
I hope this helps
On Sunday 26 September 2010, Markus Fischer wrote:
>On 26.09.2010 22:50, Stefano Crocco wrote: