vcl/qt: don't re-add widgets to a layout they're already part of
If the parent widget already has a layout, then creating a new widget and passing the parent in the widget's constructor will add the widget to the layout. If the widget is later added to the layout again, it will be removed from the layout and re-added. This is unecessary. Change-Id: I64e27080a1546e126dfc8ee57d3e1e558574d6a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206477 Reviewed-by: Dan Williams <dcbw@libreoffice.org> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
This commit is contained in:
@@ -504,8 +504,8 @@ QObject* QtBuilder::insertObject(QObject* pParent, const OUString& rClass, std::
|
||||
pParentLayout = new QVBoxLayout(pParentWidget);
|
||||
}
|
||||
|
||||
// add widget to parent layout
|
||||
if (pParentLayout)
|
||||
// add widget to parent layout if it wasn't added by Qt already
|
||||
if (pParentLayout && (pParentLayout->indexOf(pWidget) < 0))
|
||||
pParentLayout->addWidget(pWidget);
|
||||
|
||||
setWidgetAlignment(*pWidget, rProps);
|
||||
|
||||
Reference in New Issue
Block a user