Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.1
-
None
-
d59638f21d7ea7c2a7f5c57b3eca27da984a1917
Description
If a widget has the Qt::WA_LaidOut attribute set and it is to add in the layout with replaceWidget it is first added in QLayoutPrivate::replaceAt and then removed in QLayout::addChildWidget.
In the attached files: Everytime the button is clicked it swaps the two labels. If NORMAL is defined only the first time each label is inserted into the layout they are laid out. If NORMAL is not defined they are laid out everytime.
I see two ways to solve the problem:
- Replace
qlayout.cpp line 877
if (l && removeWidgetRecursively(l, w))
with
if (l && l != this && removeWidgetRecursively(l, w))
- Unset the attribute (as seen in the attached files if the define is commented out).