From: Arturo Bonechi Date: 2010-09-05T19:51:10+09:00 Subject: "Segmentation fault" with QtRuby Hello everyone! Using QtRuby, I tried to implement the "Read-only example model" (Creating new models chapter) of the "Model/View programming" technology section of Qt Assistant. But when I launch the example, I got this error : main.rb:5: [BUG] Segmentation fault ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] Abandon Here is the code : # slmodel.rb class SLModel < Qt::AbstractListModel def initialize string_list, parent = nil super parent @string_list = string_list end def rowCount parent = Qt::ModelIndex.new @string_list.length end def data index, role return Qt::Variant.new unless index.isValid return Qt::Variant.new if index.row >= @string_list.length return @string_list[index.row] if role == Qt.DisplayRole Qt::Variant.new end # def headerData section, orientation, role = Qt.DisplayRole # return Qt::Variant.new if role != Qt.DisplayRole # # if orientation == Qt.Horizontal # "Column #{section}" # else # "Row #{section}" # end # end end # window.rb require 'slmodel' class Window < Qt::Widget def initialize parent = nil super parent @list = %w[Alpha Beta Gamma Omega] @model = SLModel.new @list, self @view = Qt::ListView.new @view.setModel @model layout = Qt::VBoxLayout.new layout.addWidget @view setLayout layout end end # main.rb require 'Qt4' require 'window' a = Qt::Application.new ARGV window = Window.new window.show a.exec As the error message doesn't give me that much explanations, I don't know what is the origin of the problem... Is it because I forgot to implement some virtual methods from Qt::AbstractListModel? Thanks! -- Posted via http://www.ruby-forum.com/.