[Kde-bindings] qtruby getting started and model/view problems

commb07 at googlemail.com commb07 at googlemail.com
Sun Aug 29 22:45:29 UTC 2010


thanks a lot, that QVariant fixed it; i should have seen the QVariant
return type in the c++-sourcecode.
i also changed the flags-method to a class-method by def self.flags, now
it works for me.
and thanks again for the smokeapi -r qtgui tip, that will be quite helpful.

are there any sources of information about the differences between
qtruby and qt in c++, for example how i can do this
QObject *parent = 0
in ruby?



-------- Original-Nachricht --------
Betreff: Re: [Kde-bindings] qtruby getting started and model/view problems
Von: Robert Riemann <robert.riemann at physik.hu-berlin.de>
An: KDE bindings for other programming languages <kde-bindings at kde.org>
Datum: 29.08.2010 11:29
> On Sunday 29 August 2010 01:25:25 commb07 at googlemail.com wrote:
>>  hi
>>
>> i
> have recently discovered qtruby4 and it seems very nice. But i have
>> some
> trouble finding information on how to deal with some differences
>> from c++
> and ruby.
>> if there are no ruby-classes for some c++-classes, how am i
> supposed to
>> deal with this? for example the QString or QStringList have
> no
>> equivalent, should i use ruby strings and arrays?
>> or if there is
> QObject *parent = 0 as default argument, what can i do?
>>
>> and i have an
> even bigger problem, i tried to get started by
>> 'translating' this example
> from the qt4.6-documentation:
>>
> http://doc.qt.nokia.com/4.6/model-view-creating-models.html
>>
>> but i get a
> segmentation fault, and i just don't know enough to
>> understand why. i put
> my ruby-file in the attachment, it would be very
>> nice if someone could
> help me find the problem(s).
>>
>> (i'm using ruby 1.8.7 and qtruby-2.1.0,
> tried under ubuntu 10.04 and win 7)
> 
> 
> Hi,
> 
> change the line where you set the
> text into this one and comment your flags method and it works:
> 
> return
> Qt::Variant.new @stringList.at(index.row())
> 
> You have to convert your string
> manually into a QVariant as it is required for data() return type.
> 
> I don't
> know why flags don't work. There seems to be no method like this in the
> abstract class. You may want to check with a command like this
> which methods
> can be found:
>> smokeapi -r qtgui QListView | grep Event
> 
> Best
> regards,
> Robert
> 
> 
> 
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings



More information about the Kde-bindings mailing list