Thank you for the reply! > The problem with your code is that the #data method must always return a > Qt::Variant. You correctly return an invalid Qt::Variant when the index > doesn't correspond to a valid data, but when you pick a value from > @string_list, you return the value as it is. From the name of the > variable > (and also from the code in the Window's constructor) it's clear that the > contents of this instance variable are strings, not Qt::Variant, so you > get > the error. The third line of the data method should be: > > return Qt::Variant.new @string_list[index.row] if role == Qt.DisplayRole Indeed, it works! So, I will be more careful with the C++ return type now. > By the way (in case you aren't already aware of this), qtruby allows you > to > write code in a more rubysh way (rather than C++-ish). This means you > can: > * use snake_case instead of camelCase from method names (for example, > layout.add_widget instead of layout.addWidget) > * use assignment instead of "setter" methods (but only for setter > methods > taking one argument). For example, self.layout = layout instead of > setLayout > layout Yes, I'm aware of this, but since I'm a beginner both with Ruby and Qt, I use CamelCase so that I know that is a Qt-method or Qt-attribute. Maybe at some point, when I'll be comfortable enough with Qt, I'll switch to "snake_case"... > I hope this helps Yes, a lot! Thanks once again! -- Posted via http://www.ruby-forum.com/.