From 6fb048c8289006a13eafaa8d828e0a8ea769c87b Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 15:23:57 +0100 Subject: [PATCH 1/7] Try creating a gui-less application --- tests/qlineedit.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/qlineedit.py diff --git a/tests/qlineedit.py b/tests/qlineedit.py new file mode 100644 index 00000000..2beb782a --- /dev/null +++ b/tests/qlineedit.py @@ -0,0 +1,6 @@ + +from PyQt5.QtWidgets import QApplication, QLineEdit + +app = QApplication(['-platform', 'minimal']) + +le = QLineEdit() \ No newline at end of file From e6e5c5c7af80318416ac54cdab2264a17b8999ad Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 15:26:54 +0100 Subject: [PATCH 2/7] Allow manual CI --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cfb4b4b..b879d2f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,8 @@ name: CI on: + workflow_dispatch: # allow manual trigger of CI + push: branches: - master From 9a2423448589f1518bf46322a8c3ed5cd721c2e9 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 15:32:04 +0100 Subject: [PATCH 3/7] Allow None for QLineEdit.setText() --- PyQt5-stubs/QtWidgets.pyi | 2 +- tests/qlineedit.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PyQt5-stubs/QtWidgets.pyi b/PyQt5-stubs/QtWidgets.pyi index 10cb7ac0..ef452898 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -7147,7 +7147,7 @@ class QLineEdit(QWidget): def undo(self) -> None: ... def selectAll(self) -> None: ... def clear(self) -> None: ... - def setText(self, a0: str) -> None: ... + def setText(self, a0: typing.Optional[str]) -> None: ... def hasAcceptableInput(self) -> bool: ... def setInputMask(self, inputMask: str) -> None: ... def inputMask(self) -> str: ... diff --git a/tests/qlineedit.py b/tests/qlineedit.py index 2beb782a..916659ec 100644 --- a/tests/qlineedit.py +++ b/tests/qlineedit.py @@ -3,4 +3,6 @@ app = QApplication(['-platform', 'minimal']) -le = QLineEdit() \ No newline at end of file +le = QLineEdit() +le.setText(None) + From e9696f817b5dc291b5948cda720dddc8957bf691 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:00:11 +0100 Subject: [PATCH 4/7] More attempts at gui-less application --- tests/qlineedit.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/qlineedit.py b/tests/qlineedit.py index 916659ec..771011ec 100644 --- a/tests/qlineedit.py +++ b/tests/qlineedit.py @@ -1,7 +1,11 @@ +import os -from PyQt5.QtWidgets import QApplication, QLineEdit +os.environ['QT_DEBUG_PLUGINS'] = '1' -app = QApplication(['-platform', 'minimal']) +from PyQt5.QtWidgets import QLineEdit, QApplication +from PyQt5.QtGui import QGuiApplication + +app = QApplication(['my_program', '-platform', 'offscreen']) le = QLineEdit() le.setText(None) From 2bbcc22e7ccf5c8818340387971c05c291db1588 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:06:16 +0100 Subject: [PATCH 5/7] Remove unneeded debug stuff --- tests/qlineedit.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/qlineedit.py b/tests/qlineedit.py index 771011ec..b269ec00 100644 --- a/tests/qlineedit.py +++ b/tests/qlineedit.py @@ -1,9 +1,6 @@ import os -os.environ['QT_DEBUG_PLUGINS'] = '1' - from PyQt5.QtWidgets import QLineEdit, QApplication -from PyQt5.QtGui import QGuiApplication app = QApplication(['my_program', '-platform', 'offscreen']) From f75f7204d9ba1ea549d3f770d31193a79002a183 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:06:54 +0100 Subject: [PATCH 6/7] No need for manual CI in the Pull Request --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b879d2f2..0cfb4b4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,6 @@ name: CI on: - workflow_dispatch: # allow manual trigger of CI - push: branches: - master From 9c5681d5a6d485703eb98ad1280f39831dbb06e4 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:11:35 +0100 Subject: [PATCH 7/7] Add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b40f03a8..a1f6d2aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * [#184](https://github.com/python-qt-tools/PyQt5-stubs/pull/184) Fix missing module variable detected by latest mypy 0.930 * [#183](https://github.com/python-qt-tools/PyQt5-stubs/pull/183) Add missing operations on QSize +* [#187](https://github.com/python-qt-tools/PyQt5-stubs/pull/187) Allow `None` as argument for `QLineEdit.setText()` + + ## 5.15.2.0 ### Added