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

Cannot set declared properties in QVBoxLayout and QHBoxLayout constructor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • None
    • 5.15.4, 6.3.1
    • PySide
    • None
    • Python 3.10.5
      PySide6 6.3.1 , PySide2 5.15.5
      Manjaro Linux
    • c140a3cef8 (pyside/pyside-setup/dev) c140a3cef8 (pyside/tqtc-pyside-setup/dev)

    Description

      Setting declared Qt properties via named constructor arguments to QVBoxLayout and QHBoxLayout does not work i.e

      from PySide6.QtWidgets import QHBoxLayout, QVBoxLayout
      
      layout = QVBoxLayout(
          objectName="layout",
          spacing=0
      )
      assert layout.spacing() == 0
      assert layout.objectName() == "layout"
      
      
      layout = QHBoxLayout(
          objectName="layout",
          spacing=0
      )
      assert layout.spacing() == 0
      assert layout.objectName() == "layout"
      

      raises assertion errors.

      However QBoxLayout does work

      layout = QBoxLayout(
          QBoxLayout.TopToBottom,
          objectName="layout",
          spacing=0
      )
      assert layout.spacing() == 0
      assert layout.objectName() == "layout"
      

      The same behavior is present in PySide2 and PySide6

      Attachments

        1. pyside1986_diag.diff
          1 kB
        2. pyside1986_widget.py
          1 kB
        3. pyside1986.py
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            aleserjavec Ales Erjavec
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes