From: Stefano Crocco Date: 2010-11-22T01:43:28+09:00 Subject: Re: Qt-Ruby implementation of the "Address Book Example" On Monday 22 November 2010 00:05:32 Arturo Bonechi wrote: > Stefano Crocco wrote in post #962925: > > I don't think you can do that. It seems that neither QHash nor QMap are > > implemented in qtruby, and passing a native ruby hash doesn't seem to > > work. In my opinion, being restricted to using C++ types is one of the > > most serious weaknesses of qtruby. In your case, I think the best option > > would be to declare both signal with a string argument, then convert the > > hash to a string (using Marshal or YAML) before emitting the signal and > > converting it back in the slot. > > So, I suppose that I need to do this conversion with arrays too... If > that is the price to pay it's Ok for me. Yes, you need to do that also for arrays, except when they stand for a QStringList (and maybe some other specialized class). > One last question : > In the Qt-Ruby declaration of signals and slots, the C++ keywords > "const" and "&" are sometimes added, but they aren't added in the code > when a slot is "connected" (only the C++ type is mentioned). > > For example : > ... > slots 'a_slot(const QString&)' > ... > connect an_object, SIGNAL('a_signal(QString)'), self, > SLOT('a_slot(QString)') > ... > > Must I add those keywords to the declaration or are they optional? When > do I know that I have to add them? No, you don't need them. The only modifier you need is the * for pointers. For example, slots 'my_slot(QObject*)' would be correct, while slots 'my_slot(QObject)' would give you an error Stefano -- Posted via http://www.ruby-forum.com/.