Core: Guard against pages that forgot to create their widgets

This should not happen, but when it happens, the resulting crash is
quite cryptic. Make it a bit more obvious.

Change-Id: Icbe40206cfdbae93ccb072d7027fcaf109f2f39f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-07-07 13:08:45 +02:00
parent 57b6b8630c
commit 2a731003cf
2 changed files with 7 additions and 3 deletions

View File

@@ -345,9 +345,12 @@ private:
void showEvent(QShowEvent *event) final
{
if (!widget()) {
QWidget *inner = m_page->widget();
setWidget(inner);
inner->setAutoFillBackground(false);
if (QWidget *inner = m_page->widget()) {
setWidget(inner);
inner->setAutoFillBackground(false);
} else {
QTC_CHECK(false);
}
}
QScrollArea::showEvent(event);