diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d746d422..034b6553 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: if: matrix.os.matrix == 'linux' run: | sudo apt-get update --yes - sudo apt-get install --yes libgl1 + sudo apt-get install --yes libgl1 libgl1-mesa-dev xvfb x11-utils libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 - name: Install diff --git a/CHANGELOG.md b/CHANGELOG.md index 6352036e..6eed6c48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added * [#138](https://github.com/python-qt-tools/PyQt5-stubs/pull/138) update to PyQt5 5.15.3 * [#144](https://github.com/python-qt-tools/PyQt5-stubs/pull/144) add `QTreeWidgetItem.__lt__()` to allow sorting of items in a QTreeWidget +* [#148](https://github.com/python-qt-tools/PyQt5-stubs/pull/148) add `widgetResizable` parameter to `QScrollArea.__init__()` ## 5.15.2.0 diff --git a/PyQt5-stubs/QtWidgets.pyi b/PyQt5-stubs/QtWidgets.pyi index 92d28ffb..5ec04cdc 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -8147,7 +8147,7 @@ class QRubberBand(QWidget): class QScrollArea(QAbstractScrollArea): - def __init__(self, parent: typing.Optional[QWidget] = ...) -> None: ... + def __init__(self, parent: typing.Optional[QWidget] = ..., *, widgetResizable: bool = ...) -> None: ... def viewportSizeHint(self) -> QtCore.QSize: ... def scrollContentsBy(self, dx: int, dy: int) -> None: ... diff --git a/tests/qscrollarea.py b/tests/qscrollarea.py new file mode 100644 index 00000000..972424ec --- /dev/null +++ b/tests/qscrollarea.py @@ -0,0 +1,4 @@ +from PyQt5 import QtWidgets + +# https://github.com/python-qt-tools/PyQt5-stubs/issues/147 +QtWidgets.QScrollArea(widgetResizable=True) diff --git a/tests/test_stubs.py b/tests/test_stubs.py index b56bf85b..36e14a51 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -1,11 +1,17 @@ import os.path import pytest from mypy import api +from PyQt5 import QtWidgets TESTS_DIR = os.path.dirname(__file__) +application = QtWidgets.QApplication.instance() +assert application is None +application = QtWidgets.QApplication([]) + + def gen_tests(): for filename in os.listdir(TESTS_DIR): if filename.endswith('.py') and not filename.startswith('test_'): diff --git a/tox.ini b/tox.ini index 5d97a76e..da3e9973 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = py3{5,6,7,8,9} deps = mypy @ git+https://github.com/python/mypy@538d36481526135c44b90383663eaa177cfc32e3 pytest + pytest-xvfb pip>=20.0 commands = pip install PyQt5==5.15.* PyQt3D==5.15.* PyQtChart==5.15.* PyQtDataVisualization==5.15.* PyQtNetworkAuth==5.15.* PyQtPurchasing==5.15.* PyQtWebEngine==5.15.*