From ac9e4a9e17edfc7eb2a5d75673efcc05830b49fe Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 24 Jan 2023 09:26:37 -0500 Subject: [PATCH 1/3] Make the QLineEdit.setValidator() parameter optional https://github.com/python-qt-tools/PyQt5-stubs/issues/209 --- PyQt5-stubs/QtWidgets.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyQt5-stubs/QtWidgets.pyi b/PyQt5-stubs/QtWidgets.pyi index 44b3f6d..b4d0b1f 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -7177,7 +7177,7 @@ class QLineEdit(QWidget): def minimumSizeHint(self) -> QtCore.QSize: ... def sizeHint(self) -> QtCore.QSize: ... def validator(self) -> QtGui.QValidator: ... - def setValidator(self, a0: QtGui.QValidator) -> None: ... + def setValidator(self, a0: typing.Optional[QtGui.QValidator]) -> None: ... def setReadOnly(self, a0: bool) -> None: ... def isReadOnly(self) -> bool: ... def setEchoMode(self, a0: 'QLineEdit.EchoMode') -> None: ... From 0c635389bc7571a93ee714e1c70065a631d78468 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 24 Jan 2023 09:29:00 -0500 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee4429b..8f0c608 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed * [#198](https://github.com/python-qt-tools/PyQt5-stubs/pull/198) Corrected `QTableWidget.cellWidget()` to return an an optional `QWidget` instead of a list of `QWidgets`. +* [#210](https://github.com/python-qt-tools/PyQt5-stubs/pull/210) Correct `QLineEdit.setValidator()` to accept `None` for removing the validator. ## 5.15.6.0 From 5c14bc2b900c0179ce4c4552dfb648f356a9d431 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 24 Jan 2023 09:29:49 -0500 Subject: [PATCH 3/3] add test for QLineEdit.setValidator(None) --- tests/qlineedit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qlineedit.py b/tests/qlineedit.py index 542ed44..719b8b3 100644 --- a/tests/qlineedit.py +++ b/tests/qlineedit.py @@ -4,3 +4,4 @@ # test that QLineEdit.setText() accepts None as parameter edit = QLineEdit() edit.setText(None) +edit.setValidator(None)