[Kde-bindings] Re: weird behaviour of some classes' #text method in korundum

Arno Rehn arno at arnorehn.de
Mon Jan 31 16:43:05 UTC 2011


On Monday 31 January 2011 10:29:18 Stefano Crocco wrote:
> Hello to everyone,
> I just found out what I consider a bug. There are some classes with a #text
> method which behaves strangely. Take for example the following code
> 
> require 'Qt4'
> app = Qt::Application.new []
> w = Qt::Label.new; p w.text # => nil
> w.text = ''; p w.text # => nil
> w.text = 'xyz'; p w.text # => "xyz"
> w.text = ''; p w.text # => ""
Yes, this is expected behaviour. The QString marshaller takes 
QString::isNull() into account (see the Qt docs for that).
I really don't know whether this makes sense or not. For example, you can 
assign 'nil' to any QString property. When you do

w.text = nil
w.text

should it return nil or ""?  From a C++ this all makes sense, but I'm not sure 
though in how far we want to reflect that behaviour in Ruby.
Any thoughts?

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list