In the meanwhile mhlmi on #qtruby has created a stripped down example which proves that the bug has nothing to do with
bigdecimal.
---< test.rb >------
require "pp"
require "Qt4"
class MyModel < Qt::SortFilterProxyModel
attr_reader :model
def initialize(*args)
super(*args)
@model = Qt::StringListModel.new
@model.setStringList((0..10).to_a.collect{|i| "test #{i}"})
setSourceModel(@model)
# @dummy = Hash.new []
end
def data(index, role=Qt::DisplayRole, uff=0)
return Qt::Variant.new unless index.isValid
# item = @dummy[index.column]
index.column ##
if uff > 100
super(index, role)
else
data(index, role, uff+1)
end
end
end
class MyMainWindow < Qt::MainWindow
slots "test()"
def initialize(*args)
super(*args)
@wid = Qt::Widget.new
@lay = Qt::VBoxLayout.new(@wid)
@model = MyModel.new
table = Qt::TableView.new
table.setModel(@model)
table.setSortingEnabled(true)
btn = Qt::PushButton.new
connect(btn, SIGNAL("clicked()"), self, SLOT("test()"))
@lay.addWidget(table)
@lay.addWidget(btn)
setCentralWidget(@wid)
resize(400,900)
end
def test
GC.start
end
private
end
$KCODE='u'
Qt.debug_level = Qt::DebugLevel::High if ARGV.shift == "debug"
app = Qt::Application.new(ARGV)
mainWin = MyMainWindow.new
mainWin.show
app.exec
---< EOF >------
Using Qt::Internal::setDebug(Qt::QtDebugChannel::QTDB_GC) it is clear that the QModelIndex instance is the "broken"
object.
Sorry for fileing 2 bug reports, but i wasn't able to add a comment to the former one (ERROR). |