[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    PyQt 6.2 / Qt 6.3: ValueError for new enum members
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2022-04-23 9:22:28
Message-ID: 20220423092228.v5tzsphm5l4xgmy4 () aragog
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,

With the attached example script, I see:

    Qt 6.2.3, PyQt 6.2.3, qVersion 6.3.0

    PixelMetric.PM_DefaultFrameWidth
    PixelMetric.PM_DefaultFrameWidth
    PixelMetric.PM_LineEditIconSize

    Traceback (most recent call last):
      File "/usr/lib/python3.10/enum.py", line 385, in __call__
        return cls.__new__(cls, value)
      File "/usr/lib/python3.10/enum.py", line 710, in __new__
        raise ve_exc
    ValueError: 94 is not a valid QStyle.PixelMetric

But I've never created a QStyle.PixelMetric myself - I just passed what
I got from PyQt back into PyQt!

I believe this is related to my mixture of versions (which I think was
supported so far, correct?), and the fact that this enum member was
added in Qt 6.3: https://codereview.qt-project.org/c/qt/qtbase/+/363114

Florian

-- 
            me@the-compiler.org | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/

["enum_valueerror.py" (text/plain)]

from PyQt6.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, qVersion
from PyQt6.QtWidgets import QApplication, QCommonStyle, QStyle, QStyleFactory, QLineEdit


class Style(QCommonStyle):

    def __init__(self, parent=None):
        super().__init__()
        self._style = QStyleFactory.create("Fusion")

    def pixelMetric(self, metric, option=None, widget=None):
        print(metric)
        return self._style.pixelMetric(metric, option, widget)


print(f"Qt {QT_VERSION_STR}, PyQt {PYQT_VERSION_STR}, qVersion {qVersion()}")


app = QApplication([])
style = Style()

le = QLineEdit()
le.setStyle(style)
le.setClearButtonEnabled(True)
le.show()

app.exec()

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic