Important: Please read the Qt Code of Conduct -

Use ruby seamlessly in your C++/Qt applications

  • Execute ruby code seamlessly from within C++/Qt applications with the QtRuby pod:

    // Qt includes
    #include <QCoreApplication>
    // QtRuby includes
    #include "qruby.h"
    #include "qrubyvalue.h"
    int main(int argc, char *argv[]) {
        QCoreApplication app(argc, argv);
        QRuby rb;
        rb.evaluate("(1..10).each do |n| puts n end");
        return 0;

    This is in early stage and uses the ruby native extension API to interface the ruby interpreter to be used to execute ruby code in your C++/Qt application. As time goes on, I plan to improve the integration more.

  • Moderators

    Hi @cybercatalyst, this looks useful. Thanks for sharing!

    I'd like to point out though, that the name "QtRuby" is already taken:

  • Yes, I knew of the existence of QtRuby, but actually I think that the usage of the "QtRuby"-name in the QtRuby you pointed to is not justified. Usually QtXX is used where XX is something that is being made available in Qt. Language bindings start with the name in front, for example PythonQt, so it should be called RubyQt.

    That's why I insisted on using the name QtRuby, well aware of the name clash.

Log in to reply