- 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)
+# def sizeHint(self, option, index):
+# fm = option.fontMetrics
+# print "TYPE:", str(type(index.model().data(index).convert(QObject)))
+# text = "the fish doesn't talk"
+# #text = str(index.model().data(index).property('content').toString())
+# nodeType = str(index.model().data(index).property('nodeType').toString())
+# if nodeType == 'element' or nodeType == 'comment':
+# numlines = 1
+# elif nodeType == 'text':
+# numlines = text.count('\n')
+# sys.__stdout__.write("TEXT: \n" + text)
+# else:
+# numlines = 1
+# 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) * numlines)