⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Inexplicable QToolBox bad behavior

  • def add_subtool_type(self, tool, title=None):
       if title is None:
          title = tool.title()
       self.toolsCombo.addItem(title, userData=tool)
       i = self.toolsCombo.count() - 1
       print (i)            # prints 5
       print(self.toolsCombo.itemData(i))    # prints that the object is there
    def add_subtool_instance(self, tool):
       if isinstance(tool, int):
          tool = self.toolsCombo.itemData(tool)   # App crashes here, though tool = 5
       if tool:  # else must be "Add tool" drop down item
          import dill as pickle
          data = pickle.dumps(tool)
          copy = pickle.loads(data)

    Hi, when I receive currentIndexChanged signal from QComboBox, I call the second function. It's crashing my app. My app is very short, only about 10 files by now, because I started it yesterday.

    Anyway, this is halting development. I kind of need that associated data, but I'll try a dictionary too.

  • Solution is to use a dictionary called _indexMap

Log in to reply