Does QtRuby work with Qt 5?

点点圈 提交于 2019-12-08 15:48:05

问题


Everything I can find online about QtRuby uses Qt 4, but the current version of Qt is 5. Is this simply a matter of documentation not catching up with reality, where Qt 5 would work just fine with QtRuby?

If you assert that this is the case (that Qt5 is unsupported) then please backup your assertion with evidence.


回答1:


QtRuby

Qtruby and korundum are not maintained for years now. To get a maintained version of qtruby, install qtbindings as ruby gem.

Qtbindings home page: https://github.com/ryanmelt/qtbindings/

Also see https://github.com/ryanmelt/qtbindings/issues/131 for a discussion about supporting Qt5.

Ruby-QML

Ruby-qml is a QML / Qt Quick wrapper for Ruby. It provides bindings between QML and Ruby and enables you to use Qt5 Quick-based GUI from Ruby.

The bindings provided by Ruby-QML are much leaner in comparison to QtRuby. In particular there is no direct access to the Qt classes' methods. That might first seem to be a a disadvantage when coming from QtRuby.

When learning to use use Ruby-QML, it turns out quickly that the advantages outweigh the limitations:

  • QML and JS greatly complement to describe and model the static and dynamic aspects of the UI
  • The user community of QML/JS is huge. It is so much easier to find examples or help to solve QML/JS issues, than it was within the tiny QT/Ruby community.
  • The examples on Ruby-qml are pretty much complete to demonstrate the constructs needed to get started.
  • JS may be used as flexible 'glue logic' between Ruby and Qt.



回答2:


QtRuby only supports Qt 4 for the time being. Hopefully, it will change soon, but this seems to be the reality at the time of writing this.

The last release happened two and half a years ago as the time of writing this. That can be seen here:

http://rubyforge.org/projects/korundum/

As you can see, that is also a Qt 4 release as its name says: qt4-qtruby-2.2.0.

That information is also getting from their outdated KDE Wiki in here:

http://techbase.kde.org/Development/Languages/Ruby

If this is still not enough proof, you can look into the code yourself to see it is not actually binding Qt 5 classes added in that major Qt variant.

Here is a quick ls after decompressing the latest tarball:

lpapp ~/Downloads/qt4-qtruby-2.2.0/qtruby/src/lib $ ls
CMakeLists.txt  Qt  Qt.rb  Qt3.rb  Qt4.rb


来源:https://stackoverflow.com/questions/23002361/does-qtruby-work-with-qt-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!