Obsolete Members for QHash

以下成员源于类 QHash 被弃用。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

相关非成员

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

相关非成员

int qGlobalQHashSeed ()

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

使用 QHashSeed::globalSeed () 代替。

Returns the current global QHash seed.

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

另请参阅 QHashSeed and QHashSeed::globalSeed ().

void qSetGlobalQHashSeed ( int newSeed )

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

使用 QHashSeed 代替。

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 。见 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.

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