QFlags::testFlag: clarify the behavior in the docs
The name made me fall in a trap: I thought that testFlag returned true if *any* of the bits in the argument were set in the QFlags object. In reality, it returns true if *all* the bits are set, and an argument equivalent to 0 is treated specially. Clarify this in the documentation. Change-Id: I9e8088c48038b4e6ba5830fdb7e473c6d7884b29 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 89f55f13fdae3aa52614b063ff6ceb8276340d44) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
26211cca19
commit
5ece368fa0
@ -479,6 +479,14 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value));
|
|||||||
\since 4.2
|
\since 4.2
|
||||||
|
|
||||||
Returns \c true if the flag \a flag is set, otherwise \c false.
|
Returns \c true if the flag \a flag is set, otherwise \c false.
|
||||||
|
|
||||||
|
\note if \a flag contains multiple bits set to 1 (for instance, if
|
||||||
|
it's an enumerator equal to the bitwise-OR of other enumerators)
|
||||||
|
then this function will return \c true if and only if all the bits
|
||||||
|
are set in this flags object. On the other hand, if \a flag contains
|
||||||
|
no bits set to 1 (that is, its value as a integer is 0), then this
|
||||||
|
function will return \c true if and only if this flags object also
|
||||||
|
has no bits set to 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user