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

Regression->6.2.4: Cannot set orientation by enum value through QMetaObject

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.3.0, 6.2.5
    • 6.2.4
    • PySide
    • None
    • Windows
    • 66e9e9e0674dff4ac0715faf17bf039eeb287df7

    Description

      I can no longer set the orientation property of QSplitter through QMetaObject using an enum value. This is easier to show than explain:

      import sys
      from PySide6.QtCore import Qt
      from PySide6.QtWidgets import QApplication, QMainWindow, QSplitter
      
      app = QApplication(sys.argv)
      window = QMainWindow()
      splitter = QSplitter(window)
      print("Starting")
      
      def set_property(name, value):
          meta_obj = splitter.metaObject()
          i = meta_obj.indexOfProperty(name)
          was_success = meta_obj.property.write(splitter, value)
          print("Success:", was_success)
       
      set_property("orientation", Qt.Vertical) # Set enum value with property - FAILS
      set_property("orientation", 2) # Set numerical value with property - works
      splitter.setOrientation(Qt.Vertical) # Set directly - works
      set_property("toolTip", "foo") # Set other property - works

      I tried in 6.2.4 and this fails (the return value from property.write() is false, and you can see that the write has failed if you display the component). In 6.2.3 it works (I also tried 6.2.2, 6.2.0 and 6.1.3) so this is a regression. I suspect it could be related to this entry in the changelog:

      • Research: Improvements to Qt Enums to rely on Python Enums

       

      Python 3.9
      Qt 6.3.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.2.0)
      Starting
      
      ->set_property(orientation/66, PySide6.QtCore.Qt.Orientation.Vertical)
      <-set_property(), read:  PySide6.QtCore.Qt.Orientation.Horizontal , was_success= False
      
      ->set_property(orientation/66, 2)
      <-set_property(), read:  PySide6.QtCore.Qt.Orientation.Vertical , was_success= True
      
      ->set_property(toolTip/48, foo)
      <-set_property(), read:  foo , was_success= True
      
      Python 3.9
      Qt 6.3.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.2.0)
      Starting
      
      ->set_property(orientation/66, PySide6.QtCore.Qt.Orientation.Vertical)
      <-set_property(), read:  PySide6.QtCore.Qt.Orientation.Vertical , was_success= True
      
      ->set_property(orientation/66, 2)
      <-set_property(), read:  PySide6.QtCore.Qt.Orientation.Vertical , was_success= True
      
      ->set_property(toolTip/48, foo)
      <-set_property(), read:  foo , was_success= True
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              shpremna Shyamnath Premnadh
              arthur.tacca Arthur Tacca
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes