From 18a702572f6bed41081d368e39c8fc69122c6203 Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:14:03 +0100 Subject: [PATCH] fix: widget_IO.py added handler for QCheckBox --- bec_widgets/qt_utils/widget_io.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bec_widgets/qt_utils/widget_io.py b/bec_widgets/qt_utils/widget_io.py index c2dbb48b..6220fc4c 100644 --- a/bec_widgets/qt_utils/widget_io.py +++ b/bec_widgets/qt_utils/widget_io.py @@ -8,6 +8,7 @@ from PyQt5.QtWidgets import ( QDoubleSpinBox, QTableWidgetItem, QVBoxLayout, + QCheckBox, ) from abc import ABC, abstractmethod @@ -68,6 +69,14 @@ class SpinBoxHandler(WidgetHandler): widget.setValue(value) +class CheckBoxHandler(WidgetHandler): + def get_value(self, widget): + return widget.isChecked() + + def set_value(self, widget, value): + widget.setChecked(value) + + class WidgetIO: """Public interface for getting and setting values using handler mapping""" @@ -77,6 +86,7 @@ class WidgetIO: QTableWidget: TableWidgetHandler, QSpinBox: SpinBoxHandler, QDoubleSpinBox: SpinBoxHandler, + QCheckBox: CheckBoxHandler, } @staticmethod