First of all, I think you want field.clear()
as field.clear
will just give the clear function. Secondly, QLineEdit.clear()
doesn't return anything so just:
for field in fields:
field.clear()
Is needed as opposed to
for field in fields:
return field.clear()
Lastly, QAbstractButton.clicked
is probably trying to pass the checked
argument which is causing issues, and might be forcing it to get the editFields[false]
field, aka the editFields[0]
field which is the first.
So, in conclusion, I'd make the editFields belong to what ever holds the fields and button, and try this and see if it gives the results you need:
self.editFields = [angle1Edit, angle2Edit, len1Edit, len2Edit]
clearBtn.clicked.connect(self.clearAll)
def clearAll(self, checked=False):
for field in self.editFields:
field.clear()