Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"

This commit is contained in:
Liang Qi 2020-02-18 09:26:53 +01:00
commit fd49b4a2b9
38 changed files with 410 additions and 65 deletions

View File

@ -165,8 +165,6 @@ Build options:
-reduce-exports ...... Reduce amount of exported symbols [auto] -reduce-exports ...... Reduce amount of exported symbols [auto]
-reduce-relocations .. Reduce amount of relocations [auto] (Unix only) -reduce-relocations .. Reduce amount of relocations [auto] (Unix only)
-relocatable ......... Enable the Qt installation to be relocated [auto]
-plugin-manifests .... Embed manifests into plugins [no] (Windows only) -plugin-manifests .... Embed manifests into plugins [no] (Windows only)
-static-runtime ...... With -static, use static runtime [no] (Windows only) -static-runtime ...... With -static, use static runtime [no] (Windows only)

View File

@ -1408,6 +1408,7 @@
}, },
"relocatable": { "relocatable": {
"label": "Relocatable", "label": "Relocatable",
"purpose": "Enable the Qt installation to be relocated.",
"autoDetect": "features.shared", "autoDetect": "features.shared",
"condition": "features.dlopen || config.win32 || !features.shared", "condition": "features.dlopen || config.win32 || !features.shared",
"output": [ "privateFeature" ] "output": [ "privateFeature" ]

View File

@ -246,11 +246,7 @@
\section1 Other Code Editor Features \section1 Other Code Editor Features
It is possible to implement parenthesis matching with The \l{Code Editor Example} shows how to implement line
QSyntaxHighlighter. The "Matching Parentheses with
QSyntaxHighlighter" article in Qt Quarterly 31
(\l{http://doc.qt.io/archives/qq/}) implements this. We also have
the \l{Code Editor Example}, which shows how to implement line
numbers and how to highlight the current line. numbers and how to highlight the current line.
*/ */

View File

@ -3,7 +3,9 @@ defineReplace(qtEmccRecommendedVersion) {
} }
defineReplace(qtSystemEmccVersion) { defineReplace(qtSystemEmccVersion) {
E_VERSION = $$system("emcc -v 2>&1 | perl -alne $$shell_quote($_ = $F[9]; s/://; print;) ") EMCC = $$system("emcc -v 2>&1", lines)
EMCC_LINE = $$find(EMCC, "^.*\b(emcc)\b.*$")
E_VERSION = $$section(EMCC_LINE, " ", 9,9)
return ($${E_VERSION}) return ($${E_VERSION})
} }

View File

@ -960,6 +960,10 @@
default is used. default is used.
\row \li thread \li Thread support is enabled. This is enabled when CONFIG \row \li thread \li Thread support is enabled. This is enabled when CONFIG
includes \c qt, which is the default. includes \c qt, which is the default.
\row \li utf8_source \li Specifies that the project's source files use the
UTF-8 encoding. By default, the compiler default is used.
\row \li hide_symbols \li Set the default visibility of symbols in the binary
to hidden. By default, the compiler default is used.
\row \li c99 \li C99 support is enabled. This option has no effect if \row \li c99 \li C99 support is enabled. This option has no effect if
the compiler does not support C99, or can't select the C standard. the compiler does not support C99, or can't select the C standard.
By default, the compiler default is used. By default, the compiler default is used.

View File

@ -558,6 +558,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") << ' ' t << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") << ' '
<< incr_deps << " $(SUBLIBS) " << target_deps << ' ' << depVar("POST_TARGETDEPS"); << incr_deps << " $(SUBLIBS) " << target_deps << ' ' << depVar("POST_TARGETDEPS");
} else { } else {
ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD");
cmd[0] = cmd.at(0).toQString().replace(QLatin1String("$(OBJECTS)"), objectParts.second);
t << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") t << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS")
<< " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps << " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps
<< ' ' << depVar("POST_TARGETDEPS"); << ' ' << depVar("POST_TARGETDEPS");

View File

@ -736,6 +736,18 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
if(targetdir.right(1) != Option::dir_sep) if(targetdir.right(1) != Option::dir_sep)
targetdir += Option::dir_sep; targetdir += Option::dir_sep;
const ProStringList &targets = project->values(ProKey(t + ".targets"));
for (int i = 0; i < targets.size(); ++i) {
QString src = targets.at(i).toQString(),
dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1)));
if (!ret.isEmpty())
ret += "\n\t";
ret += "$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst;
if (!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) " + dst);
}
if(t == "target" && project->first("TEMPLATE") == "lib") { if(t == "target" && project->first("TEMPLATE") == "lib") {
if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") && if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") &&
!project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
@ -744,6 +756,8 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
if(slsh != -1) if(slsh != -1)
dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
dst_prl = filePrefixRoot(root, targetdir + dst_prl); dst_prl = filePrefixRoot(root, targetdir + dst_prl);
if (!ret.isEmpty())
ret += "\n\t";
ret += installMetaFile(ProKey("QMAKE_PRL_INSTALL_REPLACE"), project->first("QMAKE_INTERNAL_PRL_FILE").toQString(), dst_prl); ret += installMetaFile(ProKey("QMAKE_PRL_INSTALL_REPLACE"), project->first("QMAKE_INTERNAL_PRL_FILE").toQString(), dst_prl);
if(!uninst.isEmpty()) if(!uninst.isEmpty())
uninst.append("\n\t"); uninst.append("\n\t");

View File

@ -930,6 +930,7 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
tuple[num++] = *chars++; tuple[num++] = *chars++;
if (num == 4) { if (num == 4) {
if (!headerdone) { if (!headerdone) {
headerdone = true;
if (endian == DetectEndianness) { if (endian == DetectEndianness) {
if (tuple[0] == 0xff && tuple[1] == 0xfe && tuple[2] == 0 && tuple[3] == 0 && endian != BigEndianness) { if (tuple[0] == 0xff && tuple[1] == 0xfe && tuple[2] == 0 && tuple[3] == 0 && endian != BigEndianness) {
endian = LittleEndianness; endian = LittleEndianness;

View File

@ -4192,7 +4192,7 @@ static bool isIp6(const QString &text)
/*! /*!
Returns a valid URL from a user supplied \a userInput string if one can be Returns a valid URL from a user supplied \a userInput string if one can be
deducted. In the case that is not possible, an invalid QUrl() is returned. deduced. In the case that is not possible, an invalid QUrl() is returned.
This overload takes a \a workingDirectory path, in order to be able to This overload takes a \a workingDirectory path, in order to be able to
handle relative paths. This is especially useful when handling command handle relative paths. This is especially useful when handling command

View File

@ -3055,12 +3055,8 @@ bool QSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &
Returns \c true if the item in the column indicated by the given \a source_column Returns \c true if the item in the column indicated by the given \a source_column
and \a source_parent should be included in the model; otherwise returns \c false. and \a source_parent should be included in the model; otherwise returns \c false.
The default implementation returns \c true if the value held by the relevant item \note The default implementation always returns \c true. You must reimplement this
matches the filter string, wildcard string or regular expression. method to get the described behavior.
\note By default, the Qt::DisplayRole is used to determine if the column
should be accepted or not. This can be changed by setting the \l
filterRole property.
\sa filterAcceptsRow(), setFilterFixedString(), setFilterRegExp(), setFilterWildcard() \sa filterAcceptsRow(), setFilterFixedString(), setFilterRegExp(), setFilterWildcard()
*/ */

View File

@ -72,7 +72,7 @@ HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch)
void (*HB_Library_Resolve(const char *library, int version, const char *symbol))() void (*HB_Library_Resolve(const char *library, int version, const char *symbol))()
{ {
#if !QT_CONFIG(library) #if !QT_CONFIG(library) || defined(Q_OS_WASM)
Q_UNUSED(library); Q_UNUSED(library);
Q_UNUSED(version); Q_UNUSED(version);
Q_UNUSED(symbol); Q_UNUSED(symbol);

View File

@ -1124,7 +1124,7 @@ int QStringView::toWCharArray(wchar_t *array) const
if (sizeof(wchar_t) == sizeof(QChar)) { if (sizeof(wchar_t) == sizeof(QChar)) {
if (auto src = data()) if (auto src = data())
memcpy(array, src, sizeof(QChar) * size()); memcpy(array, src, sizeof(QChar) * size());
return size(); return int(size()); // ### q6sizetype
} else { } else {
return QString::toUcs4_helper(reinterpret_cast<const ushort *>(data()), int(size()), return QString::toUcs4_helper(reinterpret_cast<const ushort *>(data()), int(size()),
reinterpret_cast<uint *>(array)); reinterpret_cast<uint *>(array));

View File

@ -70,14 +70,14 @@ QT_WARNING_DISABLE_DEPRECATED
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
struct QT_DEPRECATED_VERSION_5_15 Q_CORE_EXPORT QLinkedListData struct QT_DEPRECATED_VERSION_5_15 QLinkedListData
{ {
QLinkedListData *n, *p; QLinkedListData *n, *p;
QtPrivate::RefCount ref; QtPrivate::RefCount ref;
int size; int size;
uint sharable : 1; uint sharable : 1;
static const QLinkedListData shared_null; Q_CORE_EXPORT static const QLinkedListData shared_null;
}; };
template <typename T> template <typename T>

View File

@ -610,7 +610,7 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
\li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and \li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and
\c none disables them. \c none disables them.
\li \c {dpiawareness=[0|1|2} Sets the DPI awareness of the process \li \c {dpiawareness=[0|1|2]} Sets the DPI awareness of the process
(see \l{High DPI Displays}, since Qt 5.4). (see \l{High DPI Displays}, since Qt 5.4).
\li \c {fontengine=freetype}, uses the FreeType font engine. \li \c {fontengine=freetype}, uses the FreeType font engine.
\li \c {menus=[native|none]}, controls the use of native menus. \li \c {menus=[native|none]}, controls the use of native menus.

View File

@ -3264,6 +3264,7 @@ const uint qt_inv_premul_factor[256] = {
/*! /*!
\namespace QColorConstants \namespace QColorConstants
\inmodule QtGui \inmodule QtGui
\since 5.14
\brief The QColorConstants namespace contains QColor predefined constants. \brief The QColorConstants namespace contains QColor predefined constants.

View File

@ -44,13 +44,20 @@ QT_BEGIN_NAMESPACE
namespace namespace
{ {
QVector<QShaderNode> copyOutputNodes(const QVector<QShaderNode> &nodes) QVector<QShaderNode> copyOutputNodes(const QVector<QShaderNode> &nodes, const QVector<QShaderGraph::Edge> &edges)
{ {
auto res = QVector<QShaderNode>(); auto res = QVector<QShaderNode>();
std::copy_if(nodes.cbegin(), nodes.cend(), std::copy_if(nodes.cbegin(), nodes.cend(),
std::back_inserter(res), std::back_inserter(res),
[] (const QShaderNode &node) { [&edges] (const QShaderNode &node) {
return node.type() == QShaderNode::Output; return node.type() == QShaderNode::Output ||
(node.type() == QShaderNode::Function &&
!std::any_of(edges.cbegin(),
edges.cend(),
[&node] (const QShaderGraph::Edge &edge) {
return edge.sourceNodeUuid ==
node.uuid();
}));
}); });
return res; return res;
} }
@ -210,8 +217,8 @@ QVector<QShaderGraph::Statement> QShaderGraph::createStatements(const QStringLis
auto result = QVector<Statement>(); auto result = QVector<Statement>();
QVector<Edge> currentEdges = enabledEdges; QVector<Edge> currentEdges = enabledEdges;
QVector<QUuid> currentUuids = [enabledNodes] { QVector<QUuid> currentUuids = [enabledNodes, enabledEdges] {
const QVector<QShaderNode> inputs = copyOutputNodes(enabledNodes); const QVector<QShaderNode> inputs = copyOutputNodes(enabledNodes, enabledEdges);
auto res = QVector<QUuid>(); auto res = QVector<QUuid>();
std::transform(inputs.cbegin(), inputs.cend(), std::transform(inputs.cbegin(), inputs.cend(),
std::back_inserter(res), std::back_inserter(res),

View File

@ -1099,6 +1099,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
if (reply) { if (reply) {
reply->d_func()->errorString = errorString; reply->d_func()->errorString = errorString;
reply->d_func()->httpErrorCode = errorCode;
emit reply->finishedWithError(errorCode, errorString); emit reply->finishedWithError(errorCode, errorString);
reply = nullptr; reply = nullptr;
if (protocolHandler) if (protocolHandler)

View File

@ -158,6 +158,11 @@ QString QHttpNetworkReply::errorString() const
return d_func()->errorString; return d_func()->errorString;
} }
QNetworkReply::NetworkError QHttpNetworkReply::errorCode() const
{
return d_func()->httpErrorCode;
}
QString QHttpNetworkReply::reasonPhrase() const QString QHttpNetworkReply::reasonPhrase() const
{ {
return d_func()->reasonPhrase; return d_func()->reasonPhrase;

View File

@ -115,6 +115,8 @@ public:
QString errorString() const; QString errorString() const;
void setErrorString(const QString &error); void setErrorString(const QString &error);
QNetworkReply::NetworkError errorCode() const;
QString reasonPhrase() const; QString reasonPhrase() const;
qint64 bytesAvailable() const; qint64 bytesAvailable() const;
@ -259,6 +261,7 @@ public:
qint64 removedContentLength; qint64 removedContentLength;
QPointer<QHttpNetworkConnection> connection; QPointer<QHttpNetworkConnection> connection;
QPointer<QHttpNetworkConnectionChannel> connectionChannel; QPointer<QHttpNetworkConnectionChannel> connectionChannel;
QNetworkReply::NetworkError httpErrorCode = QNetworkReply::NoError;
bool autoDecompress; bool autoDecompress;

View File

@ -428,6 +428,12 @@ void QHttpThreadDelegate::startRequest()
connect(httpReply, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)), connect(httpReply, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)),
this, SLOT(cacheCredentialsSlot(QHttpNetworkRequest,QAuthenticator*))); this, SLOT(cacheCredentialsSlot(QHttpNetworkRequest,QAuthenticator*)));
if (httpReply->errorCode() != QNetworkReply::NoError) {
if (synchronous)
synchronousFinishedWithErrorSlot(httpReply->errorCode(), httpReply->errorString());
else
finishedWithErrorSlot(httpReply->errorCode(), httpReply->errorString());
}
} }
// This gets called from the user thread or by the synchronous HTTP timeout timer // This gets called from the user thread or by the synchronous HTTP timeout timer

View File

@ -1477,7 +1477,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
// immediately set 'networkAccessible' even before we start // immediately set 'networkAccessible' even before we start
// the monitor. // the monitor.
#ifdef QT_NO_BEARERMANAGEMENT #ifdef QT_NO_BEARERMANAGEMENT
if (d->networkAccessible if (!d->networkAccessible
#else #else
if (d->networkAccessible == NotAccessible if (d->networkAccessible == NotAccessible
#endif // QT_NO_BEARERMANAGEMENT #endif // QT_NO_BEARERMANAGEMENT

View File

@ -163,11 +163,14 @@ private:
ComPtr<QNetworkConnectionEvents> connectionEvents; ComPtr<QNetworkConnectionEvents> connectionEvents;
// We can assume we have access to internet/subnet when this class is created because // We can assume we have access to internet/subnet when this class is created because
// connection has already been established to the peer: // connection has already been established to the peer:
NLM_CONNECTIVITY connectivity = NLM_CONNECTIVITY connectivity = NLM_CONNECTIVITY(
NLM_CONNECTIVITY(NLM_CONNECTIVITY_IPV4_INTERNET | NLM_CONNECTIVITY_IPV6_INTERNET NLM_CONNECTIVITY_IPV4_INTERNET | NLM_CONNECTIVITY_IPV6_INTERNET
| NLM_CONNECTIVITY_IPV4_SUBNET | NLM_CONNECTIVITY_IPV6_SUBNET); | NLM_CONNECTIVITY_IPV4_SUBNET | NLM_CONNECTIVITY_IPV6_SUBNET
| NLM_CONNECTIVITY_IPV4_LOCALNETWORK | NLM_CONNECTIVITY_IPV6_LOCALNETWORK
| NLM_CONNECTIVITY_IPV4_NOTRAFFIC | NLM_CONNECTIVITY_IPV6_NOTRAFFIC);
bool sameSubnet = false; bool sameSubnet = false;
bool isLinkLocal = false;
bool monitoring = false; bool monitoring = false;
bool comInitFailed = false; bool comInitFailed = false;
bool remoteIsIPv6 = false; bool remoteIsIPv6 = false;
@ -370,6 +373,7 @@ bool QNetworkConnectionMonitorPrivate::setTargets(const QHostAddress &local,
return false; return false;
} }
sameSubnet = remote.isInSubnet(local, it->prefixLength()); sameSubnet = remote.isInSubnet(local, it->prefixLength());
isLinkLocal = remote.isLinkLocal() && local.isLinkLocal();
remoteIsIPv6 = remote.protocol() == QAbstractSocket::IPv6Protocol; remoteIsIPv6 = remote.protocol() == QAbstractSocket::IPv6Protocol;
return connectionEvents->setTarget(iface); return connectionEvents->setTarget(iface);
@ -461,9 +465,28 @@ void QNetworkConnectionMonitor::stopMonitoring()
bool QNetworkConnectionMonitor::isReachable() bool QNetworkConnectionMonitor::isReachable()
{ {
Q_D(QNetworkConnectionMonitor); Q_D(QNetworkConnectionMonitor);
NLM_CONNECTIVITY required = d->sameSubnet
? (d->remoteIsIPv6 ? NLM_CONNECTIVITY_IPV6_SUBNET : NLM_CONNECTIVITY_IPV4_SUBNET) const NLM_CONNECTIVITY RequiredSameSubnetIPv6 =
: (d->remoteIsIPv6 ? NLM_CONNECTIVITY_IPV6_INTERNET : NLM_CONNECTIVITY_IPV4_INTERNET); NLM_CONNECTIVITY(NLM_CONNECTIVITY_IPV6_SUBNET | NLM_CONNECTIVITY_IPV6_LOCALNETWORK
| NLM_CONNECTIVITY_IPV6_INTERNET);
const NLM_CONNECTIVITY RequiredSameSubnetIPv4 =
NLM_CONNECTIVITY(NLM_CONNECTIVITY_IPV4_SUBNET | NLM_CONNECTIVITY_IPV4_LOCALNETWORK
| NLM_CONNECTIVITY_IPV4_INTERNET);
NLM_CONNECTIVITY required;
if (d->isLinkLocal) {
required = NLM_CONNECTIVITY(
d->remoteIsIPv6 ? NLM_CONNECTIVITY_IPV6_NOTRAFFIC | RequiredSameSubnetIPv6
: NLM_CONNECTIVITY_IPV4_NOTRAFFIC | RequiredSameSubnetIPv4);
} else if (d->sameSubnet) {
required =
NLM_CONNECTIVITY(d->remoteIsIPv6 ? RequiredSameSubnetIPv6 : RequiredSameSubnetIPv4);
} else {
required = NLM_CONNECTIVITY(d->remoteIsIPv6 ? NLM_CONNECTIVITY_IPV6_INTERNET
: NLM_CONNECTIVITY_IPV4_INTERNET);
}
return d_func()->connectivity & required; return d_func()->connectivity & required;
} }
@ -695,7 +718,8 @@ bool QNetworkStatusMonitor::isNetworkAccessible()
{ {
return d_func()->connectivity return d_func()->connectivity
& (NLM_CONNECTIVITY_IPV4_INTERNET | NLM_CONNECTIVITY_IPV6_INTERNET & (NLM_CONNECTIVITY_IPV4_INTERNET | NLM_CONNECTIVITY_IPV6_INTERNET
| NLM_CONNECTIVITY_IPV4_SUBNET | NLM_CONNECTIVITY_IPV6_SUBNET); | NLM_CONNECTIVITY_IPV4_SUBNET | NLM_CONNECTIVITY_IPV6_SUBNET
| NLM_CONNECTIVITY_IPV4_LOCALNETWORK | NLM_CONNECTIVITY_IPV6_LOCALNETWORK);
} }
bool QNetworkStatusMonitor::isEnabled() bool QNetworkStatusMonitor::isEnabled()

View File

@ -590,7 +590,8 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
// local address of the socket which bound on both IPv4 and IPv6 interfaces. // local address of the socket which bound on both IPv4 and IPv6 interfaces.
// This address does not match to any special address and should not be used // This address does not match to any special address and should not be used
// to send the data. So, replace it with QHostAddress::Any. // to send the data. So, replace it with QHostAddress::Any.
if (socketProtocol == QAbstractSocket::IPv6Protocol) { const uchar ipv6MappedNet[] = {0,0,0,0, 0,0,0,0, 0,0,0xff,0xff, 0,0,0,0};
if (localAddress.isInSubnet(QHostAddress(ipv6MappedNet), 128 - 32)) {
bool ok = false; bool ok = false;
const quint32 localIPv4 = localAddress.toIPv4Address(&ok); const quint32 localIPv4 = localAddress.toIPv4Address(&ok);
if (ok && localIPv4 == INADDR_ANY) { if (ok && localIPv4 == INADDR_ANY) {

View File

@ -383,4 +383,21 @@ __CRT_UUID_DECL(IWindowProvider, 0x987df77b, 0xdb06, 0x4d77, 0x8f,0x8a, 0x86,0xa
#endif #endif
#endif #endif
#ifndef __IExpandCollapseProvider_INTERFACE_DEFINED__
#define __IExpandCollapseProvider_INTERFACE_DEFINED__
DEFINE_GUID(IID_IExpandCollapseProvider, 0xd847d3a5, 0xcab0, 0x4a98, 0x8c,0x32, 0xec,0xb4,0x5c,0x59,0xad,0x24);
MIDL_INTERFACE("d847d3a5-cab0-4a98-8c32-ecb45c59ad24")
IExpandCollapseProvider : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Expand() = 0;
virtual HRESULT STDMETHODCALLTYPE Collapse() = 0;
virtual HRESULT STDMETHODCALLTYPE get_ExpandCollapseState(__RPC__out enum ExpandCollapseState *pRetVal) = 0;
};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IExpandCollapseProvider, 0xd847d3a5, 0xcab0, 0x4a98, 0x8c,0x32, 0xec,0xb4,0x5c,0x59,0xad,0x24)
#endif
#endif
#endif #endif

View File

@ -155,6 +155,13 @@ enum WindowInteractionState {
WindowInteractionState_NotResponding = 4 WindowInteractionState_NotResponding = 4
}; };
enum ExpandCollapseState {
ExpandCollapseState_Collapsed = 0,
ExpandCollapseState_Expanded = 1,
ExpandCollapseState_PartiallyExpanded = 2,
ExpandCollapseState_LeafNode = 3
};
struct UiaRect { struct UiaRect {
double left; double left;
double top; double top;

View File

@ -574,7 +574,8 @@ void QCALayerBackingStore::flush(QWindow *flushedWindow, const QRegion &region,
qCInfo(lcQpaBackingStore) << "Flushing" << subImage qCInfo(lcQpaBackingStore) << "Flushing" << subImage
<< "to" << flushedView.layer << "of subview" << flushedView; << "to" << flushedView.layer << "of subview" << flushedView;
QCFType<CGImageRef> cgImage = subImage.toCGImage(); QCFType<CGImageRef> cgImage = CGImageCreateCopyWithColorSpace(
QCFType<CGImageRef>(subImage.toCGImage()), colorSpace());
flushedView.layer.contents = (__bridge id)static_cast<CGImageRef>(cgImage); flushedView.layer.contents = (__bridge id)static_cast<CGImageRef>(cgImage);
} }

View File

@ -0,0 +1,120 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui/qtguiglobal.h>
#if QT_CONFIG(accessibility)
#include "qwindowsuiaexpandcollapseprovider.h"
#include "qwindowsuiautils.h"
#include "qwindowscontext.h"
#include <QtGui/qaccessible.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
using namespace QWindowsUiAutomation;
QWindowsUiaExpandCollapseProvider::QWindowsUiaExpandCollapseProvider(QAccessible::Id id) :
QWindowsUiaBaseProvider(id)
{
}
QWindowsUiaExpandCollapseProvider::~QWindowsUiaExpandCollapseProvider() = default;
HRESULT STDMETHODCALLTYPE QWindowsUiaExpandCollapseProvider::Expand()
{
qCDebug(lcQpaUiAutomation) << __FUNCTION__;
QAccessibleInterface *accessible = accessibleInterface();
if (!accessible)
return UIA_E_ELEMENTNOTAVAILABLE;
QAccessibleActionInterface *actionInterface = accessible->actionInterface();
if (!actionInterface)
return UIA_E_ELEMENTNOTAVAILABLE;
if (accessible->childCount() > 0 && accessible->child(0)->state().invisible)
actionInterface->doAction(QAccessibleActionInterface::showMenuAction());
return S_OK;
}
HRESULT STDMETHODCALLTYPE QWindowsUiaExpandCollapseProvider::Collapse()
{
qCDebug(lcQpaUiAutomation) << __FUNCTION__;
QAccessibleInterface *accessible = accessibleInterface();
if (!accessible)
return UIA_E_ELEMENTNOTAVAILABLE;
QAccessibleActionInterface *actionInterface = accessible->actionInterface();
if (!actionInterface)
return UIA_E_ELEMENTNOTAVAILABLE;
if (accessible->childCount() > 0 && !accessible->child(0)->state().invisible)
actionInterface->doAction(QAccessibleActionInterface::showMenuAction());
return S_OK;
}
HRESULT STDMETHODCALLTYPE QWindowsUiaExpandCollapseProvider::get_ExpandCollapseState(__RPC__out ExpandCollapseState *pRetVal)
{
qCDebug(lcQpaUiAutomation) << __FUNCTION__;
if (!pRetVal)
return E_INVALIDARG;
*pRetVal = ExpandCollapseState_LeafNode;
QAccessibleInterface *accessible = accessibleInterface();
if (!accessible)
return UIA_E_ELEMENTNOTAVAILABLE;
if (accessible->childCount() > 0)
*pRetVal = accessible->child(0)->state().invisible ?
ExpandCollapseState_Collapsed : ExpandCollapseState_Expanded;
return S_OK;
}
QT_END_NAMESPACE
#endif // QT_CONFIG(accessibility)

View File

@ -0,0 +1,69 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWINDOWSUIAEXPANDCOLLAPSEPROVIDER_H
#define QWINDOWSUIAEXPANDCOLLAPSEPROVIDER_H
#include <QtGui/qtguiglobal.h>
#if QT_CONFIG(accessibility)
#include "qwindowsuiabaseprovider.h"
QT_BEGIN_NAMESPACE
// Implements the Expand/Collapse control pattern provider. Used for menu items with submenus.
class QWindowsUiaExpandCollapseProvider : public QWindowsUiaBaseProvider,
public QWindowsComBase<IExpandCollapseProvider>
{
Q_DISABLE_COPY_MOVE(QWindowsUiaExpandCollapseProvider)
public:
explicit QWindowsUiaExpandCollapseProvider(QAccessible::Id id);
virtual ~QWindowsUiaExpandCollapseProvider() override;
// IExpandCollapseProvider
HRESULT STDMETHODCALLTYPE Expand() override;
HRESULT STDMETHODCALLTYPE Collapse() override;
HRESULT STDMETHODCALLTYPE get_ExpandCollapseState(__RPC__out ExpandCollapseState *pRetVal) override;
};
QT_END_NAMESPACE
#endif // QT_CONFIG(accessibility)
#endif // QWINDOWSUIAEXPANDCOLLAPSEPROVIDER_H

View File

@ -53,6 +53,7 @@
#include "qwindowsuiagridprovider.h" #include "qwindowsuiagridprovider.h"
#include "qwindowsuiagriditemprovider.h" #include "qwindowsuiagriditemprovider.h"
#include "qwindowsuiawindowprovider.h" #include "qwindowsuiawindowprovider.h"
#include "qwindowsuiaexpandcollapseprovider.h"
#include "qwindowscombase.h" #include "qwindowscombase.h"
#include "qwindowscontext.h" #include "qwindowscontext.h"
#include "qwindowsuiautils.h" #include "qwindowsuiautils.h"
@ -341,6 +342,14 @@ HRESULT QWindowsUiaMainProvider::GetPatternProvider(PATTERNID idPattern, IUnknow
*pRetVal = new QWindowsUiaInvokeProvider(id()); *pRetVal = new QWindowsUiaInvokeProvider(id());
} }
break; break;
case UIA_ExpandCollapsePatternId:
// Menu items with submenus.
if (accessible->role() == QAccessible::MenuItem
&& accessible->childCount() > 0
&& accessible->child(0)->role() == QAccessible::PopupMenu) {
*pRetVal = new QWindowsUiaExpandCollapseProvider(id());
}
break;
default: default:
break; break;
} }

View File

@ -19,6 +19,7 @@ SOURCES += \
$$PWD/qwindowsuiagridprovider.cpp \ $$PWD/qwindowsuiagridprovider.cpp \
$$PWD/qwindowsuiagriditemprovider.cpp \ $$PWD/qwindowsuiagriditemprovider.cpp \
$$PWD/qwindowsuiawindowprovider.cpp \ $$PWD/qwindowsuiawindowprovider.cpp \
$$PWD/qwindowsuiaexpandcollapseprovider.cpp \
$$PWD/qwindowsuiautils.cpp $$PWD/qwindowsuiautils.cpp
HEADERS += \ HEADERS += \
@ -39,6 +40,7 @@ HEADERS += \
$$PWD/qwindowsuiagridprovider.h \ $$PWD/qwindowsuiagridprovider.h \
$$PWD/qwindowsuiagriditemprovider.h \ $$PWD/qwindowsuiagriditemprovider.h \
$$PWD/qwindowsuiawindowprovider.h \ $$PWD/qwindowsuiawindowprovider.h \
$$PWD/qwindowsuiaexpandcollapseprovider.h \
$$PWD/qwindowsuiautils.h $$PWD/qwindowsuiautils.h
mingw: QMAKE_USE *= uuid mingw: QMAKE_USE *= uuid

View File

@ -665,7 +665,9 @@ QImage::Format QXcbScreen::format() const
bool needsRgbSwap; bool needsRgbSwap;
qt_xcb_imageFormatForVisual(connection(), screen()->root_depth, visualForId(screen()->root_visual), &format, &needsRgbSwap); qt_xcb_imageFormatForVisual(connection(), screen()->root_depth, visualForId(screen()->root_visual), &format, &needsRgbSwap);
// We are ignoring needsRgbSwap here and just assumes the backing-store will handle it. // We are ignoring needsRgbSwap here and just assumes the backing-store will handle it.
return format; if (format != QImage::Format_Invalid)
return format;
return QImage::Format_RGB32;
} }
int QXcbScreen::forcedDpi() const int QXcbScreen::forcedDpi() const

View File

@ -705,15 +705,6 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
} }
d->model = (model ? model : QAbstractItemModelPrivate::staticEmptyModel()); d->model = (model ? model : QAbstractItemModelPrivate::staticEmptyModel());
// These asserts do basic sanity checking of the model
Q_ASSERT_X(d->model->index(0,0) == d->model->index(0,0),
"QAbstractItemView::setModel",
"A model should return the exact same index "
"(including its internal id/pointer) when asked for it twice in a row.");
Q_ASSERT_X(!d->model->index(0,0).parent().isValid(),
"QAbstractItemView::setModel",
"The parent of a top level index should be invalid");
if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) { if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
connect(d->model, SIGNAL(destroyed()), connect(d->model, SIGNAL(destroyed()),
this, SLOT(_q_modelDestroyed())); this, SLOT(_q_modelDestroyed()));

View File

@ -4706,6 +4706,12 @@ void tst_QString::fromUcs4()
s = QString::fromUcs4(U"\u221212\U000020AC\U00010000"); s = QString::fromUcs4(U"\u221212\U000020AC\U00010000");
QCOMPARE(s, QString::fromUtf8("\342\210\222" "12" "\342\202\254" "\360\220\200\200")); QCOMPARE(s, QString::fromUtf8("\342\210\222" "12" "\342\202\254" "\360\220\200\200"));
#endif #endif
// QTBUG-62011: don't mistake ZWNBS for BOM
// Start with one BOM, to ensure we use the right endianness:
const uint text[] = { 0xfeff, 97, 0xfeff, 98, 0xfeff, 99, 0xfeff, 100 };
s = QString::fromUcs4(text, 8);
QCOMPARE(s, QStringView(u"a\xfeff" u"b\xfeff" u"c\xfeff" "d"));
} }
void tst_QString::toUcs4() void tst_QString::toUcs4()

View File

@ -114,6 +114,7 @@ private slots:
void shouldSurviveCyclesDuringGraphSerialization(); void shouldSurviveCyclesDuringGraphSerialization();
void shouldDealWithEdgesJumpingOverLayers(); void shouldDealWithEdgesJumpingOverLayers();
void shouldGenerateDifferentStatementsDependingOnActiveLayers(); void shouldGenerateDifferentStatementsDependingOnActiveLayers();
void shouldDealWithBranchesWithoutOutput();
}; };
void tst_QShaderGraph::shouldHaveEdgeDefaultState() void tst_QShaderGraph::shouldHaveEdgeDefaultState()
@ -774,6 +775,50 @@ void tst_QShaderGraph::shouldGenerateDifferentStatementsDependingOnActiveLayers(
} }
} }
void tst_QShaderGraph::shouldDealWithBranchesWithoutOutput()
{
// GIVEN
const auto input = createNode({
createPort(QShaderNodePort::Output, "input")
});
const auto output = createNode({
createPort(QShaderNodePort::Input, "output")
});
const auto danglingFunction = createNode({
createPort(QShaderNodePort::Input, "functionInput"),
createPort(QShaderNodePort::Output, "unbound")
});
const auto function = createNode({
createPort(QShaderNodePort::Input, "functionInput"),
createPort(QShaderNodePort::Output, "functionOutput")
});
const auto graph = [=] {
auto res = QShaderGraph();
res.addNode(input);
res.addNode(function);
res.addNode(danglingFunction);
res.addNode(output);
res.addEdge(createEdge(input.uuid(), "input", function.uuid(), "functionInput"));
res.addEdge(createEdge(input.uuid(), "input", danglingFunction.uuid(), "functionInput"));
res.addEdge(createEdge(function.uuid(), "functionOutput", output.uuid(), "output"));
return res;
}();
// WHEN
const auto statements = graph.createStatements();
// THEN
// Note that no edge leads to the unbound input
const auto expected = QVector<QShaderGraph::Statement>()
<< createStatement(input, {}, {0})
<< createStatement(function, {0}, {1})
<< createStatement(output, {1}, {})
<< createStatement(danglingFunction, {0}, {2});
dumpStatementsIfNeeded(statements, expected);
QCOMPARE(statements, expected);
}
QTEST_MAIN(tst_QShaderGraph) QTEST_MAIN(tst_QShaderGraph)
#include "tst_qshadergraph.moc" #include "tst_qshadergraph.moc"

View File

@ -134,6 +134,22 @@ public:
return true; return true;
} }
static bool canBindToLowPorts()
{
#ifdef Q_OS_UNIX
if (geteuid() == 0)
return true;
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave)
return true;
// ### Which versions of iOS, watchOS and such does Apple's opening of
// all ports apply to?
return false;
#else
// Windows
return true;
#endif
}
#ifdef QT_NETWORK_LIB #ifdef QT_NETWORK_LIB
static bool verifyTestNetworkSettings() static bool verifyTestNetworkSettings()

View File

@ -529,12 +529,11 @@ void tst_PlatformSocketEngine::tooManySockets()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void tst_PlatformSocketEngine::bind() void tst_PlatformSocketEngine::bind()
{ {
#if !defined Q_OS_WIN
PLATFORMSOCKETENGINE binder; PLATFORMSOCKETENGINE binder;
QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
QVERIFY(!binder.bind(QHostAddress::AnyIPv4, 82)); QCOMPARE(binder.bind(QHostAddress::AnyIPv4, 82), QtNetworkSettings::canBindToLowPorts());
QCOMPARE(binder.error(), QAbstractSocket::SocketAccessError); if (!QtNetworkSettings::canBindToLowPorts())
#endif QCOMPARE(binder.error(), QAbstractSocket::SocketAccessError);
PLATFORMSOCKETENGINE binder2; PLATFORMSOCKETENGINE binder2;
QVERIFY(binder2.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(binder2.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
@ -546,6 +545,12 @@ void tst_PlatformSocketEngine::bind()
QCOMPARE(binder3.error(), QAbstractSocket::AddressInUseError); QCOMPARE(binder3.error(), QAbstractSocket::AddressInUseError);
if (QtNetworkSettings::hasIPv6()) { if (QtNetworkSettings::hasIPv6()) {
PLATFORMSOCKETENGINE binder;
QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol));
QCOMPARE(binder.bind(QHostAddress::AnyIPv6, 82), QtNetworkSettings::canBindToLowPorts());
if (!QtNetworkSettings::canBindToLowPorts())
QCOMPARE(binder.error(), QAbstractSocket::SocketAccessError);
PLATFORMSOCKETENGINE binder4; PLATFORMSOCKETENGINE binder4;
QVERIFY(binder4.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol)); QVERIFY(binder4.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol));
QVERIFY(binder4.bind(QHostAddress::AnyIPv6, 31180)); QVERIFY(binder4.bind(QHostAddress::AnyIPv6, 31180));

View File

@ -1,10 +1,3 @@
[bind]
windows-10 msvc-2015
windows-7sp1
[bind:[::]]
windows
[bind:[::]:randomport]
windows
[timeoutConnect:ip] [timeoutConnect:ip]
windows windows
# QTBUG-66247 # QTBUG-66247

View File

@ -523,7 +523,7 @@ void tst_QTcpSocket::bind_data()
continue; // link-local bind will fail, at least on Linux, so skip it. continue; // link-local bind will fail, at least on Linux, so skip it.
QString ip(entry.ip().toString()); QString ip(entry.ip().toString());
QTest::newRow(ip.toLatin1().constData()) << ip << 0 << true << ip; QTest::addRow("%s:0", ip.toLatin1().constData()) << ip << 0 << true << ip;
if (!testIpv6 && entry.ip().protocol() == QAbstractSocket::IPv6Protocol) if (!testIpv6 && entry.ip().protocol() == QAbstractSocket::IPv6Protocol)
testIpv6 = true; testIpv6 = true;
@ -531,9 +531,9 @@ void tst_QTcpSocket::bind_data()
} }
// test binding to localhost // test binding to localhost
QTest::newRow("0.0.0.0") << "0.0.0.0" << 0 << true << "0.0.0.0"; QTest::newRow("0.0.0.0:0") << "0.0.0.0" << 0 << true << "0.0.0.0";
if (testIpv6) if (testIpv6)
QTest::newRow("[::]") << "::" << 0 << true << "::"; QTest::newRow("[::]:0") << "::" << 0 << true << "::";
// and binding with a port number... // and binding with a port number...
// Since we want to test that we got the port number we asked for, we need a random port number. // Since we want to test that we got the port number we asked for, we need a random port number.
@ -551,16 +551,16 @@ void tst_QTcpSocket::bind_data()
knownBad << "198.51.100.1"; knownBad << "198.51.100.1";
knownBad << "2001:0DB8::1"; knownBad << "2001:0DB8::1";
foreach (const QString &badAddress, knownBad) { foreach (const QString &badAddress, knownBad) {
QTest::newRow(badAddress.toLatin1().constData()) << badAddress << 0 << false << QString(); QTest::addRow("%s:0", badAddress.toLatin1().constData()) << badAddress << 0 << false << QString();
} }
#ifdef Q_OS_UNIX
// try to bind to a privileged ports // try to bind to a privileged ports
// we should fail if we're not root (unless the ports are in use!) // we should fail if we're not root (unless the ports are in use!)
QTest::newRow("127.0.0.1:1") << "127.0.0.1" << 1 << !geteuid() << (geteuid() ? QString() : "127.0.0.1"); QTest::newRow("127.0.0.1:1") << "127.0.0.1" << 1 << QtNetworkSettings::canBindToLowPorts()
<< (QtNetworkSettings::canBindToLowPorts() ? "127.0.0.1" : QString());
if (testIpv6) if (testIpv6)
QTest::newRow("[::]:1") << "::" << 1 << !geteuid() << (geteuid() ? QString() : "::"); QTest::newRow("[::]:1") << "::" << 1 << QtNetworkSettings::canBindToLowPorts()
#endif << (QtNetworkSettings::canBindToLowPorts() ? "::" : QString());
} }
void tst_QTcpSocket::bind() void tst_QTcpSocket::bind()
@ -585,7 +585,7 @@ void tst_QTcpSocket::bind()
if (successExpected) { if (successExpected) {
bool randomPort = port == -1; bool randomPort = port == -1;
int attemptsLeft = 5; // only used with randomPort int attemptsLeft = 5; // only used with randomPort or Windows
do { do {
if (randomPort) { if (randomPort) {
// try to get a random port number // try to get a random port number