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

Adding an instance of QPrinter as a combo box's user data return None

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 1.2.x, dev
    • Fix Version/s: 5.12.2
    • Component/s: PySide
    • Commits:
      1e5643d42eb7165aa6097bd5ccfcb4eb5e1477ac (pyside/pyside-setup/5.12)

      Description

      QComboBox doesn't seem to store the QPrinter instance as the item's user data.

      In this example the assert fails because the item data for the first item is
      None instead of an instance of QPrinter class.

      class Window(QtGui.QMainWindow):
      
          def __init__(self):
              super(Window, self).__init__()
      
              self.combo = QtGui.QComboBox(self)
      
              self.setCentralWidget(self.combo)
      
              printer = QtGui.QPrinterInfo.availablePrinters()[0]
      
              self.combo.addItem(printer.printerName(), QtGui.QPrinter(printer))
      
              # Fails
              assert(isinstance(self.combo.itemData(0), QtGui.QPrinter))
      

        Attachments

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

          Activity

            People

            • Assignee:
              crmaurei Cristian Maureira-Fredes
              Reporter:
              expobrain Esposti Daniele
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes