+ def sizeHint(self, option, index):
+ fm = option.fontMetrics
+ text = index.model().data(index).property('content').toString()
+ document = QTextDocument()
+ document.setDefaultFont(option.font)
+ document.setHtml(text)
+ # the +5 is for margin. The +4 is voodoo;
+ # fm.height just give it too small.
+ return QSize(document.idealWidth() + 5, fm.height() + 4)
+
+
+
+