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

    • 1e5643d42eb7165aa6097bd5ccfcb4eb5e1477ac (pyside/pyside-setup/5.12)

      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))
      

        1. pyside-45.py
          0.6 kB
          Christian Tismer
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes