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

    • 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

        Issue Links

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

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              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