[Kde-bindings] How to correctly use properties with QtRuby?

Grigory Petrov grigory.v.p at gmail.com
Tue Nov 8 15:39:19 UTC 2011


Hello.

QtRuby documentation
(http://techbase.kde.org/Development/Languages/Ruby#Properties) states
that properties are supported: "'foobar = 5' is a synonym for
'setFooBar(5)'". But the following code:

require 'rubygems'
require 'Qt'
puts Qt::Object.new { object_name = "test" }.object_name

Displays "nil", so assigning property inside block seems to fail.
Using setter function inside block works:

require 'rubygems'
require 'Qt'
puts Qt::Object.new { setObjectName( "test" ) }.object_name

This correctly displays new object name. Why i can't assign property
inside block?



More information about the Kde-bindings mailing list