Hi! I already reported this issue to the kde-bindings mailing list [1] a while ago. Now I waited for KDE 4.9 to be released and re-pulled and re-built smokegen, smokeqt and qtruby from source, but I still cannot use an ItemModel written in QtRuby together with QML. You can get more details by looking at my post to the mailing list [1] http://lists.kde.org/?l=kde-bindings&m=134165976025397&w=2 Reproducible: Always Steps to Reproduce: run the following ruby snippet: require 'Qt4' model = Qt::AbstractListModel.new model.role_names Actual Results: this is the error message that is produced classname == QAbstractListModel :: method == setRoleNames -> methodIds == [#<Qt::Internal::ModuleIndex:0x00000002138970 @smoke=0, @index=282>] candidate list: void QAbstractItemModel::setRoleNames(const QHash<int,QByteArray>&) (smoke: 0 index: 282) matching => smoke: 0 index: 282 const QHash<int,QByteArray>& (U) match => 282 score: 1 Resolved to id: 282 setCurrentMethod(smokeList index: 0, meth index: 282) test.rb:282:in `method_missing': Cannot handle 'const QHash<int,QByteArray>&' as argument of QAbstractItemModel::setRoleNames (ArgumentError) Expected Results: I should be able to use a model class from Ruby code with QML just like it always works with C++ $ kde4-config --version Qt: 4.8.2 KDE: 4.9.00 kde4-config: 1.0 KDE and Qt are from Archlinux packages, smokegen, smokeqt and qtruby are compiled from git master
Created attachment 82394 [details] add handlers for role name methods here is a patch that fixes that problem for me (not sure if the code should be ifdefed to a minimum version of Qt)... with this models written in ruby can have role names set. # example: subclassing a QListModel class TestModel < Qt::ListModel def initialize super set_role_names({ 1000 => "user_role", 1001 => "another_role"}) end def rowCount(parent) x end # yes, it's a list, but for some reason it needs this method # to be implemented. just humor me here... def columnCount(parent) 1 end def data(idx, role) return Qt::Variant.new("something") if role == 1000 return Qt::Variant.new("otherthing") if role == 1001 end end and then it can be attached the model to the root context of a QDeclarativeView. this allows it to be used via qml like any other C++ model. @model = TestModel.new @qmlview = Qt::DeclarativeView.new @ctx = @qmlview.root_context @ctx.set_context_property("test_model", @model)
Created attachment 82395 [details] sorry, wrong file
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version? If you can reproduce the issue, please change the status to "CONFIRMED" when replying. Thank you!
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!