QKeyCombination Class

The QKeyCombination class stores a combination of a key with optional modifiers. More...

Header: #include <QKeyCombination>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 6.0

Public Functions

QKeyCombination(Qt::Key key = Qt::Key_unknown)
QKeyCombination(Qt::KeyboardModifiers modifiers, Qt::Key key = Qt::Key_unknown)
QKeyCombination(Qt::Modifiers modifiers, Qt::Key key = Qt::Key_unknown)
Qt::Key key() const
Qt::KeyboardModifiers keyboardModifiers() const
int toCombined() const

Static Public Members

QKeyCombination fromCombined(int combined)
size_t qHash(QKeyCombination key, size_t seed = 0)
bool operator!=(QKeyCombination lhs, QKeyCombination rhs)
QDataStream &operator<<(QDataStream &out, QKeyCombination combination)
QDebug operator<<(QDebug debug, QKeyCombination combination)
bool operator==(QKeyCombination lhs, QKeyCombination rhs)
QDataStream &operator>>(QDataStream &in, QKeyCombination &combination)
QKeyCombination operator|(Qt::Key key, Qt::KeyboardModifier modifier)
QKeyCombination operator|(Qt::Key key, Qt::KeyboardModifiers modifiers)
QKeyCombination operator|(Qt::Key key, Qt::Modifier modifier)
QKeyCombination operator|(Qt::Key key, Qt::Modifiers modifiers)
QKeyCombination operator|(Qt::KeyboardModifier modifier, Qt::Key key)
QKeyCombination operator|(Qt::KeyboardModifiers modifiers, Qt::Key key)
QKeyCombination operator|(Qt::Modifier modifier, Qt::Key key)
QKeyCombination operator|(Qt::Modifiers modifiers, Qt::Key key)

Detailed Description

The QKeyCombination class can be used to represent a combination of a key with zero or more keyboard modifiers.

See also QKeySequence.

Member Function Documentation

[constexpr noexcept] QKeyCombination::QKeyCombination(Qt::Key key = Qt::Key_unknown)

Constructs a QKeyCombination object that represents the key key and no modifiers.

See also key().

[explicit constexpr noexcept] QKeyCombination::QKeyCombination(Qt::KeyboardModifiers modifiers, Qt::Key key = Qt::Key_unknown)

Constructs a QKeyCombination object that represents the combination of key with the modifiers modifiers.

See also key() and keyboardModifiers().

[explicit constexpr noexcept] QKeyCombination::QKeyCombination(Qt::Modifiers modifiers, Qt::Key key = Qt::Key_unknown)

Constructs a QKeyCombination object that represents the combination of key with the modifiers modifiers.

See also key() and keyboardModifiers().

[static constexpr] QKeyCombination QKeyCombination::fromCombined(int combined)

Constructs a QKeyCombination object by extracting the key and the modifiers out of combined, which must be the result of a bitwise OR between a value of type Qt::Key and value of type Qt::KeyboardModifiers. toCombined() can be used in order to produce valid values for combined.

See also toCombined().

[constexpr noexcept] Qt::Key QKeyCombination::key() const

Returns the key represented by this QKeyCombination object.

See also keyboardModifiers().

[constexpr noexcept] Qt::KeyboardModifiers QKeyCombination::keyboardModifiers() const

Returns the keyboard modifiers represented by this QKeyCombination object.

See also key().

[constexpr noexcept] int QKeyCombination::toCombined() const

Returns an integer value obtained by applying a bitwise OR between the values of key() and keyboardModifiers() represented by this object. A QKeyCombination object can be created from the returned integer value by using fromCombined().

See also fromCombined(), key(), and keyboardModifiers().

Related Non-Members

[constexpr noexcept] QKeyCombination operator|(Qt::Key key, Qt::KeyboardModifier modifier)

[constexpr noexcept] QKeyCombination operator|(Qt::Key key, Qt::Modifier modifier)

[constexpr noexcept] QKeyCombination operator|(Qt::KeyboardModifier modifier, Qt::Key key)

[constexpr noexcept] QKeyCombination operator|(Qt::Modifier modifier, Qt::Key key)

Returns a QKeyCombination object that represents the combination of key with the modifier modifier.

[constexpr noexcept] QKeyCombination operator|(Qt::Key key, Qt::KeyboardModifiers modifiers)

[constexpr noexcept] QKeyCombination operator|(Qt::Key key, Qt::Modifiers modifiers)

[constexpr noexcept] QKeyCombination operator|(Qt::KeyboardModifiers modifiers, Qt::Key key)

[constexpr noexcept] QKeyCombination operator|(Qt::Modifiers modifiers, Qt::Key key)

Returns a QKeyCombination object that represents the combination of key with the modifiers modifiers.

[constexpr noexcept] size_t qHash(QKeyCombination key, size_t seed = 0)

Returns the hash value for the key, using seed to seed the calculation.

[constexpr noexcept] bool operator!=(QKeyCombination lhs, QKeyCombination rhs)

Returns true if lhs and rhs have different combinations of key and modifiers, otherwise false.

QDataStream &operator<<(QDataStream &out, QKeyCombination combination)

Writes the combination combination into the stream out. Returns out.

See also Serializing Qt Data Types.

QDebug operator<<(QDebug debug, QKeyCombination combination)

Writes the combination combination into the debug object debug for debugging purposes.

See also Debugging Techniques.

[constexpr noexcept] bool operator==(QKeyCombination lhs, QKeyCombination rhs)

Returns true if lhs and rhs have the same combination of key and modifiers, and false otherwise.

QDataStream &operator>>(QDataStream &in, QKeyCombination &combination)

Reads the combination combination from the stream in. Returns in.

See also Serializing Qt Data Types.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.