Create a linked (show-value, show-name) checkbox pair. 'show name' is disabled whenever 'show value' is off.
(sv_checked: bool, sn_checked: bool)
| 279 | |
| 280 | |
| 281 | def _make_pair(sv_checked: bool, sn_checked: bool) -> tuple[QCheckBox, QCheckBox]: |
| 282 | """ |
| 283 | Create a linked (show-value, show-name) checkbox pair. |
| 284 | 'show name' is disabled whenever 'show value' is off. |
| 285 | """ |
| 286 | sv = QCheckBox() |
| 287 | sn = QCheckBox() |
| 288 | sv.setChecked(sv_checked) |
| 289 | sn.setChecked(sn_checked) |
| 290 | sn.setEnabled(sv_checked) |
| 291 | |
| 292 | def _on_sv(state): |
| 293 | enabled = bool(state) |
| 294 | sn.setEnabled(enabled) |
| 295 | if not enabled: |
| 296 | sn.setChecked(False) |
| 297 | |
| 298 | sv.stateChanged.connect(_on_sv) |
| 299 | return sv, sn |
no outgoing calls
no test coverage detected