用于Qt :: ListView的未定义方法`model ='

时间:2013-11-27 19:03:07

标签: ruby qt qt4

我正在尝试使用Ruby和Qt编写应用程序。我有以下代码:

list = Qt::ListView.new(window)
mod1 = MyModel.new #MyModel inherits from Qt::AbstractListModel
list.model = mod1 #<< Fails on this line

但它失败了,告诉我:

undefined method `model=' for #<Qt::ListView:0x0000000067e300>

然而,我在SO上看到使用model =的其他帖子,当我发出list.public_methods时,我看到了IRB中列出的方法。

1 个答案:

答案 0 :(得分:1)

好的,问题是我没有在我的模型的super()方法中调用initialize