[Kde-bindings] Uniform Qt Bindings for JRuby and Ruby

Cees Zeelenberg cees.zeelenberg at pg37.eu
Sun May 20 10:38:41 UTC 2012

On Thursday, May 17, 2012 03:21:32 PM Cees Zeelenberg wrote:

>> Hi everyone,


>> This may be of interest to some on this forum.  I have just uploaded a

>> Gem package (qt_connect) with the aim to provide  a uniform Qt API for

>> Ruby and JRuby platforms. The Gem provides JRuby bindings to the Qt Jambi

>> library with an (optional) extension to provide backward compatibility

>> existing Qt Ruby programs.


>> The same Gem package provides for Qt Ruby programs a QtJambi inspired

>> interface to the Signals/Slots system without the need to use C++

>> signatures.




>> download from RubyGems.org: gem install qt_connect




>> project on github:  <https://github.com/CeesZ/qt_connect>

On Thursday, May 17, 2012 17:18:03 Richard Dale wrote:

>Interesting project - thanks for providing backwards compatibility with 

>QtRuby. I have been a bit poor at moving the QtRuby 3.0 development forward

>recently, but I haven't given up and I think I will manage to get started 

>again soon. I am quite excited about the Raspberry Pi, Qt 5 and Ruby 2.0
and I 

>think there are a lot of reasons for wanting to carry on getting a really

>CRuby binding working.


>I think it would be a good idea if I could add some compatibilty with the 

>Ruby/QtJambi based bindings in QtRuby 3.0, particularly the slots and

>yntax, and I'll study your examples and api at some point and try and do 



>-- Richard

I certainly share your enthusiasm for the Raspberry Pi, Qt 5 and Ruby 2.0.
Particularly Nokia's funding

for 400 Raspberry Pi boards for Qt5 applications seems one of the better
investments they have made

lately. I don't know how the project  has worked out so far, but it should
be an attractive challenge

to many kids and bring a bit of pioneering spirit to Qt  computing.

A CRuby Qt binding which would work for all flavors of Ruby would definitely
be my choice solution, but I

find it hard to estimate the amount of work involved - seems a lot to me -.
Maybe it is possible to write

(or better generate) an ffi based interface to the Qt libraries with a pure
Ruby wrapper for added

functionality. I really haven't studied Smoke or other binding technologies
in detail, so I am not

in a position to compare the different methods)

As far as QtRuby 3.0 is concerned, QtJambi may be interesting for more than
the Signals/Slot interface.

Java and Ruby have quite a few things in common which distinguish them from
C++. For instance single

inheritance and the use of  interfaces/modules. It is interesting how these
are used in QtJambi (e.g.

for Enum's and Signal emitting classes)

Also QtJambi has (virtually) eliminated the QVariant class. This makes
simpler and more readable code.

I think the same could be done for QtRuby. Also a bit of 'behind the scenes'
duck typing would make

application code easier and more readable. For instance in many method calls
it is necessary to add

.value or .to_int to one or more of the arguments which is not very

Also compatibility with the current version should be a major concern, at
least for those who have

invested in QtRuby programming.

Sofar a few of my thoughts on a new version of QtRuby, if I can be of
further help let me know.

For the moment one practical question you may be able to answer: I would
like to cycle through

all Qt classes in order to compare them with their QtJambi counterparts. I
have used the MetaObject

class but I have not found an enumerator which will pass me all classes. Do
you know of a

way to do this in QtRuby? In QtJambi this is straightforward because you can
just cycle through

the contents of the different jars.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20120520/a03a32df/attachment-0001.html>

More information about the Kde-bindings mailing list