diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-07-03 15:19:26 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-07-03 15:19:38 +0200 |
commit | e72e60b1072e0bdefc0b899a5aad505fc3a8b3df (patch) | |
tree | b11b306c7683fa7d31a1d7503e13ef7d2a5bce32 /src | |
parent | 0f92f2f35d55f2de545e8472c6b240c8fd0bb53f (diff) | |
parent | a2b221e595de812f28b4e25ce8014df62407f899 (diff) |
Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qrandom.cpp | 16 | ||||
-rw-r--r-- | src/corelib/global/qrandom.h | 10 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qrect.cpp | 4 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_win.cpp | 24 | ||||
-rw-r--r-- | src/network/socket/qsocks5socketengine.cpp | 7 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 5 |
7 files changed, 43 insertions, 25 deletions
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 90df8653a7..bf01b7ae2a 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 46d3e0e152..260fc1501a 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 94b7ccd761..1f5b61c978 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2167,6 +2167,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 6e51deebea..c8301e2590 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -1194,7 +1194,7 @@ bool QRect::intersects(const QRect &r) const Q_DECL_NOTHROW \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 Q_DECL_NOTHROW \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. */ /*! diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 24e8eabb6e..b429b3c365 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -608,13 +608,13 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() socketType = qt_socket_getType(socketDescriptor); #if defined (QNATIVESOCKETENGINE_DEBUG) - QString socketProtocolStr = "UnknownProtocol"; - if (socketProtocol == QAbstractSocket::IPv4Protocol) socketProtocolStr = "IPv4Protocol"; - else if (socketProtocol == QAbstractSocket::IPv6Protocol) socketProtocolStr = "IPv6Protocol"; + QString socketProtocolStr = QStringLiteral("UnknownProtocol"); + if (socketProtocol == QAbstractSocket::IPv4Protocol) socketProtocolStr = QStringLiteral("IPv4Protocol"); + else if (socketProtocol == QAbstractSocket::IPv6Protocol) socketProtocolStr = QStringLiteral("IPv6Protocol"); - QString socketTypeStr = "UnknownSocketType"; - if (socketType == QAbstractSocket::TcpSocket) socketTypeStr = "TcpSocket"; - else if (socketType == QAbstractSocket::UdpSocket) socketTypeStr = "UdpSocket"; + QString socketTypeStr = QStringLiteral("UnknownSocketType"); + if (socketType == QAbstractSocket::TcpSocket) socketTypeStr = QStringLiteral("TcpSocket"); + else if (socketType == QAbstractSocket::UdpSocket) socketTypeStr = QStringLiteral("UdpSocket"); qDebug("QNativeSocketEnginePrivate::fetchConnectionParameters() localAddress == %s, localPort = %i, peerAddress == %s, peerPort = %i, socketProtocol == %s, socketType == %s", localAddress.toString().toLatin1().constData(), localPort, peerAddress.toString().toLatin1().constData(), peerPort, socketProtocolStr.toLatin1().constData(), socketTypeStr.toLatin1().constData()); #endif @@ -1477,8 +1477,8 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) } #if defined (QNATIVESOCKETENGINE_DEBUG) - qDebug("QNativeSocketEnginePrivate::nativeWrite(%p \"%s\", %li) == %li", - data, qt_prettyDebug(data, qMin((int)ret, 16), (int)ret).data(), (int)len, (int)ret); + qDebug("QNativeSocketEnginePrivate::nativeWrite(%p \"%s\", %lli) == %lli", + data, qt_prettyDebug(data, qMin(int(ret), 16), int(ret)).data(), len, ret); #endif return ret; @@ -1520,11 +1520,11 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength) #if defined (QNATIVESOCKETENGINE_DEBUG) if (ret != -2) { - qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %li) == %li", - data, qt_prettyDebug(data, qMin((int)bytesRead, 16), (int)bytesRead).data(), (int)maxLength, (int)ret); + qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %lli) == %lli", + data, qt_prettyDebug(data, qMin(int(bytesRead), 16), int(bytesRead)).data(), maxLength, ret); } else { - qDebug("QNativeSocketEnginePrivate::nativeRead(%p, %li) == -2 (WOULD BLOCK)", - data, int(maxLength)); + qDebug("QNativeSocketEnginePrivate::nativeRead(%p, %lli) == -2 (WOULD BLOCK)", + data, maxLength); } #endif diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index e6ffdc3ac5..18b3ce9db2 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1188,6 +1188,8 @@ void QSocks5SocketEnginePrivate::_q_controlSocketReadNotification() break; case RequestMethodSent: parseRequestMethodReply(); + if (socks5State == Connected && data->controlSocket->bytesAvailable()) + _q_controlSocketReadNotification(); break; case Connected: { QByteArray buf; @@ -1751,6 +1753,11 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut) return false; if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState) return true; + if (bytesAvailable() && d->readNotificationPending) { + // We've got some data incoming, but the queued call hasn't been performed yet. + // The data is where we expect it to be already, so just return true. + return true; + } // we're connected if (d->mode == QSocks5SocketEnginePrivate::ConnectMode || diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1ef097e6e5..0a07726f25 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -11476,10 +11476,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } break; case Qt::WA_TranslucentBackground: - if (on) { + if (on) setAttribute(Qt::WA_NoSystemBackground); - d->updateIsTranslucent(); - } + d->updateIsTranslucent(); break; case Qt::WA_AcceptTouchEvents: |