PyQt6 and QKeySequence(QKeySequence.StandardKey) constructor
    Dmitry Shachnev 
    mitya57 at ubuntu.com
       
    Wed Jan 13 18:46:42 GMT 2021
    
    
  
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
    
    
More information about the PyQt
mailing list