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

Cannot store enum Qt.PenStyle object as user data of QComboBox item (QVariant)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.3.0, 6.2.4
    • 5.12.2
    • PySide
    • None
    • Windows10, Python38(x64), PySide2(5.12.2)
    • Windows
    • 108d82d2ca5323652a50706b37f829b9f0457367 94d38216ab (pyside/pyside-setup/6.2.4)

    Description

      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. 

      Attachments

        1. module1.py
          0.6 kB
        2. pyside1798.py
          1 kB

        Issue Links

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

          Activity

            People

              shpremna Shyamnath Premnadh
              m-yabana Masataka Yabana
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes