class MyCheckBox(QCheckBox):
def __init__(self, target_edit:QLineEdit, parent):
super().__init__(parent)
self._target_edit = target_edit
self.stateChanged.connect(self._stateChanged_slot)
def _stateChanged_slot(self):
self._target_edit.setReadOnly(not self._target_edit.isReadOnly())