Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
1.2.x
Description
Here is the test ui file:
https://gist.github.com/4119155#file_test.ui
It's a simple main window with a QHBoxLayout inside a QWidget. Margins are all set to the same value: 5. Now, the generated code contains 2 calls to setMargin, one for 5 (correct) and another one with 0 (incorrect) for the layout:
https://gist.github.com/4119155#file_test.py
See lines 28-29.
By inspecting uiparser.py, in function createLayout, an extra 'margin' element is added (~line 399) because the layout is child of a QWidget which is not the child of the main window. The code in that function checks if there are individual margin elements but looks like fails in the case where there is a single 'margin' element, that is, when all margins are equal. If at least one margin is different then problem doesn't appear.
I reported the problem to PyQt project and it was fixed. Find their patch attached.