by methods addItem or setItemData of QComboBox,, I set a PenStyle object as user data to an item as below:
from PySide2.QtWidgets import * from PySide2.QtCore import Qt cb = QComboBox() cb.addItem("solid", Qt.SolidLine) cb.setItemData(0, Qt.SolidLine, Qt.UserRole+1)
However the user data given by itemData(0, Qt.UserRole) was integer value 1 instead of the object.
 In any way, I couldn't extract the expected data.
BTW, in the case that I stored string instead of the object, it works.
I attached the short repro case code.
PYSIDE-45 may be a similar issue. 
- relates to
- 
                    PYSIDE-45 Adding an instance of QPrinter as a combo box's user data return None -         
- Closed
 
-         
- 
                    PYSIDE-3066 setProperty() does not work with Enums -         
- Closed
 
-         
- resulted in
- 
                    PYSIDE-1870 Regression->6.2.4: Cannot set orientation by enum value through QMetaObject -         
- Closed
 
-         
- 
                    PYSIDE-1974 Regression: Usage of PySide6 enums via QVariant broken -         
- Closed
 
-         
- 
                    PYSIDE-1930 REG ->6.2.4: Cannot return Qt.CheckState enum values from QAbstractItemModel::flags() -         
- Closed
 
-         
| For Gerrit Dashboard: PYSIDE-1798 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 392695,7 | Convert QVariant to Enum types | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 | 
| 392879,2 | Convert QVariant to Enum types | 6.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |