Skip to content

Conversation

@AWhetter
Copy link

Fixes #27

I've tested this by running mypy against the following code:

import sys
from PySide2 import QtCore, QtGui, QtWidgets

class Window(QtWidgets.QWidget):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._label = QtWidgets.QLabel("Try Delete", self)
        self._shortcut = QtWidgets.QShortcut(QtGui.QKeySequence.StandardKey.Delete, self)
        self._shortcut.activated.connect(self.on_delete)

        self._layout = QtWidgets.QHBoxLayout()
        self._layout.addWidget(self._label)

        self.setLayout(self._layout)
        self.resize(150, 100)
        self.show()

    @QtCore.Slot()
    def on_delete(self):
        print("Deleting!")

app = QtWidgets.QApplication(sys.argv)
win = Window()
win.show()
sys.exit(app.exec_())

mypy fails without this change, and passes with the change.
I haven't tested every changed signature, but I've changed only those signatures that are similarly typed in PySide6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QKeySequence.StandardKey is not accepted where a QKeySequence is valid

1 participant