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

QCombobox Checkstates collide with text on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • 6.8.1
    • 6.8.0.1
    • PySide
    • None
    • Windows
    • 877b29a78 (dev), 71cba1359 (6.8)

    Description

      When creating an QStandardItemModel with checkable Items the text of the items collides with the checkboxes if the model is placed into a QComboBox.

      Example Code:

      from PySide6.QtWidgets import QApplication, QComboBox, QVBoxLayout,QWidget
      from PySide6.QtGui import QStandardItemModel, QStandardItem
      from PySide6.QtCore import Qt
      
      if __name__ == "__main__":
          app = QApplication([])
      
          model = QStandardItemModel()
          items = ['Option 1', 'Option 2', 'Option 3', 'Option 4']
          for row, item_text in enumerate(items):
              item = QStandardItem(item_text)
              item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)  # Enable the checkbox
              item.setData(Qt.Unchecked, Qt.CheckStateRole)  # Default to unchecked
              model.setItem(row, 0, item)
          
          container = QWidget()
          layout = QVBoxLayout()
          container.setLayout(layout)
      
          combo = QComboBox()
          combo.setModel(model)
          layout.addWidget(combo)
      
          container.show()
          app.exec()

      result:

      this is a windows specific problem

      Attachments

        Issue Links

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

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              cmellueh Christoph Mellüh
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes