PythonQt.QtGui.QKeyEvent · declarations 001
Back to PythonQt.QtGui.QKeyEvent
count
count() -> int
X.count() -> int
Supplemental documentation: Qt 5 reference:
int QKeyEvent::count() const
Returns the number of keys involved in this event. If text() is not empty, this is simply the length of the string.
See also Qt::WA_KeyCompression.
Upstream PySide2 reference signatures (binding differences may apply):
count(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#count
isAutoRepeat
isAutoRepeat() -> bool
X.isAutoRepeat() -> bool
Supplemental documentation: Qt 5 reference:
bool QKeyEvent::isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it
comes from an initial key press.
Note that if the event is a multiple-key compressed event that is partly due to auto-repeat, this function could return either true or false indeterminately.
Upstream PySide2 reference signatures (binding differences may apply):
isAutoRepeat(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#isAutoRepeat
key
key() -> int
X.key() -> int
Supplemental documentation: Qt 5 reference:
int QKeyEvent::key() const
Returns the code of the key that was pressed or released.
See Qt::Key for the list of keyboard codes. These codes are independent of the underlying window system. Note that this function does not distinguish between capital and non-capital letters, use the text() function (returning the Unicode text the key generated) for this purpose.
A value of either 0 or Qt::Key_unknown means that the event is not the result of a known key; for example, it may be the result of a compose sequence, a keyboard macro, or due to key event compression.
See also Qt::WA_KeyCompression.
Upstream PySide2 reference signatures (binding differences may apply):
key(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#key
matches
matches(key: Any) -> bool
X.matches(key) -> bool
Supplemental documentation: Qt 5 reference:
bool QKeyEvent::matches(QKeySequence::StandardKey key) const
Returns true if the key event matches the given standard key; otherwise returns
false.
This function was introduced in Qt 4.2.
Upstream PySide2 reference signatures (binding differences may apply):
matches(self, key: PySide2.QtGui.QKeySequence.StandardKey) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#matches
modifiers
modifiers() -> Any
X.modifiers()
Supplemental documentation: Qt 5 reference:
Qt::KeyboardModifiers QKeyEvent::modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
Warning: This function cannot always be trusted. The user can confuse it by pressing both Shift keys simultaneously and releasing one of them, for example.
See also QGuiApplication::keyboardModifiers().
Upstream PySide2 reference signatures (binding differences may apply):
modifiers(self) -> PySide2.QtCore.Qt.KeyboardModifiers
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#modifiers
nativeModifiers
nativeModifiers() -> int
X.nativeModifiers() -> int
Supplemental documentation: Qt 5 reference:
quint32 QKeyEvent::nativeModifiers() const
Returns the native modifiers of a key event. If the key event does not contain this data 0 is returned.
Note: The native modifiers may be 0, even if the key event contains extended information.
This function was introduced in Qt 4.2.
Upstream PySide2 reference signatures (binding differences may apply):
nativeModifiers(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#nativeModifiers
nativeScanCode
nativeScanCode() -> int
X.nativeScanCode() -> int
Supplemental documentation: Qt 5 reference:
quint32 QKeyEvent::nativeScanCode() const
Returns the native scan code of the key event. If the key event does not contain this data 0 is returned.
Note: The native scan code may be 0, even if the key event contains extended information.
Note: On macOS, this function is not useful, because there is no way to get the scan code from the system APIs. The function always returns 1 (or 0 in the case explained above).
This function was introduced in Qt 4.2.
Upstream PySide2 reference signatures (binding differences may apply):
nativeScanCode(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#nativeScanCode
nativeVirtualKey
nativeVirtualKey() -> int
X.nativeVirtualKey() -> int
Supplemental documentation: Qt 5 reference:
quint32 QKeyEvent::nativeVirtualKey() const
Returns the native virtual key, or key sym of the key event. If the key event does not contain this data 0 is returned.
Note: The native virtual key may be 0, even if the key event contains extended information.
This function was introduced in Qt 4.2.
Upstream PySide2 reference signatures (binding differences may apply):
nativeVirtualKey(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#nativeVirtualKey
text
text() -> str
X.text() -> str
Supplemental documentation: Qt 5 reference:
QString QKeyEvent::text() const
Returns the Unicode text that this key generated.
Return values when modifier keys such as Shift, Control, Alt, and Meta are pressed differ among platforms and could return an empty string.
Note: key() will always return a valid value, independent of modifier keys.
See also Qt::WA_KeyCompression.
Upstream PySide2 reference signatures (binding differences may apply):
text(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qkeyevent.html#text