Skip to content

QtWidgets.QApplication.postEvent does not accept a QtCore.Qt.EventPriority #35

@AWhetter

Description

@AWhetter

Similar to #18, passing a QtCore.Qt.EventPriority to QtWidgets.QApplication.postEvent results in an error from mypy.
For example:

QtWidgets.QApplication.postEvent(self, myEvent, QtCore.Qt.LowEventPriority)

Results in the following mypy error:

error: Argument 3 to "postEvent" of "QCoreApplication" has incompatible type "EventPriority"; expected "int"  [arg-type]

PySide2 incorrectly annotated this as follows:

def postEvent(receiver: PySide2.QtCore.QObject, event: PySide2.QtCore.QEvent, priority: int = PySide2.QtCore.Qt.EventPriority.NormalEventPriority) -> None

PySide6 also annotates this somewhat incorrectly, although PySide6.QtCore.Qt.EventPriority is now an enum.IntEnum so the annotation is technically correct:

def postEvent(receiver: PySide6.QtCore.QObject, event: PySide6.QtCore.QEvent, priority: int = Instance(Qt.NormalEventPriority)) -> None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions