summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-07-05 15:37:50 +0200
committerLiang Qi <liang.qi@qt.io>2019-07-05 15:37:50 +0200
commitdeee7b7eced5b240e3161d655319dbaaf2f8965c (patch)
tree4ad6db0e97482c24f02f111cbfeec224535feb73 /src/corelib
parentbcd4b14026094d0077ad1069054676cc6da96251 (diff)
parent6ad08b9cad4efefc72e64deaa0b720a3aab0fa54 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: .qmake.conf qmake/generators/makefile.cpp Change-Id: Ifb2633a69d0bf8cdf12d799c6259beefc279c49e
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qrandom.cpp16
-rw-r--r--src/corelib/global/qrandom.h10
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/corelib/tools/qrect.cpp4
4 files changed, 22 insertions, 10 deletions
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index 379e37ac07..711eb8f4d5 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -903,6 +903,10 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\snippet code/src_corelib_global_qrandom.cpp 12
+ If the \a highest parameter is negative, the result will be negative too;
+ if it is infinite or NaN, the result will be infinite or NaN too (that is,
+ not random).
+
\sa generateDouble(), bounded()
*/
@@ -934,7 +938,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\overload
Generates one random 32-bit quantity in the range between 0 (inclusive) and
- \a highest (exclusive). \a highest must not be negative.
+ \a highest (exclusive). \a highest must be positive.
Note that this function cannot be used to obtain values in the full 32-bit
range of int. Instead, use generate() and cast to int.
@@ -946,8 +950,11 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\fn quint32 QRandomGenerator::bounded(quint32 lowest, quint32 highest)
\overload
- Generates one random 32-bit quantity in the range between \a lowest (inclusive)
- and \a highest (exclusive). The same result may also be obtained by using
+ Generates one random 32-bit quantity in the range between \a lowest
+ (inclusive) and \a highest (exclusive). The \a highest parameter must be
+ greater than \a lowest.
+
+ The same result may also be obtained by using
\l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{\c std::uniform_int_distribution}
with parameters \a lowest and \c{\a highest - 1}. That class can also be used to
obtain quantities larger than 32 bits.
@@ -968,7 +975,8 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\overload
Generates one random 32-bit quantity in the range between \a lowest
- (inclusive) and \a highest (exclusive), both of which may be negative.
+ (inclusive) and \a highest (exclusive), both of which may be negative, but
+ \a highest must be greater than \a lowest.
Note that this function cannot be used to obtain values in the full 32-bit
range of int. Instead, use generate() and cast to int.
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index 2f72528266..445b520c76 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -122,14 +122,16 @@ public:
return quint32(value);
}
- int bounded(int highest)
+ quint32 bounded(quint32 lowest, quint32 highest)
{
- return int(bounded(quint32(highest)));
+ Q_ASSERT(highest > lowest);
+ return bounded(highest - lowest) + lowest;
}
- quint32 bounded(quint32 lowest, quint32 highest)
+ int bounded(int highest)
{
- return bounded(highest - lowest) + lowest;
+ Q_ASSERT(highest > 0);
+ return int(bounded(0U, quint32(highest)));
}
int bounded(int lowest, int highest)
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 69556ba9e3..5c1ae8aa43 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2232,6 +2232,8 @@ void QObject::removeEventFilter(QObject *obj)
*/
/*!
+ \threadsafe
+
Schedules this object for deletion.
The object will be deleted when control returns to the event
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index d622f92530..cd20102a2b 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -1194,7 +1194,7 @@ bool QRect::intersects(const QRect &r) const noexcept
\fn QRect operator-(const QRect &lhs, const QMargins &rhs)
\relates QRect
- Returns the \a lhs rectangle shrunken by the \a rhs margins.
+ Returns the \a lhs rectangle shrunk by the \a rhs margins.
\since 5.3
*/
@@ -2417,7 +2417,7 @@ QRect QRectF::toAlignedRect() const noexcept
\relates QRectF
\since 5.3
- Returns the \a lhs rectangle grown by the \a rhs margins.
+ Returns the \a lhs rectangle shrunk by the \a rhs margins.
*/
/*!