Vincent Lebreil wrote:
> Hi,
> 
> I don't understand why nothing is displaying (neither header and data) 
> if I'm using a QTreeView and my own model which inherits QAbstractItemModel.
> 
> Btw if I use a QStandardItemModel instead, it works fine. Don't 
> understand why ??
> 
> Best Regards,
> Vincent

Hi Vincent,

Both the headerData() and data() functions are used to query the model 
for a number of different roles, such as font, color, text, etc. In your 
  example, you do not properly distinguish between roles and you 
probably end up with an invalid font and an invalid color. If you add a

if (role == Qt.ItemDataRole.DisplayRole)
{
     // look up string and return it
}
else return null;

around your data accessor functions, you should get the proper results.

-
best regards,
Gunnar
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to