Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Not visible checkBox in ComboBox
Forum Updated to NodeBB v4.3 + New Features

Not visible checkBox in ComboBox

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 202 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    Hi!
    I use qDarkStyle.
    If I do this, then not visible checkBox in ComboBox. Maybe need set styleSheet for comboBox?

    comboBox = QComboBox()
                comboBox.addItems(checkableParameter.arrayParameters)
                # self.arrayWidgets.append(comboBox)
                modelItems = QStandardItemModel()
                i = 0
                for parameter in checkableParameter.arrayParameters:
                    # print(parameter)
                    item = QStandardItem()
                    item.setText(parameter)
                    item.setCheckable(True)
                    item.setCheckState(0)
                    modelItems.setItem(i, item)
                    i += 1
                comboBox.setModel(modelItems)
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mikeeeeee
      wrote on last edited by
      #2

      It is work

      class CheckBoxDelegate(QItemDelegate):
          def __init__(self, parent=None):
              super(CheckBoxDelegate, self).__init__(parent)
      
          def createEditor(parent, op, idx):
              self.editor = QCheckBox(parent)
      
                  comboBox = QComboBox()
                  comboBox.addItems(checkableParameter.arrayParameters)
                  delegate = CheckBoxDelegate()
                  comboBox.setItemDelegate(delegate)
                  # self.arrayWidgets.append(comboBox)
                  modelItems = QStandardItemModel()
                  i = 0
                  for parameter in checkableParameter.arrayParameters:
                      # print(parameter)
                      item = QStandardItem()
                      item.setText(parameter)
                      item.setCheckable(True)
      
                      item.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
                      item.setData(QtCore.Qt.Unchecked | QtCore.Qt.CheckStateRole)
                      item.setCheckState(2)
                      modelItems.setItem(i, item)
                      i += 1
                  comboBox.setModel(modelItems)
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved