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

Robert Riemann robert.riemann at physik.hu-berlin.de
Mon Aug 30 06:48:56 UTC 2010


There is a ruby + kde4 (korundum4) help page in the kde wiki.
> http://techbase.kde.org/Development/Languages/Ruby
The most things should be valid for Qt only, too.
There are also some example based tutorials in the web.
http://techbase.kde.org/Development/Languages/Ruby#Tutorials

Qt C++ -> ruby is in the most cases done as you might expect.

A pointer to nothing ( *parent = 0 )  in C++ is just nil in ruby.
object = Qt::Object.new(nil)

Best regards,
Robert

Am Montag, 30. August 2010, 00:45:29 schrieb commb07 at googlemail.com:
> 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
> 
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20100830/116684a9/attachment.sig>


More information about the Kde-bindings mailing list