Add qHash(QKeySequence)
Key sequences can be compared for equality, so qHash should be overloaded, too. [ChangeLog][QtGui][QKeySequence] Added qHash(QKeySequence). Change-Id: I3cf896292459897d66198d96dfcdba1a39bdafce Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
d1de6c521e
commit
10d53a3f0e
@ -39,6 +39,7 @@
|
|||||||
#ifndef QT_NO_SHORTCUT
|
#ifndef QT_NO_SHORTCUT
|
||||||
|
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
|
#include <QtCore/qhashfunctions.h>
|
||||||
#ifndef QT_NO_REGEXP
|
#ifndef QT_NO_REGEXP
|
||||||
# include "qregexp.h"
|
# include "qregexp.h"
|
||||||
#endif
|
#endif
|
||||||
@ -1409,6 +1410,16 @@ bool QKeySequence::operator==(const QKeySequence &other) const
|
|||||||
d->key[3] == other.d->key[3]);
|
d->key[3] == other.d->key[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.6
|
||||||
|
|
||||||
|
Calculates the hash value of \a key, using
|
||||||
|
\a seed to seed the calculation.
|
||||||
|
*/
|
||||||
|
uint qHash(const QKeySequence &key, uint seed) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return qHashRange(key.d->key, key.d->key + QKeySequencePrivate::MaxKeyCount, seed);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Provides an arbitrary comparison of this key sequence and
|
Provides an arbitrary comparison of this key sequence and
|
||||||
|
@ -43,11 +43,12 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
#ifndef QT_NO_SHORTCUT
|
#ifndef QT_NO_SHORTCUT
|
||||||
|
|
||||||
|
class QKeySequence;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
QKeySequence stream functions
|
QKeySequence stream functions
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifndef QT_NO_DATASTREAM
|
#ifndef QT_NO_DATASTREAM
|
||||||
class QKeySequence;
|
|
||||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
|
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
|
||||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
|
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
|
||||||
#endif
|
#endif
|
||||||
@ -59,6 +60,8 @@ void qt_set_sequence_auto_mnemonic(bool b);
|
|||||||
class QVariant;
|
class QVariant;
|
||||||
class QKeySequencePrivate;
|
class QKeySequencePrivate;
|
||||||
|
|
||||||
|
Q_GUI_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QKeySequence &key, uint seed = 0) Q_DECL_NOTHROW;
|
||||||
|
|
||||||
class Q_GUI_EXPORT QKeySequence
|
class Q_GUI_EXPORT QKeySequence
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
@ -204,6 +207,7 @@ private:
|
|||||||
|
|
||||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
|
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
|
||||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
|
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
|
||||||
|
friend Q_GUI_EXPORT uint qHash(const QKeySequence &key, uint seed) Q_DECL_NOTHROW;
|
||||||
friend class QShortcutMap;
|
friend class QShortcutMap;
|
||||||
friend class QShortcut;
|
friend class QShortcut;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user