PyQt6 and QKeySequence(QKeySequence.StandardKey) constructor
Phil Thompson
phil at riverbankcomputing.com
Wed Jan 13 22:41:52 GMT 2021
On 13/01/2021 18:46, Dmitry Shachnev wrote:
> Hi again, here is another thing I noticed about PyQt6:
>
> The QKeySequence constructor which takes QKeySequence.StandardKey as
> the
> (only) argument does not work.
>
> It is documented here:
> https://doc.qt.io/qt-6/qkeysequence.html#QKeySequence-5
>
> In PyQt5 it works:
>
> >>> from PyQt5.QtGui import QGuiApplication, QKeySequence
> >>> app = QGuiApplication([])
> >>> QKeySequence(QKeySequence.StandardKey.Copy)
> <PyQt5.QtGui.QKeySequence object at 0x7f324f34dac0>
>
> In PyQt6 it results in the following error:
>
> >>> from PyQt6.QtGui import QGuiApplication, QKeySequence
> >>> app = QGuiApplication([])
> >>> QKeySequence(QKeySequence.StandardKey.Copy)
> TypeError: an integer is required (got type StandardKey)
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> SystemError: <class 'PyQt6.QtGui.QKeySequence'> returned a result
> with an error set
Should be fixed in the next snapshot.
Thanks,
Phil
More information about the PyQt
mailing list