Hi everyone,
I have some problems with sizing row's height in QTreeWidget. I use QStyledItemDelegate with QPlainTextEdit. During editing text in QPlainTextEdit i check for changes with a help of:
rect = self.blockBoundingRect(self.firstVisibleBlock())
and if text it's height changes i need row in QTreeWidget also resizing. But i don't know how to inform TreeWidget or a Delegate about changes, i even tried to initialize editor with index, that i could use in a future, but it suddenly changes:
class MyEditor(QPlainTextEdit):
def __init__(self, index = None, parent=None):
super(MyEditor, self).__init__(parent)
self.index = index
self.connect(self, SIGNAL("textChanged()"), self.setHeight)
def setHeight(self):
if self.index:
rect = self.blockBoundingRect(self.firstVisibleBlock())
self.resize(rect.width(), rect.height())
self.emit(SIGNAL("set_height"), QSize(rect.width(), rect.height()), self.index)
How can i bound editor's size changes with TreeWidget?
And one more thing, by default all items (cells) in TreeWidget have -1 or some big value as default width. I need whole text in cell to be visible, so how can i limit it only by visible range and expand it in height?
Thank you in advance,
Serge