summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-03-15 19:04:30 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2019-03-15 19:04:30 +0000
commit8cc8eb8f24b9d297a25c9841326c6fa8561cf80e (patch)
tree9f9d05bb098dc65b8a36c5db59b451573e507cb9 /src
parent73a2e9c4098037aaa540b97ff097c660290622da (diff)
parent32084b073362e52df597cc388cf54f5173e20b0d (diff)
Merge "Merge remote-tracking branch 'origin/5.13' into dev" into refs/staging/dev
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp4
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp16
-rw-r--r--src/corelib/plugin/qlibrary.cpp4
-rw-r--r--src/corelib/serialization/qcborstream.cpp2
-rw-r--r--src/corelib/tools/qbytearray.cpp19
-rw-r--r--src/corelib/tools/qcollator_win.cpp34
-rw-r--r--src/corelib/tools/qscopeguard.qdoc2
-rw-r--r--src/corelib/tools/qstring.cpp26
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp8
-rw-r--r--src/gui/kernel/qplatformcursor.cpp2
-rw-r--r--src/gui/kernel/qwindow.cpp3
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp5
-rw-r--r--src/network/access/qnetworkreplywasmimpl.cpp1
-rw-r--r--src/network/ssl/qocspresponse.cpp8
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm3
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp105
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql_p.h14
-rw-r--r--src/widgets/dialogs/qdialog.cpp7
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp4
-rw-r--r--src/widgets/kernel/qtooltip.cpp4
-rw-r--r--src/widgets/kernel/qwidget.cpp8
-rw-r--r--src/widgets/styles/qcommonstyle.cpp25
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp2
25 files changed, 181 insertions, 129 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 804e0b2935..e2598b7858 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -764,7 +764,7 @@ QList<QByteArray> QTextCodec::aliases() const
encoding of the subclass to Unicode, and returns the result in a
QString.
- \a state can be 0, in which case the conversion is stateless and
+ \a state can be \nullptr, in which case the conversion is stateless and
default conversion rules should be used. If state is not 0, the
codec should save the state after the conversion in \a state, and
adjust the \c remainingChars and \c invalidChars members of the struct.
@@ -780,7 +780,7 @@ QList<QByteArray> QTextCodec::aliases() const
from Unicode to the encoding of the subclass, and returns the result
in a QByteArray.
- \a state can be 0 in which case the conversion is stateless and
+ \a state can be \nullptr in which case the conversion is stateless and
default conversion rules should be used. If state is not 0, the
codec should save the state after the conversion in \a state, and
adjust the \c remainingChars and \c invalidChars members of the struct.
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp
index c8c5f694c6..2fa4f88011 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qscopeguard.cpp
@@ -57,7 +57,7 @@ void myComplexCodeWithMultipleReturnPoints(int v)
if (v == -1)
return;
- int v2 = code_that_might_through_exceptions();
+ int v2 = code_that_might_throw_exceptions();
if (v2 == -1)
return;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 25e205b812..759ccaacd8 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2875,8 +2875,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
0 may be used as a wildcard, meaning "any signal", "any receiving
object", or "any slot in the receiving object", respectively.
- The \a sender may never be 0. (You cannot disconnect signals from
- more than one object in a single call.)
+ The \a sender may never be \nullptr. (You cannot disconnect signals
+ from more than one object in a single call.)
If \a signal is 0, it disconnects \a receiver and \a method from
any signal. If not, only the specified signal is disconnected.
@@ -2887,8 +2887,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
If \a method is 0, it disconnects anything that is connected to \a
receiver. If not, only slots named \a method will be disconnected,
- and all other slots are left alone. The \a method must be 0 if \a
- receiver is left out, so you cannot disconnect a
+ and all other slots are left alone. The \a method must be \nullptr
+ if \a receiver is left out, so you cannot disconnect a
specifically-named slot on all objects.
\sa connect()
@@ -4913,8 +4913,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
0 may be used as a wildcard, meaning "any signal", "any receiving
object", or "any slot in the receiving object", respectively.
- The \a sender may never be 0. (You cannot disconnect signals from
- more than one object in a single call.)
+ The \a sender may never be \nullptr. (You cannot disconnect signals
+ from more than one object in a single call.)
If \a signal is 0, it disconnects \a receiver and \a method from
any signal. If not, only the specified signal is disconnected.
@@ -4925,8 +4925,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
If \a method is 0, it disconnects anything that is connected to \a
receiver. If not, only slots named \a method will be disconnected,
- and all other slots are left alone. The \a method must be 0 if \a
- receiver is left out, so you cannot disconnect a
+ and all other slots are left alone. The \a method must be \nullptr
+ if \a receiver is left out, so you cannot disconnect a
specifically-named slot on all objects.
\note It is not possible to use this overload to diconnect signals
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index aa63ed1a6b..6635286f76 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -133,8 +133,8 @@ QT_BEGIN_NAMESPACE
The following code snippet loads a library, resolves the symbol
"mysymbol", and calls the function if everything succeeded. If
something goes wrong, e.g. the library file does not exist or the
- symbol is not defined, the function pointer will be 0 and won't be
- called.
+ symbol is not defined, the function pointer will be \nullptr and
+ won't be called.
\snippet code/src_corelib_plugin_qlibrary.cpp 0
diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp
index 546f9ffe57..e222bf5514 100644
--- a/src/corelib/serialization/qcborstream.cpp
+++ b/src/corelib/serialization/qcborstream.cpp
@@ -1950,7 +1950,7 @@ inline void QCborStreamReader::preparse()
// for negative integer and we don't have separate types for Boolean,
// Null and Undefined).
if (type_ == CborBooleanType || type_ == CborNullType || type_ == CborUndefinedType) {
- type_ = SimpleType;
+ type_ = CborSimpleType;
value64 = quint8(d->buffer.at(d->bufferStart)) - CborSimpleType;
} else {
// Using internal TinyCBOR API!
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 8770100749..8bf20350d6 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -523,7 +523,7 @@ int qstrnicmp(const char *str1, const char *str2, uint len)
A helper for QByteArray::compare. Compares \a len1 bytes from \a str1 to \a
len2 bytes from \a str2. If \a len2 is -1, then \a str2 is expected to be
- null-terminated.
+ '\\0'-terminated.
*/
int qstrnicmp(const char *str1, qsizetype len1, const char *str2, qsizetype len2)
{
@@ -1765,9 +1765,10 @@ void QByteArray::chop(int n)
If \a data is 0, a null byte array is constructed.
- If \a size is negative, \a data is assumed to point to a nul-terminated
- string and its length is determined dynamically. The terminating
- nul-character is not considered part of the byte array.
+ If \a size is negative, \a data is assumed to point to a
+ '\\0'-terminated string and its length is determined dynamically.
+ The terminating \\0 character is not considered part of the
+ byte array.
QByteArray makes a deep copy of the string data.
@@ -1924,7 +1925,7 @@ void QByteArray::expand(int i)
/*!
\internal
- Return a QByteArray that is sure to be NUL-terminated.
+ Return a QByteArray that is sure to be '\\0'-terminated.
By default, all QByteArray have an extra NUL at the end,
guaranteeing that assumption. However, if QByteArray::fromRawData
@@ -2336,8 +2337,8 @@ QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after)
\overload
- Replaces \a len bytes from index position \a pos with the zero terminated
- string \a after.
+ Replaces \a len bytes from index position \a pos with the
+ '\\0'-terminated string \a after.
Notice: this can change the length of the byte array.
*/
@@ -2415,7 +2416,7 @@ QByteArray &QByteArray::replace(const char *c, const QByteArray &after)
Replaces every occurrence of the string \a before with the string \a after.
Since the sizes of the strings are given by \a bsize and \a asize, they
- may contain zero characters and do not need to be zero-terminated.
+ may contain zero characters and do not need to be '\\0'-terminated.
*/
QByteArray &QByteArray::replace(const char *before, int bsize, const char *after, int asize)
@@ -4540,7 +4541,7 @@ QByteArray QByteArray::number(double n, char f, int prec)
\snippet code/src_corelib_tools_qbytearray.cpp 43
\warning A byte array created with fromRawData() is \e not
- null-terminated, unless the raw data contains a 0 character at
+ '\\0'-terminated, unless the raw data contains a 0 character at
position \a size. While that does not matter for QDataStream or
functions like indexOf(), passing the byte array to a function
accepting a \c{const char *} expected to be '\\0'-terminated will
diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp
index 4adbf4adf8..9d81de882f 100644
--- a/src/corelib/tools/qcollator_win.cpp
+++ b/src/corelib/tools/qcollator_win.cpp
@@ -72,6 +72,8 @@ void QCollatorPrivate::init()
if (caseSensitivity == Qt::CaseInsensitive)
collator |= NORM_IGNORECASE;
+ // WINE does not support SORT_DIGITSASNUMBERS :-(
+ // (and its std::sort() crashes on bad comparisons, QTBUG-74209)
if (numericMode)
collator |= SORT_DIGITSASNUMBERS;
@@ -98,16 +100,36 @@ int QCollator::compare(QStringView s1, QStringView s2) const
// runtime convention of comparing strings, the value 2 can be subtracted
// from a nonzero return value. Then, the meaning of <0, ==0, and >0 is
// consistent with the C runtime.
+ // [...] The function returns 0 if it does not succeed.
+ // https://docs.microsoft.com/en-us/windows/desktop/api/stringapiset/nf-stringapiset-comparestringex#return-value
#ifndef USE_COMPARESTRINGEX
- return CompareString(d->localeID, d->collator,
- reinterpret_cast<const wchar_t*>(s1.data()), s1.size(),
- reinterpret_cast<const wchar_t*>(s2.data()), s2.size()) - 2;
+ const int ret = CompareString(d->localeID, d->collator,
+ reinterpret_cast<const wchar_t *>(s1.data()), s1.size(),
+ reinterpret_cast<const wchar_t *>(s2.data()), s2.size());
#else
- return CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator,
- reinterpret_cast<LPCWSTR>(s1.data()), s1.size(),
- reinterpret_cast<LPCWSTR>(s2.data()), s2.size(), NULL, NULL, 0) - 2;
+ const int ret = CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator,
+ reinterpret_cast<LPCWSTR>(s1.data()), s1.size(),
+ reinterpret_cast<LPCWSTR>(s2.data()), s2.size(),
+ nullptr, nullptr, 0);
#endif
+ if (Q_LIKELY(ret))
+ return ret - 2;
+
+ switch (DWORD error = GetLastError()) {
+ case ERROR_INVALID_FLAGS:
+ qWarning("Unsupported flags (%d) used in QCollator", int(d->collator));
+ break;
+ case ERROR_INVALID_PARAMETER:
+ qWarning("Invalid parameter for QCollator::compare()");
+ break;
+ default:
+ qWarning("Failed (%ld) comparison in QCollator::compare()", long(error));
+ break;
+ }
+ // We have no idea what to return, so pretend we think they're equal.
+ // At least that way we'll be consistent if we get the same values swapped ...
+ return 0;
}
QCollatorSortKey QCollator::sortKey(const QString &string) const
diff --git a/src/corelib/tools/qscopeguard.qdoc b/src/corelib/tools/qscopeguard.qdoc
index 70e13ab2fd..21b0bab9cf 100644
--- a/src/corelib/tools/qscopeguard.qdoc
+++ b/src/corelib/tools/qscopeguard.qdoc
@@ -33,7 +33,7 @@ QT_BEGIN_NAMESPACE
\class QScopeGuard
\since 5.12
\inmodule QtCore
- \brief Provides a scope guard for calling a function at the of
+ \brief Provides a scope guard for calling a function at the end of
a scope.
*/
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index da010eca0c..98cce87464 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -1468,7 +1468,7 @@ const QString::Null QString::null = { };
In all of the QString functions that take \c{const char *}
parameters, the \c{const char *} is interpreted as a classic
C-style '\\0'-terminated string encoded in UTF-8. It is legal for
- the \c{const char *} parameter to be 0.
+ the \c{const char *} parameter to be \nullptr.
You can also provide string data as an array of \l{QChar}s:
@@ -2041,7 +2041,7 @@ const QString::Null QString::null = { };
the size of wchar. If wchar is 4 bytes, the \a string is interpreted as UCS-4,
if wchar is 2 bytes it is interpreted as UTF-16.
- If \a size is -1 (default), the \a string has to be 0 terminated.
+ If \a size is -1 (default), the \a string has to be \\0'-terminated.
\sa fromUtf16(), fromLatin1(), fromLocal8Bit(), fromUtf8(), fromUcs4(), fromStdWString()
*/
@@ -2107,7 +2107,7 @@ int QString::toUcs4_helper(const ushort *uc, int length, uint *out)
If \a unicode is 0, a null string is constructed.
- If \a size is negative, \a unicode is assumed to point to a nul-terminated
+ If \a size is negative, \a unicode is assumed to point to a \\0'-terminated
array and its length is determined dynamically. The terminating
nul-character is not considered part of the string.
@@ -5448,7 +5448,7 @@ static QVector<uint> qt_convert_to_ucs4(QStringView string);
this string is replaced by the Unicode's replacement character
(QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}).
- The returned vector is not NUL terminated.
+ The returned vector is not \\0'-terminated.
\sa fromUtf8(), toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec, fromUcs4(), toWCharArray()
*/
@@ -5480,7 +5480,7 @@ static QVector<uint> qt_convert_to_ucs4(QStringView string)
this string is replaced by the Unicode's replacement character
(QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}).
- The returned vector is not NUL terminated.
+ The returned vector is not \\0'-terminated.
\sa QString::toUcs4(), QStringView::toUcs4(), QtPrivate::convertToLatin1(),
QtPrivate::convertToLocal8Bit(), QtPrivate::convertToUtf8()
@@ -5638,8 +5638,7 @@ QString QString::fromUtf8_helper(const char *str, int size)
Returns a QString initialized with the first \a size characters
of the Unicode string \a unicode (ISO-10646-UTF-16 encoded).
- If \a size is -1 (default), \a unicode must be terminated
- with a 0.
+ If \a size is -1 (default), \a unicode must be \\0'-terminated.
This function checks for a Byte Order Mark (BOM). If it is missing,
host byte order is assumed.
@@ -5670,8 +5669,7 @@ QString QString::fromUtf16(const ushort *unicode, int size)
Returns a QString initialized with the first \a size characters
of the Unicode string \a str (ISO-10646-UTF-16 encoded).
- If \a size is -1 (default), \a str must be terminated
- with a 0.
+ If \a size is -1 (default), \a str must be \\0'-terminated.
This function checks for a Byte Order Mark (BOM). If it is missing,
host byte order is assumed.
@@ -5691,8 +5689,7 @@ QString QString::fromUtf16(const ushort *unicode, int size)
Returns a QString initialized with the first \a size characters
of the Unicode string \a str (ISO-10646-UCS-4 encoded).
- If \a size is -1 (default), \a str must be terminated
- with a 0.
+ If \a size is -1 (default), \a str must be \\0'-terminated.
\sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String()
*/
@@ -5703,8 +5700,7 @@ QString QString::fromUtf16(const ushort *unicode, int size)
Returns a QString initialized with the first \a size characters
of the Unicode string \a unicode (ISO-10646-UCS-4 encoded).
- If \a size is -1 (default), \a unicode must be terminated
- with a 0.
+ If \a size is -1 (default), \a unicode must be \\0'-terminated.
\sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String()
*/
@@ -10358,7 +10354,7 @@ ownership of it, no memory is freed when instances are destroyed.
Returns a Unicode representation of the string reference. Since
the data stems directly from the referenced string, it is not
- null-terminated unless the string reference includes the string's
+ \\0'-terminated unless the string reference includes the string's
null terminator.
\sa string()
@@ -11900,7 +11896,7 @@ QByteArray QStringRef::toUtf8() const
this string is replaced by the Unicode's replacement character
(QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}).
- The returned vector is not NUL terminated.
+ The returned vector is not \\0'-terminated.
\sa toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec
*/
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 97cbf5f9d3..3e3c7a6211 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -1905,7 +1905,7 @@ QStandardItem *QStandardItem::takeChild(int row, int column)
/*!
Removes \a row without deleting the row items, and returns a list of
pointers to the removed items. For items in the row that have not been
- set, the corresponding pointers in the list will be 0.
+ set, the corresponding pointers in the list will be \nullptr.
\sa removeRow(), insertRow(), takeColumn()
*/
@@ -1939,7 +1939,7 @@ QList<QStandardItem*> QStandardItem::takeRow(int row)
/*!
Removes \a column without deleting the column items, and returns a list of
pointers to the removed items. For items in the column that have not been
- set, the corresponding pointers in the list will be 0.
+ set, the corresponding pointers in the list will be \nullptr.
\sa removeColumn(), insertColumn(), takeRow()
*/
@@ -2718,7 +2718,7 @@ QStandardItem *QStandardItemModel::takeItem(int row, int column)
Removes the given \a row without deleting the row items, and returns a
list of pointers to the removed items. The model releases ownership of the
items. For items in the row that have not been set, the corresponding
- pointers in the list will be 0.
+ pointers in the list will be \nullptr.
\sa takeColumn()
*/
@@ -2734,7 +2734,7 @@ QList<QStandardItem*> QStandardItemModel::takeRow(int row)
Removes the given \a column without deleting the column items, and returns
a list of pointers to the removed items. The model releases ownership of
the items. For items in the column that have not been set, the
- corresponding pointers in the list will be 0.
+ corresponding pointers in the list will be \nullptr.
\sa takeRow()
*/
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index 76e38ab12d..49eff2ad23 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE
set or the system default cursor should take effect.
\a window is a pointer to the window currently displayed at QCursor::pos(). Note
- that this may be 0 if the current position is not occupied by a displayed widget.
+ that this may be \nullptr if the current position is not occupied by a displayed widget.
\sa QCursor::pos()
*/
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 3040a20308..1cc2435239 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -688,7 +688,8 @@ QWindow *QWindow::parent() const
Sets the \a parent Window. This will lead to the windowing system managing
the clip of the window, so it will be clipped to the \a parent window.
- Setting \a parent to be 0 will make the window become a top level window.
+ Setting \a parent to be \nullptr will make the window become a top level
+ window.
If \a parent is a window created by fromWinId(), then the current window
will be embedded inside \a parent, if the platform supports it.
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 9df3d73dd7..f79a4d1dc6 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -967,7 +967,10 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
} else if (state != QHttpNetworkConnectionChannel::IdleState && state != QHttpNetworkConnectionChannel::ReadingState) {
// Try to reconnect/resend before sending an error.
// While "Reading" the _q_disconnected() will handle this.
- if (reconnectAttempts-- > 0) {
+ // If we're using ssl then the protocolHandler is not initialized until
+ // "encrypted" has been emitted, since retrying requires the protocolHandler (asserted)
+ // we will not try if encryption is not done.
+ if (!pendingEncrypt && reconnectAttempts-- > 0) {
resendCurrentRequest();
return;
} else {
diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp
index b1e9853a50..f347cc0479 100644
--- a/src/network/access/qnetworkreplywasmimpl.cpp
+++ b/src/network/access/qnetworkreplywasmimpl.cpp
@@ -235,6 +235,7 @@ void QNetworkReplyWasmImpl::close()
void QNetworkReplyWasmImpl::abort()
{
Q_D(const QNetworkReplyWasmImpl);
+ setError( QNetworkReply::OperationCanceledError, "Operation canceled" );
d->doAbort();
close();
diff --git a/src/network/ssl/qocspresponse.cpp b/src/network/ssl/qocspresponse.cpp
index 1f2de44859..d564e817ca 100644
--- a/src/network/ssl/qocspresponse.cpp
+++ b/src/network/ssl/qocspresponse.cpp
@@ -124,14 +124,14 @@ QOcspResponse::QOcspResponse()
/*!
\since 5.13
- Creates a new response, the copy of \a other.
+ Copy-constructs a QOcspResponse instance.
*/
QOcspResponse::QOcspResponse(const QOcspResponse &) = default;
/*!
\since 5.13
- Move-constructs a QOcspResponse instance from \a other.
+ Move-constructs a QOcspResponse instance.
*/
QOcspResponse::QOcspResponse(QOcspResponse &&) Q_DECL_NOTHROW = default;
@@ -145,14 +145,14 @@ QOcspResponse::~QOcspResponse() = default;
/*!
\since 5.13
- Assigns \a other to the response and returns a reference to this response.
+ Copy-assigns and returns a reference to this response.
*/
QOcspResponse &QOcspResponse::operator=(const QOcspResponse &) = default;
/*!
\since 5.13
- Move-assigns \a other to this QOcspResponse instance.
+ Move-assigns to this QOcspResponse instance.
*/
QOcspResponse &QOcspResponse::operator=(QOcspResponse &&) Q_DECL_NOTHROW = default;
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index fff66049ff..535e7d7aa6 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -306,7 +306,7 @@ bool QIOSContext::verifyGraphicsHardwareAvailability()
Q_UNUSED(oldState);
if (applicationBackgrounded && newState != Qt::ApplicationSuspended) {
qCDebug(lcQpaGLContext) << "app no longer backgrounded, rendering enabled";
- applicationBackgrounded = true;
+ applicationBackgrounded = false;
}
}
);
@@ -317,6 +317,7 @@ bool QIOSContext::verifyGraphicsHardwareAvailability()
return;
qCDebug(lcQpaGLContext) << "app backgrounded, rendering disabled";
+ applicationBackgrounded = true;
// By the time we receive this signal the application has moved into
// Qt::ApplactionStateSuspended, and all windows have been obscured,
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 49b793ce38..c1be91cb22 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -53,6 +53,7 @@
#include <qlocale.h>
#include <QtSql/private/qsqlresult_p.h>
#include <QtSql/private/qsqldriver_p.h>
+#include <QtCore/private/qlocale_tools_p.h>
#include <queue>
@@ -135,7 +136,7 @@ protected:
bool nextResult() override;
QVariant data(int i) override;
bool isNull(int field) override;
- bool reset (const QString &query) override;
+ bool reset(const QString &query) override;
int size() override;
int numRowsAffected() override;
QSqlRecord record() const override;
@@ -319,15 +320,15 @@ public:
bool processResults();
};
-static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
- const QPSQLDriverPrivate *p, PGresult* result = 0)
+static QSqlError qMakeError(const QString &err, QSqlError::ErrorType type,
+ const QPSQLDriverPrivate *p, PGresult *result = nullptr)
{
const char *s = PQerrorMessage(p->connection);
QString msg = p->isUtf8 ? QString::fromUtf8(s) : QString::fromLocal8Bit(s);
QString errorCode;
if (result) {
- errorCode = QString::fromLatin1(PQresultErrorField(result, PG_DIAG_SQLSTATE));
- msg += QString::fromLatin1("(%1)").arg(errorCode);
+ errorCode = QString::fromLatin1(PQresultErrorField(result, PG_DIAG_SQLSTATE));
+ msg += QString::fromLatin1("(%1)").arg(errorCode);
}
return QSqlError(QLatin1String("QPSQL: ") + err, msg, type, errorCode);
}
@@ -436,7 +437,7 @@ void QPSQLResultPrivate::deallocatePreparedStmt()
preparedStmtId.clear();
}
-QPSQLResult::QPSQLResult(const QPSQLDriver* db)
+QPSQLResult::QPSQLResult(const QPSQLDriver *db)
: QSqlResult(*new QPSQLResultPrivate(this, db))
{
Q_D(QPSQLResult);
@@ -663,27 +664,30 @@ QVariant QPSQLResult::data(int i)
return atoi(val);
case QVariant::Double: {
if (ptype == QNUMERICOID) {
- if (numericalPrecisionPolicy() != QSql::HighPrecision) {
- QVariant retval;
- bool convert;
- double dbl=QString::fromLatin1(val).toDouble(&convert);
- if (numericalPrecisionPolicy() == QSql::LowPrecisionInt64)
- retval = (qlonglong)dbl;
- else if (numericalPrecisionPolicy() == QSql::LowPrecisionInt32)
- retval = (int)dbl;
- else if (numericalPrecisionPolicy() == QSql::LowPrecisionDouble)
- retval = dbl;
- if (!convert)
- return QVariant();
- return retval;
- }
- return QString::fromLatin1(val);
+ if (numericalPrecisionPolicy() == QSql::HighPrecision)
+ return QString::fromLatin1(val);
+ }
+ bool ok;
+ double dbl = qstrtod(val, nullptr, &ok);
+ if (!ok) {
+ if (qstricmp(val, "NaN") == 0)
+ dbl = qQNaN();
+ else if (qstricmp(val, "Infinity") == 0)
+ dbl = qInf();
+ else if (qstricmp(val, "-Infinity") == 0)
+ dbl = -qInf();
+ else
+ return QVariant();
}
- if (qstricmp(val, "Infinity") == 0)
- return qInf();
- if (qstricmp(val, "-Infinity") == 0)
- return -qInf();
- return QString::fromLatin1(val).toDouble();
+ if (ptype == QNUMERICOID) {
+ if (numericalPrecisionPolicy() == QSql::LowPrecisionInt64)
+ return QVariant((qlonglong)dbl);
+ else if (numericalPrecisionPolicy() == QSql::LowPrecisionInt32)
+ return QVariant((int)dbl);
+ else if (numericalPrecisionPolicy() == QSql::LowPrecisionDouble)
+ return QVariant(dbl);
+ }
+ return dbl;
}
case QVariant::Date:
if (val[0] == '\0') {
@@ -711,7 +715,7 @@ QVariant QPSQLResult::data(int i)
#if QT_CONFIG(datestring)
if (dtval.length() < 10) {
return QVariant(QDateTime());
- } else {
+ } else {
QChar sign = dtval[dtval.size() - 3];
if (sign == QLatin1Char('-') || sign == QLatin1Char('+')) dtval += QLatin1String(":00");
return QVariant(QDateTime::fromString(dtval, Qt::ISODate).toLocalTime());
@@ -741,7 +745,7 @@ bool QPSQLResult::isNull(int field)
return PQgetisnull(d->result, currentRow, field);
}
-bool QPSQLResult::reset (const QString& query)
+bool QPSQLResult::reset(const QString &query)
{
Q_D(QPSQLResult);
cleanup();
@@ -868,7 +872,6 @@ QSqlRecord QPSQLResult::record() const
void QPSQLResult::virtual_hook(int id, void *data)
{
Q_ASSERT(data);
-
QSqlResult::virtual_hook(id, data);
}
@@ -966,7 +969,7 @@ bool QPSQLResult::exec()
bool QPSQLDriverPrivate::setEncodingUtf8()
{
- PGresult* result = exec("SET CLIENT_ENCODING TO 'UNICODE'");
+ PGresult *result = exec("SET CLIENT_ENCODING TO 'UNICODE'");
int status = PQresultStatus(result);
PQclear(result);
return status == PGRES_COMMAND_OK;
@@ -974,7 +977,7 @@ bool QPSQLDriverPrivate::setEncodingUtf8()
void QPSQLDriverPrivate::setDatestyle()
{
- PGresult* result = exec("SET DATESTYLE TO 'ISO'");
+ PGresult *result = exec("SET DATESTYLE TO 'ISO'");
int status = PQresultStatus(result);
if (status != PGRES_COMMAND_OK)
qWarning("%s", PQerrorMessage(connection));
@@ -1003,7 +1006,7 @@ void QPSQLDriverPrivate::detectBackslashEscape()
hasBackslashEscape = true;
} else {
hasBackslashEscape = false;
- PGresult* result = exec(QStringLiteral("SELECT '\\\\' x"));
+ PGresult *result = exec(QStringLiteral("SELECT '\\\\' x"));
int status = PQresultStatus(result);
if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK)
if (QString::fromLatin1(PQgetvalue(result, 0, 0)) == QLatin1String("\\"))
@@ -1106,7 +1109,7 @@ static QPSQLDriver::Protocol qFindPSQLVersion(const QString &versionString)
QPSQLDriver::Protocol QPSQLDriverPrivate::getPSQLVersion()
{
QPSQLDriver::Protocol serverVersion = QPSQLDriver::Version6;
- PGresult* result = exec("SELECT version()");
+ PGresult *result = exec("SELECT version()");
int status = PQresultStatus(result);
if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) {
serverVersion = qFindPSQLVersion(
@@ -1212,12 +1215,12 @@ static QString qQuote(QString s)
return s;
}
-bool QPSQLDriver::open(const QString & db,
- const QString & user,
- const QString & password,
- const QString & host,
- int port,
- const QString& connOpts)
+bool QPSQLDriver::open(const QString &db,
+ const QString &user,
+ const QString &password,
+ const QString &host,
+ int port,
+ const QString &connOpts)
{
Q_D(QPSQLDriver);
if (isOpen())
@@ -1246,7 +1249,7 @@ bool QPSQLDriver::open(const QString & db,
setLastError(qMakeError(tr("Unable to connect"), QSqlError::ConnectionError, d));
setOpenError(true);
PQfinish(d->connection);
- d->connection = 0;
+ d->connection = nullptr;
return false;
}
@@ -1270,12 +1273,12 @@ void QPSQLDriver::close()
if (d->sn) {
disconnect(d->sn, SIGNAL(activated(int)), this, SLOT(_q_handleNotification(int)));
delete d->sn;
- d->sn = 0;
+ d->sn = nullptr;
}
if (d->connection)
PQfinish(d->connection);
- d->connection = 0;
+ d->connection = nullptr;
setOpen(false);
setOpenError(false);
}
@@ -1293,7 +1296,7 @@ bool QPSQLDriver::beginTransaction()
qWarning("QPSQLDriver::beginTransaction: Database not open");
return false;
}
- PGresult* res = d->exec("BEGIN");
+ PGresult *res = d->exec("BEGIN");
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
setLastError(qMakeError(tr("Could not begin transaction"),
QSqlError::TransactionError, d, res));
@@ -1311,7 +1314,7 @@ bool QPSQLDriver::commitTransaction()
qWarning("QPSQLDriver::commitTransaction: Database not open");
return false;
}
- PGresult* res = d->exec("COMMIT");
+ PGresult *res = d->exec("COMMIT");
bool transaction_failed = false;
@@ -1340,7 +1343,7 @@ bool QPSQLDriver::rollbackTransaction()
qWarning("QPSQLDriver::rollbackTransaction: Database not open");
return false;
}
- PGresult* res = d->exec("ROLLBACK");
+ PGresult *res = d->exec("ROLLBACK");
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
setLastError(qMakeError(tr("Could not rollback transaction"),
QSqlError::TransactionError, d, res));
@@ -1383,7 +1386,7 @@ static void qSplitTableName(QString &tablename, QString &schema)
tablename = tablename.mid(dot + 1);
}
-QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
+QSqlIndex QPSQLDriver::primaryIndex(const QString &tablename) const
{
QSqlIndex idx(tablename);
if (!isOpen())
@@ -1420,7 +1423,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
return idx;
}
-QSqlRecord QPSQLDriver::record(const QString& tablename) const
+QSqlRecord QPSQLDriver::record(const QString &tablename) const
{
QSqlRecord info;
if (!isOpen())
@@ -1571,7 +1574,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
QString QPSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType) const
{
QString res = identifier;
- if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) {
+ if (!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) {
res.replace(QLatin1Char('"'), QLatin1String("\"\""));
res.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
res.replace(QLatin1Char('.'), QLatin1String("\".\""));
@@ -1660,7 +1663,7 @@ bool QPSQLDriver::unsubscribeFromNotification(const QString &name)
if (d->seid.isEmpty()) {
disconnect(d->sn, SIGNAL(activated(int)), this, SLOT(_q_handleNotification(int)));
delete d->sn;
- d->sn = 0;
+ d->sn = nullptr;
}
return true;
@@ -1678,8 +1681,8 @@ void QPSQLDriver::_q_handleNotification(int)
d->pendingNotifyCheck = false;
PQconsumeInput(d->connection);
- PGnotify *notify = 0;
- while((notify = PQnotifies(d->connection)) != 0) {
+ PGnotify *notify = nullptr;
+ while ((notify = PQnotifies(d->connection)) != nullptr) {
QString name(QLatin1String(notify->relname));
if (d->seid.contains(name)) {
QString payload;
diff --git a/src/plugins/sqldrivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h
index 4f372346c6..99e0b5f60f 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql_p.h
+++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h
@@ -100,18 +100,18 @@ public:
explicit QPSQLDriver(PGconn *conn, QObject *parent = nullptr);
~QPSQLDriver();
bool hasFeature(DriverFeature f) const override;
- bool open(const QString & db,
- const QString & user,
- const QString & password,
- const QString & host,
+ bool open(const QString &db,
+ const QString &user,
+ const QString &password,
+ const QString &host,
int port,
- const QString& connOpts) override;
+ const QString &connOpts) override;
bool isOpen() const override;
void close() override;
QSqlResult *createResult() const override;
QStringList tables(QSql::TableType) const override;
- QSqlIndex primaryIndex(const QString& tablename) const override;
- QSqlRecord record(const QString& tablename) const override;
+ QSqlIndex primaryIndex(const QString &tablename) const override;
+ QSqlRecord record(const QString &tablename) const override;
Protocol protocol() const;
QVariant handle() const override;
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 45d987aa91..5692a16bce 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -246,6 +246,13 @@ void QDialogPrivate::deletePlatformHelper()
window-system properties for the widget (in particular it will
reset the Qt::Dialog flag).
+ \note The parent relationship of the dialog does \e{not} imply
+ that the dialog will always be stacked on top of the parent
+ window. To ensure that the dialog is always on top, make the
+ dialog modal. This also applies for child windows of the dialog
+ itself. To ensure that child windows of the dialog stay on top
+ of the dialog, make the child windows modal as well.
+
\section1 Modal Dialogs
A \b{modal} dialog is a dialog that blocks input to other
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index c517198a23..8bdce4af8b 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -5552,8 +5552,8 @@ bool QGraphicsScene::focusNextPrevChild(bool next)
is a pointer to the item that gained input focus, or \nullptr if focus was lost.
\a reason is the reason for the focus change (e.g., if the scene was
deactivated while an input field had focus, \a oldFocusItem would point
- to the input field item, \a newFocusItem would be 0, and \a reason would be
- Qt::ActiveWindowFocusReason.
+ to the input field item, \a newFocusItem would be \nullptr, and \a reason
+ would be Qt::ActiveWindowFocusReason.
*/
/*!
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index cf0f3f153b..f81cb471fa 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -482,8 +482,8 @@ bool QTipLabel::tipChanged(const QPoint &pos, const QString &text, QObject *o)
The \a rect is in the coordinates of the widget you specify with
\a w. If the \a rect is not empty you must specify a widget.
- Otherwise this argument can be 0 but it is used to determine the
- appropriate screen on multi-head systems.
+ Otherwise this argument can be \nullptr but it is used to
+ determine the appropriate screen on multi-head systems.
If \a text is empty the tool tip is hidden. If the text is the
same as the currently shown tooltip, the tip will \e not move.
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 51b2bf8b5f..de79fd4154 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1009,8 +1009,8 @@ struct QWidgetExceptionCleaner
deleted.
The widget flags argument, \a f, is normally 0, but it can be set
- to customize the frame of a window (i.e. \a
- parent must be 0). To customize the frame, use a value composed
+ to customize the frame of a window (i.e. \a parent must be
+ \nullptr). To customize the frame, use a value composed
from the bitwise OR of any of the \l{Qt::WindowFlags}{window flags}.
If you add a child widget to an already visible widget you must
@@ -4227,7 +4227,7 @@ void QWidget::setFixedHeight(int h)
/*!
Translates the widget coordinate \a pos to the coordinate system
- of \a parent. The \a parent must not be 0 and must be a parent
+ of \a parent. The \a parent must not be \nullptr and must be a parent
of the calling widget.
\sa mapFrom(), mapToParent(), mapToGlobal(), underMouse()
@@ -4252,7 +4252,7 @@ QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const
/*!
Translates the widget coordinate \a pos from the coordinate system
of \a parent to this widget's coordinate system. The \a parent
- must not be 0 and must be a parent of the calling widget.
+ must not be \nullptr and must be a parent of the calling widget.
\sa mapTo(), mapFromParent(), mapFromGlobal(), underMouse()
*/
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index b064b2eff2..a3461d8848 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -846,11 +846,14 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
}
#endif // QT_CONFIG(toolbutton)
-static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
+static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth, int maxHeight = -1, int *lastVisibleLine = nullptr)
{
+ if (lastVisibleLine)
+ *lastVisibleLine = -1;
qreal height = 0;
qreal widthUsed = 0;
textLayout.beginLayout();
+ int i = 0;
while (true) {
QTextLine line = textLayout.createLine();
if (!line.isValid())
@@ -859,6 +862,13 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
line.setPosition(QPointF(0, height));
height += line.height();
widthUsed = qMax(widthUsed, line.naturalTextWidth());
+ // we assume that the height of the next line is the same as the current one
+ if (maxHeight > 0 && lastVisibleLine && height + line.height() > maxHeight) {
+ const QTextLine nextLine = textLayout.createLine();
+ *lastVisibleLine = nextLine.isValid() ? i : -1;
+ break;
+ }
+ ++i;
}
textLayout.endLayout();
return QSizeF(widthUsed, height);
@@ -872,7 +882,13 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex
QTextLayout textLayout(text, font);
textLayout.setTextOption(textOption);
- viewItemTextLayout(textLayout, textRect.width());
+ // In AlignVCenter mode when more than one line is displayed and the height only allows
+ // some of the lines it makes no sense to display those. From a users perspective it makes
+ // more sense to see the start of the text instead something inbetween.
+ const bool vAlignmentOptimization = paintStartPosition && valign.testFlag(Qt::AlignVCenter);
+
+ int lastVisibleLine = -1;
+ viewItemTextLayout(textLayout, textRect.width(), vAlignmentOptimization ? textRect.height() : -1, &lastVisibleLine);
const QRectF boundingRect = textLayout.boundingRect();
// don't care about LTR/RTL here, only need the height
@@ -899,7 +915,7 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex
const int start = line.textStart();
const int length = line.textLength();
const bool drawElided = line.naturalTextWidth() > textRect.width();
- bool elideLastVisibleLine = false;
+ bool elideLastVisibleLine = lastVisibleLine == i;
if (!drawElided && i + 1 < lineCount && lastVisibleLineShouldBeElided) {
const QTextLine nextLine = textLayout.lineAt(i + 1);
const int nextHeight = height + nextLine.height() / 2;
@@ -930,7 +946,8 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex
}
// below visible text, can stop
- if (height + layoutRect.top() >= textRect.bottom())
+ if ((height + layoutRect.top() >= textRect.bottom()) ||
+ (lastVisibleLine >= 0 && lastVisibleLine == i))
break;
}
return ret;
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index da4c2f98cf..54caa26fb6 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -688,7 +688,7 @@ QLineEdit *QAbstractSpinBox::lineEdit() const
\fn void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit)
Sets the line edit of the spinbox to be \a lineEdit instead of the
- current line edit widget. \a lineEdit cannot be 0.
+ current line edit widget. \a lineEdit cannot be \nullptr.
QAbstractSpinBox takes ownership of the new lineEdit
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 7e29a417ea..932affde07 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2046,7 +2046,7 @@ QAbstractItemModel *QComboBox::model() const
}
/*!
- Sets the model to be \a model. \a model must not be 0.
+ Sets the model to be \a model. \a model must not be \nullptr.
If you want to clear the contents of a model, call clear().
\sa clear()