diff --git a/functions/qt_wrapper.py b/functions/qt_wrapper.py index 256f0a2..aa2a5d0 100644 --- a/functions/qt_wrapper.py +++ b/functions/qt_wrapper.py @@ -41,6 +41,7 @@ QToolButton: Type[Any] = object QSizePolicy: Type[Any] = object Qt: Type[Any] = object QComboBox: Type[Any] = object +QCheckBox: Type[Any] = object QHBoxLayout: Type[Any] = object @@ -85,6 +86,7 @@ try: QToolButton as _QToolButton, QSizePolicy as _QSizePolicy, QComboBox as _QComboBox, + QCheckBox as _QCheckBox, QHBoxLayout as _QHBoxLayout, ) from qgis.PyQt.QtCore import ( @@ -129,8 +131,9 @@ try: QToolButton = _QToolButton QSizePolicy = _QSizePolicy QComboBox = _QComboBox + QCheckBox = _QCheckBox QVariant = _QVariant - QHBoxLayout= _QHBoxLayout + QHBoxLayout = _QHBoxLayout # ✅ QT6 ENUMS YES = QMessageBox.StandardButton.Yes NO = QMessageBox.StandardButton.No @@ -179,6 +182,7 @@ except (ImportError, AttributeError): QToolButton as _QToolButton, QSizePolicy as _QSizePolicy, QComboBox as _QComboBox, + QCheckBox as _QCheckBox, QHBoxLayout as _QHBoxLayout, ) from PyQt5.QtCore import ( @@ -221,8 +225,9 @@ except (ImportError, AttributeError): QToolButton = _QToolButton QSizePolicy = _QSizePolicy QComboBox = _QComboBox + QCheckBox = _QCheckBox QVariant = _QVariant - QHBoxLayout = _QHBoxLayout + QHBoxLayout= _QHBoxLayout # ✅ PYQT5 ENUMS YES = QMessageBox.Yes @@ -529,6 +534,22 @@ except (ImportError, AttributeError): def setContentsMargins(self, *args, **kwargs): pass QHBoxLayout = _MockQHBoxLayout + + class _MockQCheckBox: + def __init__(self, text: str = "", *args, **kwargs): + self._text = text + self._checked = False + + def setText(self, text: str) -> None: + self._text = text + + def isChecked(self) -> bool: + return self._checked + + def setChecked(self, checked: bool) -> None: + self._checked = checked + + QCheckBox = _MockQCheckBox def exec_dialog(dialog: Any) -> Any: return YES # --------------------------- TEST ---------------------------