[Kde-bindings] korundum4: findChild raises error when the first argument is not Qt::Object

Stefano Crocco stefano.crocco at alice.it
Wed Jan 21 10:16:23 UTC 2009


I just came across this issue: in korundum 4, passing anything other than 
Qt::Object as first argument to findChild (or findChildren) gives an error. 
Passing Qt::Object works correctly. Here's an example which works

o1 = Qt::Object.new
o2 = Qt::Object.new o1
o2.object_name = 'o2'
p o1.find_child(Qt::Object, 'o2') #=> #<Qt::Object:0xb6554748 objectName="o2">

Here's a non-working example:

require 'Qt4'

app = Qt::Application.new []
w = Qt::Widget.new
w1 = Qt::Label.new w
w1.object_name = 'label'
p w.findChild( Qt::Label, 'label')

The error I get is:

/home/stefano/documenti/scripts/prova.rb:7:in `method_missing': undefined 
method `staticMetaObject' for Qt::Label:Class (NoMethodError)
	from /home/stefano/documenti/scripts/prova.rb:7:in `findChild'
	from /home/stefano/documenti/scripts/prova.rb:7
Process exited with code 1

w.children, instead, shows correctly that the label is child of the widget w.
The same code in C++ works as expected.

Am I missing something or is it a bug?

Thanks in advance

Stefano



More information about the Kde-bindings mailing list