Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-127

pyside-uic generates bogus setMargin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.0
    • 1.2.x
    • PySide

    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.

      Attachments

        For Gerrit Dashboard: PYSIDE-127
        # Subject Branch Project Status CR V

        Activity

          People

            ctismer Christian Tismer
            saghul Saúl Ibarra Corretgé
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes