I want that when I have changed a line-edit another function gets called, and in that function there is an if-else with Qt.Checked
. When I edit the line-edit and then check the checkbox, the text from the line-edit gets written to a variable. But then when I change the line-edit again, it just runs the else
in the change function, even if the checkbox is checked. I don't understand why.
Checkbox:
self.filenamecheck.stateChanged.connect(self.changeFileName)
LineEdit:
self.nameLine.textEdited.connect(self.onChangeNameLine)
Functions:
def onChangeNameLine(self,state):
self.changeFileName(self)
print("Filename changed")
def changeFileName(self, state):
name = self.nameLine.text()
print("Called change function")
if state == Qt.Checked:
self.filenameLine.setText(name)
print("called change if")
else:
self.filenameLine.setText('')
print("called change else")
Thank's for your help!