Skip to content

setWeight argument type difference between pyqt6 and pyside6 #512

@oscargus

Description

@oscargus

When generating a UI with QT Designer and compiling it with pyqt6 the argument type to setWeight is not compatible with pyside6. pyside6 uses an IntEnum, while pyqt6 uses an int.

FAILED test/unit/test_scheduler_gui.py::test_start - TypeError: 'PySide6.QtGui.QFont.setWeight' called with wrong argument types:
  PySide6.QtGui.QFont.setWeight(int)
Supported signatures:
  PySide6.QtGui.QFont.setWeight(weight: PySide6.QtGui.QFont.Weight, /)

Currently, I solve that by just removing those calls manually (I am pretty sure that I didn't do anything in QT Designer on purpose to change font, but I may very well have done it, but that probably means that others will have the same problem).

https://www.riverbankcomputing.com/static/Docs/PyQt6/api/qtgui/qfont.html#setWeight
https://doc.qt.io/qtforpython-6/PySide6/QtGui/QFont.html#PySide6.QtGui.QFont.setWeight

By compiling using pyside6 this is not a problem (at least not since I do not think I set the weight...), but it would be a slight improvement if it was possible to use setWeight in both toolkits.

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