mottosso / Qt.py

Minimal Python 2 & 3 shim around all Qt bindings - PySide, PySide2, PyQt4 and PyQt5.
MIT License
896 stars 252 forks source link

Update Qt.py #403

Closed mottosso closed 2 months ago

mottosso commented 2 months ago

Updating README, tests and version

mottosso commented 2 months ago

Tests for the PySide6 transition is not working. 😭 Help needed, we need to ensure that code written for PySide6 also runs on PySide2 and vice versa, and these two points are the start of that:

mottosso commented 2 months ago

These tests should work for every binding.

def test_midbutton_qt6():
    """QtCore.MidButton was renamed QtCore.MiddleButton in Qt 6"""
    from Qt import QtCore, QtCompat

    if binding("PySide6"):
        assert QtCompat.Qt.MidButton == QtCore.Qt.MiddleButton
    else:
        assert QtCompat.Qt.MidButton == QtCore.Qt.MidButton

def test_set_font_weight():
    """Qt 6 changed font weights from integers to enums"""
    from Qt import QtGui, QtCompat
    font = QtGui.QFont()
    QtCompat.QFont.setWeight(font, 400)
mottosso commented 2 months ago

This seems solid, but QtCompat for upgrading is still wip.