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

Robert Riemann robert.riemann at physik.hu-berlin.de
Sun Aug 29 09:29:45 UTC 2010


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
-------------- 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/20100829/8a476cbd/attachment.sig>


More information about the Kde-bindings mailing list