Thanks a lot Gunnar ! It works fine now !
I haven't even thought that returning the same data for all roles could lead to this behaviour ! So thanks again ! :-D Best regards ! Vincent On Mon, Feb 2, 2009 at 1:06 PM, Gunnar Sletta <[email protected]> wrote: > 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
