PyQt6 and QKeySequence(QKeySequence.StandardKey) constructor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

PyQt6 and QKeySequence(QKeySequence.StandardKey) constructor

Dmitry Shachnev
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

--
Dmitry Shachnev
Reply | Threaded
Open this post in threaded view
|

Re: PyQt6 and QKeySequence(QKeySequence.StandardKey) constructor

Phil Thompson-5
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
Reply | Threaded
Open this post in threaded view
|

Re: PyQt6 and QKeySequence(QKeySequence.StandardKey) constructor

Dmitry Shachnev
On Wed, Jan 13, 2021 at 10:41:52PM +0000, Phil Thompson wrote:
> 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.
>
> Should be fixed in the next snapshot.

Thank you again!

--
Dmitry Shachnev