Obsolete Members for QHash

QHash 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。

相关非成员

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

相关非成员

[deprecated in 6.6] int qGlobalQHashSeed()

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用QHashSeed::globalSeed() 代替。

返回当前全局QHash 种子。

种子将在任何新创建的QHash 中设置。关于QHash 如何使用该种子,请参见qHash

另请参见 QHashSeedQHashSeed::globalSeed()。

[deprecated in 6.6] void qSetGlobalQHashSeed(int newSeed)

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用QHashSeed

将全局QHash 种子值设置为newSeed

手动设置全局QHash 种子值只能用于测试和调试目的,即需要在QHash 上确定并重现行为。我们不鼓励在生产代码中这样做,因为这会使您的应用程序容易受到algorithmic complexity attacks 的影响。

从 Qt 5.10 开始,允许的值只有 0 和-1。传递值 -1 会将全局QHash 种子重新初始化为随机值,而值 0 则用于请求 C++ 原始类型(如int )和字符串类型(QString,QByteArray )的稳定算法。

种子将在任何新创建的QHash 中设置。有关QHash 如何使用该种子,请参见qHash

如果设置了环境变量QT_HASH_SEED ,调用此函数将导致无操作。

另请参阅 QHashSeed::globalSeed() 和QHashSeed

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