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

Default QItemEditorFactory doesn't create QSpinBox when creating editor for a integer, creates QLineEdit instead

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.14.1
    • PySide
    • None
    • Python 3.8.2
    • Windows
    • 308aba2154699596e3fd0973501213423462a80b (pyside/pyside-setup/5.14)

      In this code, which inserts data into a QStandardItemModel (called resourcesModel) with QTableView:

      item = QStandardItem()
      item.setData(123123, Qt.EditRole)
      resourcesModel.setItem(1, 1, item)
      

      double-clicking on a cell presents a default QLineEdit (which you can put letters into), instead of QSpinBox, which would be expected since data is an integer.

      Possible explanation (by user eyllanesc on StackOverflow):

      What happens is that PySide2 converts the integer from python to LongLong (QVariant::LongLong=4) in C++ which is not handled by the default QItemEditorFactory by default making a QLineEdit used (in PyQt is converted to QMetaType::Int=2).

        1. pyside1250_cpp.zip
          3 kB
        2. pyside1250.py
          0.7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kleint Friedemann Kleint
            deronek Mateusz Dionizy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes