[Qt-jambi-interest] QStandardItem setData() fails when invoked twice

Eskil Abrahamsen Blomfeldt eblomfel at trolltech.com
Fri Jul 4 07:39:48 CEST 2008


Curt Nowak wrote:
> I am trying to fill a QStandardItemModel with QStandardItems that contain custom data. Unfortunately I came across a similar outcome as before when I had tried to use a Custom Delegate (see my previous mails "QItemDelegate for *non-primitives* using QComboBox"): There is trouble with non-Qt objects.
> It seems you have to create a new instance of QStandardItem every time the content of your model changes.  Is that the very same bug as before or a new issue?
>   
Hi, Curt.

This is the same bug, yes.

The problem here is that some itemview classes will check equality of 
the data you are setting and the data already in the model. A bug in Qt 
Jambi is causing this test to always return true when the objects are of 
types that are unknown, and the equality call has to go through Java. 
This will in turn cause the itemview class to skip setting the data 
altogether, thinking that it's the same as what it already has.

Thus the primitive types (and their box types) as well as certain 
built-in Qt Jambi types will work fine, because Qt Jambi knows how to do 
the comparisons without going through Java, but any other types (such as 
java.awt.Point) will unfortunately fail.

-- Eskil





More information about the Qt-jambi-interest mailing list