Example #1
0
void myTextEdit::textAreaChanged()
{
    QTextDocument *document = qobject_cast<QTextDocument*>(sender());
    if (document)
    {
        QTextEdit *editor = qobject_cast<QTextEdit*>(document->parent()->parent());

        if (editor)
        {
            int newheight = document->size().rheight();

            if (newheight != editor->height())
            {
                editor->setFixedHeight(newheight+5);
                this->setFixedHeight(newheight);
            }
        }

    }
}