ok.

i finally found one of your early posts on this topic which gives a sample code

Qt Code:
  1. void CommentDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
  2. {
  3. painter->save();
  4. doc.setHtml( index.data().toString() );
  5. QAbstractTextDocumentLayout::PaintContext context;
  6. doc.setPageSize( option.rect.size());
  7. painter->translate(option.rect.x(), option.rect.y());
  8. doc.documentLayout()->draw(painter, context);
  9. painter->restore();
  10. }
To copy to clipboard, switch view to plain text mode 

i used this method and it worked. But now there is another problem of obtaining
right size values to be returned from sizeHint() function.

i am reimplementing the sizeHint() method of the Delegate and for the time being, i am just returning a constant size of QSize(200,250). But of course this should be determined by the content of the item to be displayed. For large contents; some of the text are just lost behind the content of next item.

i tried QTextDocument:ageSize() and QTextDocument::documentLayout()->documentSize() methods , after setting the content of the QTextDocument object , but it didnt worked.

any suggestions appreciated.. thanks...