Thank you d_stranz
I found a way. everything work as I expected except one thing. I did this by re implementing QSqlRelationalDelegate as this:
def __init__(self, parent=None):
super().__init__()
self.tab=parent
def setEditorData(self,editor,index):
if index.column()==2:
test= ((self.tab.selectionModel().currentIndex().siblingAtColumn(1).data()))
editor.model().setFilter("type_IDs like '"+test+"%'")
return super().setEditorData(editor,index)
class mydelegate(QSqlRelationalDelegate):
def __init__(self, parent=None):
super().__init__()
self.tab=parent
def setEditorData(self,editor,index):
if index.column()==2:
test= ((self.tab.selectionModel().currentIndex().siblingAtColumn(1).data()))
editor.model().setFilter("type_IDs like '"+test+"%'")
return super().setEditorData(editor,index)
To copy to clipboard, switch view to plain text mode
the only problem remains is changing an item in column 1 doesn't changes items in column 2 automatically and I have to modify second Column manually else it remains wrong option.
for example if column 1 be "IC" and Column 2 be "Timer" and then i change column 1 to "Transistor" column 2 remains "Timer" unless I edit that too.
how to solve this?
Bookmarks