Obsolete Members for QHash

The following members of class QHash are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

Related Non-Members

(deprecated (6.6)) int qGlobalQHashSeed()
(deprecated (6.6)) void qSetGlobalQHashSeed(int newSeed)

Related Non-Members

[since 5.6] int qGlobalQHashSeed()

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use QHashSeed::globalSeed() instead.

Returns the current global QHash seed.

The seed is set in any newly created QHash. See qHash about how this seed is being used by QHash.

This function was introduced in Qt 5.6.

See also QHashSeed and QHashSeed::globalSeed().

[since 5.6] void qSetGlobalQHashSeed(int newSeed)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use QHashSeed instead.

Sets the global QHash seed to newSeed.

Manually setting the global QHash seed value should be done only for testing and debugging purposes, when deterministic and reproducible behavior on a QHash is needed. We discourage to do it in production code as it can make your application susceptible to algorithmic complexity attacks.

From Qt 5.10 and onwards, the only allowed values are 0 and -1. Passing the value -1 will reinitialize the global QHash seed to a random value, while the value of 0 is used to request a stable algorithm for C++ primitive types types (like int) and string types (QString, QByteArray).

The seed is set in any newly created QHash. See qHash about how this seed is being used by QHash.

If the environment variable QT_HASH_SEED is set, calling this function will result in a no-op.

This function was introduced in Qt 5.6.

See also QHashSeed::globalSeed() and QHashSeed.

© 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.