QTextEdit, sizeHint, QWidget
I've got a QTextEdit inside a sub-class of QWidget. I just want to display some simple (rich) text. I'd like the QTextEdit to scale to it's contents and the window around it around it to scale too.
Code:
{
//...etc
private:
}
//the constructor
{
QWidget::setFixedSize(txtEdit
->sizeHint
());
}
I think the problem is that txtEdit->sizeHint() is not influenced by the (small) amount of text in the QTextEdit. Is there any way of telling QTextEdit to occupy the minimum space possible for the given text formatting?
thanks
K
Re: QTextEdit, sizeHint, QWidget
Maybe QTextDocument::size() is what you are looking for? QLabel is also one possibility in case the text is just shown and not meant to be modified.