How do I react on the resize of a QMainWindow
? I have QTextBrowsers
in a QScrollArea
and I adjust them to the size of the content on creating them (the only thing that should scroll is the QScrollArea
).
Everything works for now, but if I resize the mainWindow
, the height of the QTextBrowsers
isn't changed, because the reflow function isn't triggered.
Do you have any better idea to adjust a QTextBrowser
to it's content? My current code is:
void RenderFrame::adjustTextBrowser(QTextBrowser* e) const {
e->document()->setTextWidth(e->parentWidget()->width());
e->setMinimumHeight(e->document()->size().toSize().height());
e->setMaximumHeight(e->minimumHeight());
}
The parentWidget()
is necessary because running width()
on the widget itself returns always 100, regardless of the real size.