Skip to content

Mismatch with QtGui.QPalette.ColorRole members between run-time and type stubs #444

@AWhetter

Description

@AWhetter

When using PySide6 or PyQt6, QtGui.QPalette.Foreground does not exist. This is because Foreground was removed in Qt6.
However the type stubs say that it does exist, because they're based on the PySide2 interface.

I'm unsure how to address this in Qt.py. If I'm understanding Qt.py correctly, it doesn't currently patch any objects from the underlying binding, it creates its own module and patches onto those. When patching objects, the patches are supposed to get applied to a newly created object in QtCompat.

So if we were to add QtGui.QPalette to QtCompat with a Foreground attribute, then then there's a mismatch between what's allowed when using PySide2 and PySide6.
With PySide2, Qt.QtGui.QPalette.Foreground exists. With PySide6, the type stubs say Qt.QtGui.QPalette.Foreground but it only exists as Qt.QtCompat.QPalette.Foreground.
If we removed Qt.QtGui.QPalette.Foreground from the type stubs then they wouldn't represent a complete PySide2 interface.

Perhaps it makes more sense to remove the members from QtGui.QPalette in the type stubs, to encourage accessing the members from QtGui.QPalette.ColorRole instead, in which case this would be an issue for types-pyside2 to address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions