I have a table, with 4 columns. Two of this 4 columns are about features. One is Feature, another is subfeature. in each column, there are comboboxes for all cells. I can open txt in these cells. I want to: when I choose cinema for feature, I want to see only name of films in subfeature comboboxes and no every subfeature that I have in my "data"... and when I choose Food in feature, I want to see only types of food in my subfeature comboboxes...
.. I dont know how to do it... there is a way to do it?
Here there is my def to put combobox in table and open the text file into these comboboxes:
def createEd(self, parent, option, index):
if index.column() == POLARITY:
combobox = QComboBox(parent)
combobox.addItems(sorted(index.model().TPolarities))
combobox.setEditable(True)
arquivo = codecs.open("ln2.txt",encoding='utf-8',mode="r")
conTWordsdo = arquivo.readlines()
lista =[]
for i in conTWordsdo:
lista.append(i.replace("\n",""))
combobox.addItems(sorted(lista))
return combobox
elif index.column() == FEATURE:
combobox = QComboBox(parent)
combobox.addItems(sorted(index.model().TFeatures))
combobox.setEditable(True)
arquivo = codecs.open("ln1.txt",encoding='utf-8',mode="r")
conTWordsdo = arquivo.readlines()
lista = []
for i in conTWordsdo:
lista.append(i.replace("\n",""))
combobox.addItems(sorted(lista))
return combobox
elif index.column() == SUBFEATURE:
combobox = QComboBox(parent)
combobox.addItems(sorted(index.model().TSubFeatures))
combobox.setEditable(True)
arquivo = codecs.open("ln3.txt",encoding='utf-8',mode="r")
conTWordsdo = arquivo.readlines()
lista = []
for i in conTWordsdo:
lista.append(i.replace("\n",""))
combobox.addItems(sorted(lista))
return combobox
elif index.column() == SENTENCE:
editor = QLineEdit(parent)
self.connect(editor, SIGNAL("returnPressed()"), self.commitAndCloseEditor)
return editor
else:
return QItemDelegate.createEditor(self, parent, option, index)