Merge "Merge remote-tracking branch 'origin/5.13' into dev" into refs/staging/dev

This commit is contained in:
Liang Qi 2019-03-15 19:04:30 +00:00 committed by The Qt Project
commit 8cc8eb8f24
36 changed files with 221 additions and 158 deletions

View File

@ -1,5 +1,4 @@
pre, .LegaleseLeft {
background-color: #f0f0f0;
font-family: Courier, monospace;
font-weight: 600;
vertical-align: top;
@ -40,7 +39,6 @@ h1.title {
}
h2, p.h2 {
background-color: #F2F3F4;
padding: 4px;
margin: 30px 0px 20px 10px;
}
@ -67,10 +65,6 @@ ul li, ol li {
}
h3.fn, span.fn {
border-width: 3px;
border-style: solid;
border-color: #aaaaaa;
background-color: #eeeeee;
word-spacing: 3px;
padding: 5px;
text-decoration: none;
@ -94,10 +88,6 @@ table td {
padding: 6px 10px 6px 10px;
}
table tr.odd {
background-color: #eeeeee;
}
table.qmlname td {
padding: 0px;
margin-left: 6px;
@ -144,19 +134,10 @@ span.naviSeparator {
margin: 0;
}
.navigationbar table tr {
background-color: #eeeeee;
}
td#buildversion {
background-color: #ffffff;
}
.footer, .footer p {
padding: 5px 0px 5px 0px;
margin: 45px 15px 5px 15px;
font-size: 8.5pt;
background-color: #cccccc;
}
.footer p {

View File

@ -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.

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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!

View File

@ -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

View File

@ -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

View File

@ -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.
*/

View File

@ -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
*/

View File

@ -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()
*/

View File

@ -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()
*/

View File

@ -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.

View File

@ -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 {

View File

@ -235,6 +235,7 @@ void QNetworkReplyWasmImpl::close()
void QNetworkReplyWasmImpl::abort()
{
Q_D(const QNetworkReplyWasmImpl);
setError( QNetworkReply::OperationCanceledError, "Operation canceled" );
d->doAbort();
close();

View File

@ -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;

View File

@ -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,

View File

@ -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);
}
if (qstricmp(val, "Infinity") == 0)
return qInf();
if (qstricmp(val, "-Infinity") == 0)
return -qInf();
return QString::fromLatin1(val).toDouble();
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 (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;

View File

@ -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;

View File

@ -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

View File

@ -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.
*/
/*!

View File

@ -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.

View File

@ -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()
*/

View File

@ -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;

View File

@ -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

View File

@ -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()

View File

@ -1,2 +1,2 @@
redhatenterpriselinuxworkstation-6.6
rhel-7.4
redhatenterpriselinuxworkstation
rhel

View File

@ -366,7 +366,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun, const Plat
if (!socket.waitForConnected(Timeout)) {
sysSleep(3000); // Wait a bit and try again, the server might just be restarting
if (!socket.waitForConnected(Timeout)) {
errMsg += QLS("TCP connectToHost failed. Host:") + serverName + QLS(" port:") + QString::number(ServerPort);
errMsg += QLS("TCP connectToHost failed. Host:") + QLS(serverName) + QLS(" port:") + QString::number(ServerPort);
return false;
}
}

View File

@ -12,7 +12,9 @@ data which triggered the crash. You can then use this to debug and fix the calle
To run a test with libFuzzer:
1. Install libFuzzer, e.g. from the repositories of the Linux distribution you are using.
1. Install clang 5.0 or later, e.g. from the repositories of the Linux distribution you are using.
Depending on the version of clang and the source you are installing from, you might have to
install libFuzzer for this version of clang explicitly.
2. Make sure clang and clang++ from this version of clang are found in PATH.
3. Configure Qt with
-platform linux-clang -coverage trace-pc-guard

View File

@ -1,5 +1,5 @@
QT -= gui
CONFIG += c++11 console
CONFIG += console
CONFIG -= app_bundle
SOURCES += main.cpp
LIBS += -lFuzzer
LIBS += -fsanitize=fuzzer

View File

@ -1,4 +1,3 @@
QT += widgets
CONFIG += c++11
SOURCES += main.cpp
LIBS += -lFuzzer
LIBS += -fsanitize=fuzzer

View File

@ -44,11 +44,13 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture
switch (event->type()) {
case QEvent::TouchBegin:
result = QGestureRecognizer::MayBeGesture;
break;
case QEvent::TouchEnd:
if (d->gestureFired)
result = QGestureRecognizer::FinishGesture;
else
result = QGestureRecognizer::CancelGesture;
break;
case QEvent::TouchUpdate:
if (d->state() != Qt::NoGesture) {
QTouchEvent *ev = static_cast<QTouchEvent*>(event);

View File

@ -224,7 +224,7 @@ void Widget::updateUngroupButton()
CustomItem * Widget::checkedItem() const
{
CustomItem *item;
CustomItem *item = nullptr;
if (ui->blue->isChecked())
item = rectBlue;

View File

@ -57,6 +57,11 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v)
CASE_VERSION(WV_WINDOWS8_1);
CASE_VERSION(WV_WINDOWS10);
case QSysInfo::WV_NT_based: // shouldn't happen
case QSysInfo::WV_CE:
case QSysInfo::WV_CENET:
case QSysInfo::WV_CE_5:
case QSysInfo::WV_CE_6:
case QSysInfo::WV_CE_based:
break;
}
@ -82,6 +87,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_10_9);
CASE_VERSION(MV_10_10);
CASE_VERSION(MV_10_11);
CASE_VERSION(MV_10_12);
CASE_VERSION(MV_IOS_4_3);
CASE_VERSION(MV_IOS_5_0);
@ -96,8 +102,24 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_IOS_8_3);
CASE_VERSION(MV_IOS_8_4);
CASE_VERSION(MV_IOS_9_0);
CASE_VERSION(MV_IOS_9_1);
CASE_VERSION(MV_IOS_9_2);
CASE_VERSION(MV_IOS_9_3);
CASE_VERSION(MV_IOS_10_0);
case QSysInfo::MV_IOS: // shouldn't happen:
case QSysInfo::MV_TVOS:
case QSysInfo::MV_WATCHOS:
break;
CASE_VERSION(MV_TVOS_9_0);
CASE_VERSION(MV_TVOS_9_1);
CASE_VERSION(MV_TVOS_9_2);
CASE_VERSION(MV_TVOS_10_0);
CASE_VERSION(MV_WATCHOS_2_0);
CASE_VERSION(MV_WATCHOS_2_1);
CASE_VERSION(MV_WATCHOS_2_2);
CASE_VERSION(MV_WATCHOS_3_0);
}
if (v & QSysInfo::MV_IOS) {

View File

@ -284,7 +284,7 @@ int main(int argc, char *argv[])
mainWindow.setWindowTitle(QString::fromLatin1("Tablet Test %1").arg(QT_VERSION_STR));
EventReportWidget *widget = new EventReportWidget;
QObject::connect(proximityEventFilter, &ProximityEventFilter::proximityChanged,
widget, QOverload<void>::of(&QWidget::update));
widget, QOverload<>::of(&QWidget::update));
widget->setMinimumSize(640, 480);
QMenu *fileMenu = mainWindow.menuBar()->addMenu("File");
fileMenu->addAction("Clear", widget, &EventReportWidget::clearPoints);

View File

@ -0,0 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = bigmenucreator \
defaultUpMenuBar \
multiscreen-menus \
qtoolbutton/menuOnMultiScreens