Details
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
- resulted from
-
PYSIDE-1798 Cannot store enum Qt.PenStyle object as user data of QComboBox item (QVariant)
- Closed