[Kde-bindings] qtruby QAbstractListModel::setRoleNames -> ArgumentError

Florian Staudacher florian_staudacher at yahoo.de
Sat Jul 7 11:11:54 UTC 2012


Hi again!

Sorry to bombard you with my messages,
but I ran into another problem. It seems like the type used by
ItemModels to handle role name mappings for QML cannot be used from
ruby. I am getting this error when trying to call setRoleNames (or
set_role_names) on my subclass of QAbstractListModel:


   classname    == QAbstractListModel
   :: method == setRoleNames
   -> methodIds == [#<Qt::Internal::ModuleIndex:0x000000012d6800
   @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)


I have tried setting it to:

   { 1 => "something" }  # or
   { 1 => Qt::ByteArray.new("something") }  # or
   [ 1 => "something" ]  # or
   [ 1 => Qt::ByteArray.new("something") ]

but they all produced the same message. Also, reading the roleNames
property of that object results in a similar message:


   ArgumentError: Cannot handle 'const QHash<int,QByteArray>&' as
   return-type of QAbstractItemModel::roleNames


This can be reproduced always with the following snippet:

   require 'Qt4'
   model = Qt::AbstractListModel.new
   model.role_names

Thank you for your help!

- Florian


P.S: would you prefer those kind of messages here on the mailing list or
on the kde bugtracker?


More information about the Kde-bindings mailing list