Fixed setWidget function of DockWidget to properly setup the internal scroll area

This commit is contained in:
Uwe Kindler 2019-05-10 10:32:06 +02:00
parent 9b56ca08e1
commit 1fccb943fe

View File

@ -243,14 +243,18 @@ void CDockWidget::setToggleViewActionChecked(bool Checked)
void CDockWidget::setWidget(QWidget* widget, eInsertMode InsertMode) void CDockWidget::setWidget(QWidget* widget, eInsertMode InsertMode)
{ {
QScrollArea* ScrollAreaWidget = qobject_cast<QScrollArea*>(widget); QScrollArea* ScrollAreaWidget = qobject_cast<QScrollArea*>(widget);
if (ScrollAreaWidget || ForceNoScrollArea != InsertMode) if (ScrollAreaWidget || ForceNoScrollArea == InsertMode)
{ {
d->setupScrollArea(); d->Layout->addWidget(widget);
d->ScrollArea->setWidget(widget); if (ScrollAreaWidget && ScrollAreaWidget->viewport())
{
ScrollAreaWidget->viewport()->setProperty("dockWidgetContent", true);
}
} }
else else
{ {
d->Layout->addWidget(widget); d->setupScrollArea();
d->ScrollArea->setWidget(widget);
} }
d->Widget = widget; d->Widget = widget;