[Kde-bindings] Qt::Object#find_children doesn't work correctly with classes defined in ruby with 4.4 branch of smoke/korundum

Stefano Crocco stefano.crocco at alice.it
Wed Feb 3 12:33:56 UTC 2010

In theory, Qt::Object#find_children should return all children of the given 
class. However, if the class I pass as argument is defined in ruby, rather 
than in C++, the method returns a list of all children of the object instead. 
You can see this running the following code:

require 'Qt4'

class W < Qt::Widget

a = Qt::Application.new []
mw = Qt::MainWindow.new
w1 = W.new mw
w2 = Qt::PushButton.new mw
p mw.find_children(W)
p mw.find_children(Qt::PushButton)

mw.find_children(Qt::PushButton) correctly returns an array with a single 
element, w2. mw.find_children(W), however, returns an array with three 
elements: one of class Qt::RubberBand, one of class W and one of class 
Qt::PushButton. The expected behaviour, instead, is to return an array with a 
single element of class W.

By the way, I just noticed that qtruby givens a huge number of warnings when 
running under ruby 1.9 (actually, there are only two warnings but they're 
repeated a large number of times). The simple code

require 'Qt4'

if ruby is run with the -w switch produces a list of this two warnings:

/usr/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2498: warning: method redefined; 
discarding old const_missing
/usr/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2498: warning: method redefined; 
discarding old method_missing

I tried to find out the cause, but I don't know enough of qtruby internals to 
find out what's wrong.

Also ruby 1.9 complains about a wrong indentation in line 1381 of qtruby4.rb. 
Looking at that line, it's clear that the indentation is indeed wrong.

Thanks for the attention


More information about the Kde-bindings mailing list