[Kde-bindings] How to correctly use properties with QtRuby?
Sylvain L. Sauvage
Sylvain.L.Sauvage at free.fr
Tue Nov 8 16:35:58 UTC 2011
Le mardi 8 novembre 2011 à 16:39:19, Grigory Petrov a écrit :
> Hello.
Hi,
>[…]
> puts Qt::Object.new { object_name = "test" }.object_name
>
> Displays "nil", so assigning property inside block seems to
> fail.
When you write 'object_name = "test"', you create a new local
variable called 'object_name', you don’t call the function
'object_name=()'.
To specifically call the function, you have to tell Ruby, for
example by adding 'self.':
puts Qt::Object.new { self.object_name = "test" }.object.name
→ test
--
Sylvain Sauvage
More information about the Kde-bindings
mailing list