문제

I need some help adding some items to a combBox.So,I have two comboboxes,one combobox populates the other depending on the item selected.

My question is that,using additem for new items,it works,but if i choose another option for the combobox, it adds the new items but the previous items are gone,and there are blank items below the new ones.

I thought each time i choose a new option from the first combobox,to clear the contents of the second combobox,i used the clear() on the second,but it didn't work.

That's how I thought of it :

self.comboBox_2.clear()
for index,i in enumerate(list1):
  self.comboBox_2.addItem(_fromUtf8(""))
  self.comboBox_2.setItemText(index+2, QtGui.QApplication.translate("Dialog", i, None, QtGui.QApplication.UnicodeUTF8))

The above is part of a function that executes when the first combobox changes.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top