朱欢 wrote: > Excuse me, I'm a QT beginner. I want to archieve a Instant Message like > Gtalk. But I don't know how to implement rich text in list view's item. > At the time being, I am using the QStandardItem to list these plain text > of every message in the list view. It's a pity that QStandardItem hasn't > the setHtml() fuction to archieve rich text. What can I do now? >
To specify custom drawing for an item you need to specify a custom QItemDelegate for the view. http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QItemDelegate.html By overriding the delegates paint() method, you can specify what you like to draw and how to do it. The StarDelegate example illustrates how to use custom delegates, though it renders stars rather than html. To get rich text in there, you should use a QTextDocument and the function drawContents() http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QTextDocument.html http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QTextDocument.html#drawContents(com.trolltech.qt.gui.QPainter) best regards, Gunnar _______________________________________________ Qt-jambi-interest mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
