[Kde-bindings] custom ruby objects and QVariant

Robert Riemann robert.riemann at physik.hu-berlin.de
Wed Jul 21 15:00:30 UTC 2010


SOLVED:
kde-bindings: arnorehn * r1152585 
/trunk/KDE/kdebindings/ruby/qtruby/src/qtruby.cpp: Make it possible to store 
ruby object in QVariants

Am Sonntag, 18. Juli 2010, 02:48:38 schrieben Sie:
> Hi all,
> 
> I have to transport a custom ruby Object from a model to a
> QStyledItemDelegate. Therefor I am using
> QModelIndexy#data(CustomRole) function.
> 
> In the wiki I found to proposals for wrapping own objects into a Variant.
> The first one doesnt work, because #data(role) seems to transform the
> RubyVariant into a QVariant and this way the backpacker value gets lost.
> 
> The second way is more promising:
> http://techbase.kde.org/Development/Languages/Ruby#Alternate_way_to_emit_Ru
> by_Classes
> 
> Unfortunatly I run into this error:
> /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2241:in `initialize': integer
> 69920177469160 too big to convert to `int' (RangeError)
>         from /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2241:in
> `initialize' from /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2640:in
> `call' from /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2640:in
> `try_initialize'
>         from /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2639:in `catch'
>         from /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2639:in
> `try_initialize'
>         from ./main.rb:23:in `new'
>         from ./main.rb:23:in `to_variant'
> 
> 
> I got it fixed wtih a dirty hack:
> Qt::Variant.new object_id.to_f instead of Qt::Variant.new object_id.to_f
> 
> How can this be done without using Floats?
> 
> Best regards,
> Robert




More information about the Kde-bindings mailing list