Merge remote-tracking branch 'origin/5.9' into dev

Conflicts:
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
	src/plugins/platforms/xcb/qxcbwindow.cpp

Change-Id: Ic747c3c50e68c005b425e7a1ec2a90965527c8bd
bb10
Liang Qi 2017-04-04 18:08:01 +02:00
commit 9419dfe8ee
98 changed files with 773 additions and 420 deletions

View File

@ -284,8 +284,12 @@ const char msg2[] = "==Qt=magic=Qt== Sub-architecture:"
#endif
"";
extern const char msg3[];
const char msg3[] = "==Qt=magic=Qt== Build-ABI:" ARCH_FULL;
int main()
{
puts(msg);
puts(msg2);
puts(msg3);
}

View File

@ -37,9 +37,11 @@
**
****************************************************************************/
#define PCRE2_CODE_UNIT_WIDTH 16
#include <pcre2.h>
#if (PCRE2_MAJOR < 10) || ((PCRE2_MAJOR == 10) && (PCRE_MINOR < 20))
#if (PCRE2_MAJOR < 10) || ((PCRE2_MAJOR == 10) && (PCRE2_MINOR < 20))
#error This PCRE version is not supported
#endif

View File

@ -258,15 +258,18 @@ defineTest(qtConfTest_architecture) {
arch_magic = ".*==Qt=magic=Qt== Architecture:([^\\0]*).*"
subarch_magic = ".*==Qt=magic=Qt== Sub-architecture:([^\\0]*).*"
buildabi_magic = ".*==Qt=magic=Qt== Build-ABI:([^\\0]*).*"
!contains(content, $$arch_magic)|!contains(content, $$subarch_magic): \
!contains(content, $$arch_magic)|!contains(content, $$subarch_magic)|!contains(content, $$buildabi_magic): \
error("$$eval($${1}.label) detection binary does not contain expected data.")
$${1}.arch = $$replace(content, $$arch_magic, "\\1")
$${1}.subarch = $$replace(content, $$subarch_magic, "\\1")
$${1}.subarch = $$split($${1}.subarch, " ")
$${1}.buildabi = $$replace(content, $$buildabi_magic, "\\1")
export($${1}.arch)
export($${1}.subarch)
export($${1}.buildabi)
qtLog("Detected architecture: $$eval($${1}.arch) ($$eval($${1}.subarch))")
$${1}.cache += arch subarch
@ -869,9 +872,11 @@ defineTest(qtConfOutput_shared) {
defineTest(qtConfOutput_architecture) {
arch = $$qtConfEvaluate("tests.architecture.arch")
buildabi = $$qtConfEvaluate("tests.architecture.buildabi")
$$qtConfEvaluate("features.cross_compile") {
host_arch = $$qtConfEvaluate("tests.host_architecture.arch")
host_buildabi = $$qtConfEvaluate("tests.host_architecture.buildabi")
privatePro = \
"host_build {" \
@ -883,15 +888,18 @@ defineTest(qtConfOutput_architecture) {
"host_build {" \
" QT_ARCH = $$host_arch" \
" QT_TARGET_ARCH = $$arch" \
" QT_TARGET_BUILDABI = $$buildabi" \
"} else {" \
" QT_ARCH = $$arch" \
" QT_BUILDABI = $$host_buildabi" \
"}"
} else {
privatePro = \
"QT_CPU_FEATURES.$$arch = $$qtConfEvaluate('tests.architecture.subarch')"
publicPro = \
"QT_ARCH = $$arch"
"QT_ARCH = $$arch" \
"QT_BUILDABI = $$buildabi"
}
$${currentConfig}.output.publicPro += $$publicPro

View File

@ -551,3 +551,7 @@
\externalpage http://doc.qt.io/qtcreator/creator-autotest.html
\title Qt Creator: Running Autotests
*/
/*!
\externalpage http://doc.qt.io/qtcreator/creator-project-creating.html#creating-c-classes
\title Qt Creator: Creating C++ Classes
*/

View File

@ -1581,6 +1581,14 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
\target QMAKE_DEVELOPMENT_TEAM
\section1 QMAKE_DEVELOPMENT_TEAM
\note This variable is used on \macos, iOS, tvOS, and watchOS only.
The identifier of a development team to use for signing certificates
and provisioning profiles.
\target QMAKE_DISTCLEAN
\section1 QMAKE_DISTCLEAN
@ -2076,6 +2084,17 @@
files for IDEs. The default value is the target name. The value of this
variable is typically handled by qmake and rarely needs to be modified.
\target QMAKE_PROVISIONING_PROFILE
\section1 QMAKE_PROVISIONING_PROFILE
\note This variable is used on \macos, iOS, tvOS, and watchOS only.
The UUID of a valid provisioning profile. Use in conjunction with
\l{QMAKE_DEVELOPMENT_TEAM} to specify the provisioning profile.
\note Specifying the provisioning profile disables the automatically
managed signing.
\section1 QMAKE_MAC_SDK
This variable is used on \macos when building universal binaries.
@ -3151,6 +3170,7 @@
See also \l{fn_size}{size()}.
\target system_replace
\section2 system(command[, mode[, stsvar]])
You can use this variant of the \c system function to obtain stdout from the
@ -3498,7 +3518,7 @@
\snippet code/doc_src_qmake-manual.pro 71
See also the replace variant of \l{system(command[, mode])}{system()}.
See also the replace variant of \l{system_replace}{system()}.
\target touchfunction
\section2 touch(filename, reference_filename)

View File

@ -348,6 +348,7 @@ public class QtNative
// application methods
public static native void startQtApplication(String params, String env);
public static native boolean startQtAndroidPlugin();
public static native void quitQtCoreApplication();
public static native void quitQtAndroidPlugin();
public static native void terminateQt();
// application methods

View File

@ -185,6 +185,6 @@ public class QtServiceDelegate
public void onDestroy()
{
QtNative.setService(null, null);
QtNative.quitQtCoreApplication();
}
}

View File

@ -30,29 +30,11 @@ winrt|msvc {
error("Cannot determine DirectX SDK location. Please set DXSDK_DIR environment variable.")
}
DXINC_DIR = $${DX_DIR}Include
contains(QT_ARCH, x86_64) {
DXLIB_DIR = $${DX_DIR}Lib\\x64
} else {
DXLIB_DIR = $${DX_DIR}Lib\\x86
}
equals(QMAKE_TARGET.arch, x86_64) {
FXC = \"$${DX_DIR}Utilities\\bin\\x64\\fxc.exe\"
} else {
FXC = \"$${DX_DIR}Utilities\\bin\\x86\\fxc.exe\"
}
msvc {
# Unfortunately MinGW cannot use the DirectX headers from the DX SDK because d3d11shader.h uses
# buffer annotation macros (eg: __out, __in) which are not defined in the MinGW copy of
# specstrings_strict.h
INCLUDEPATH += $$DXINC_DIR
# Similarly we want the MinGW linker to use the import libraries shipped with the compiler
# instead of those from the SDK which cause a crash on startup.
LIBS_PRIVATE += -L$$DXLIB_DIR
}
}
static: DEFINES *= LIBGLESV2_EXPORT_H_ ANGLE_EXPORT=

View File

@ -1,31 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt.io/licensing/
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** $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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** 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 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** 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.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** 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$
**

View File

@ -215,7 +215,7 @@ void QLoggingSettingsParser::setContent(QTextStream &stream)
continue;
}
if (_section.toLower() == QLatin1String("rules")) {
if (_section.compare(QLatin1String("rules"), Qt::CaseInsensitive) == 0) {
int equalPos = line.indexOf(QLatin1Char('='));
if (equalPos != -1) {
if (line.lastIndexOf(QLatin1Char('=')) == equalPos) {

View File

@ -211,7 +211,7 @@ static QCFType<CFPropertyListRef> macValue(const QVariant &value)
default:
QString string = QSettingsPrivate::variantToString(value);
if (string.contains(QChar::Null))
result = string.toUtf8().toCFData();
result = std::move(string).toUtf8().toCFData();
else
result = string.toCFString();
}
@ -419,14 +419,13 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString &
curPos = nextDot + 1;
}
javaPackageName.prepend(domainName.midRef(curPos));
javaPackageName = javaPackageName.toLower();
javaPackageName = std::move(javaPackageName).toLower();
if (curPos == 0)
javaPackageName.prepend(QLatin1String("com."));
suiteId = javaPackageName;
if (!application.isEmpty()) {
javaPackageName += QLatin1Char('.');
javaPackageName += application;
javaPackageName += QLatin1Char('.') + application;
applicationId = javaPackageName;
}

View File

@ -3418,8 +3418,7 @@ QUrl QUrl::adjusted(QUrl::FormattingOptions options) const
QByteArray QUrl::toEncoded(FormattingOptions options) const
{
options &= ~(FullyDecoded | FullyEncoded);
QString stringForm = toString(options | FullyEncoded);
return stringForm.toLatin1();
return toString(options | FullyEncoded).toLatin1();
}
/*!
@ -3536,8 +3535,7 @@ QString QUrl::fromAce(const QByteArray &domain)
*/
QByteArray QUrl::toAce(const QString &domain)
{
QString result = qt_ACE_do(domain, ToAceOnly, ForbidLeadingDot /*FIXME: make configurable*/);
return result.toLatin1();
return qt_ACE_do(domain, ToAceOnly, ForbidLeadingDot /*FIXME: make configurable*/).toLatin1();
}
/*!

View File

@ -328,6 +328,8 @@ NSUUID *QUuid::toNSUUID() const
*/
QUrl QUrl::fromCFURL(CFURLRef url)
{
if (!url)
return QUrl();
return QUrl(QString::fromCFString(CFURLGetString(url)));
}
@ -355,6 +357,8 @@ CFURLRef QUrl::toCFURL() const
*/
QUrl QUrl::fromNSURL(const NSURL *url)
{
if (!url)
return QUrl();
return QUrl(QString::fromNSString([url absoluteString]));
}

View File

@ -1,31 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2016 Intel Corporation.
** Contact: http://www.qt.io/licensing/
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** $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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** 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 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** 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.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** 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$
**

View File

@ -1,31 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2016 Intel Corporation.
** Contact: http://www.qt.io/licensing/
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** $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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** 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 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** 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.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** 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$
**

View File

@ -83,11 +83,9 @@ public:
static const unsigned MinWeight = 1;
explicit QMimeGlobPattern(const QString &thePattern, const QString &theMimeType, unsigned theWeight = DefaultWeight, Qt::CaseSensitivity s = Qt::CaseInsensitive) :
m_pattern(thePattern), m_mimeType(theMimeType), m_weight(theWeight), m_caseSensitivity(s)
m_pattern(s == Qt::CaseInsensitive ? thePattern.toLower() : thePattern),
m_mimeType(theMimeType), m_weight(theWeight), m_caseSensitivity(s)
{
if (s == Qt::CaseInsensitive) {
m_pattern = m_pattern.toLower();
}
}
void swap(QMimeGlobPattern &other) Q_DECL_NOTHROW

View File

@ -1,31 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** $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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** 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 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** 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.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** 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$
**

View File

@ -3052,7 +3052,7 @@ QString QLocaleData::doubleToString(const QChar _zero, const QChar plus, const Q
num_str.prepend(QLatin1Char(' '));
if (flags & QLocaleData::CapitalEorX)
num_str = num_str.toUpper();
num_str = std::move(num_str).toUpper();
return num_str;
}
@ -3134,7 +3134,7 @@ QString QLocaleData::longLongToString(const QChar zero, const QChar group,
}
if (flags & CapitalEorX)
num_str = num_str.toUpper();
num_str = std::move(num_str).toUpper();
if (base == 16 && (flags & ShowBase))
num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));
@ -3213,7 +3213,7 @@ QString QLocaleData::unsLongLongToString(const QChar zero, const QChar group,
}
if (flags & CapitalEorX)
num_str = num_str.toUpper();
num_str = std::move(num_str).toUpper();
if (base == 16 && flags & ShowBase)
num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));

View File

@ -1037,7 +1037,7 @@ static QString winIso639LangName(LPWSTR id)
if (!lang_code.isEmpty()) {
const char *endptr;
bool ok;
QByteArray latin1_lang_code = lang_code.toLatin1();
QByteArray latin1_lang_code = std::move(lang_code).toLatin1();
int i = qstrtoull(latin1_lang_code, &endptr, 16, &ok);
if (ok && *endptr == '\0') {
switch (i) {
@ -1120,15 +1120,12 @@ static QByteArray getWinLocaleName(LPWSTR id)
id = lcName;
}
#endif // Q_OS_WINRT
QString resultuage = winIso639LangName(id);
QString resultusage = winIso639LangName(id);
QString country = winIso3116CtryName(id);
result = resultuage.toLatin1();
if (!country.isEmpty()) {
result += '_';
result += country.toLatin1();
}
if (!country.isEmpty())
resultusage += QLatin1Char('_') + country;
return result;
return std::move(resultusage).toLatin1();
}
Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id)

View File

@ -1674,7 +1674,7 @@ QString QRegularExpression::errorString() const
} while (errorStringLength < 0);
errorString.resize(errorStringLength);
return QCoreApplication::translate("QRegularExpression", errorString.toLatin1().constData());
return QCoreApplication::translate("QRegularExpression", std::move(errorString).toLatin1().constData());
}
return QCoreApplication::translate("QRegularExpression", "no error");
}

View File

@ -277,25 +277,6 @@ template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
}
};
template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
{
typedef char type[N];
typedef QByteArray ConvertTo;
enum { ExactSize = false };
static int size(const char[N]) { return N - 1; }
#ifndef QT_NO_CAST_FROM_ASCII
static inline void QT_ASCII_CAST_WARN appendTo(const char a[N], QChar *&out)
{
QAbstractConcatenable::convertFromAscii(a, N - 1, out);
}
#endif
static inline void appendTo(const char a[N], char *&out)
{
while (*a)
*out++ = *a++;
}
};
template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable
{
typedef const char type[N];
@ -315,6 +296,11 @@ template <int N> struct QConcatenable<const char[N]> : private QAbstractConcaten
}
};
template <int N> struct QConcatenable<char[N]> : QConcatenable<const char[N]>
{
typedef char type[N];
};
template <> struct QConcatenable<const char *> : private QAbstractConcatenable
{
typedef char const *type;

View File

@ -98,7 +98,7 @@ static QByteArray ucalDefaultTimeZoneId()
// If successful on first or second go, resize and return
if (U_SUCCESS(status)) {
result.resize(size);
return result.toUtf8();
return std::move(result).toUtf8();
}
return QByteArray();

View File

@ -299,7 +299,7 @@ static QByteArray windowsSystemZoneId()
id = readRegistryString(key, L"TimeZoneKeyName");
RegCloseKey(key);
if (!id.isEmpty())
return id.toUtf8();
return std::move(id).toUtf8();
}
// On XP we have to iterate over the zones until we find a match on

View File

@ -1189,7 +1189,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
QString keyName(tran == 0
? QCoreApplication::translate("QShortcut", keyname[i].name)
: QString::fromLatin1(keyname[i].name));
if (accelRef == keyName.toLower()) {
if (accelRef == std::move(keyName).toLower()) {
ret |= keyname[i].key;
found = true;
break;

View File

@ -1282,35 +1282,11 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
return img;
}
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian.
const bool has_bgra_ext = context->isOpenGLES()
? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
: context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
// For OpenGL ES stick with the byte ordered format / RGBA readback format
// since that is the only spec mandated way. (also, skip the
// GL_IMPLEMENTATION_COLOR_READ_FORMAT mess since there is nothing saying a
// BGRA capable impl would return BGRA from there)
#ifndef Q_OS_IOS
const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
// Blacklist GPU chipsets that have problems with their BGRA support.
const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
&& ::strstr(ver, "1.3") != 0) ||
(qstrcmp(renderer, "Mali-T760") == 0
&& ::strstr(ver, "3.1") != 0) ||
(qstrcmp(renderer, "Mali-T720") == 0
&& ::strstr(ver, "3.1") != 0) ||
qstrcmp(renderer, "PowerVR SGX 554") == 0;
#else
const bool blackListed = true;
#endif
const bool supports_bgra = has_bgra_ext && !blackListed;
if (supports_bgra) {
QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits());
return img;
}
#endif
QImage rgbaImage(size, include_alpha ? QImage::Format_RGBA8888_Premultiplied : QImage::Format_RGBX8888);
funcs->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits());
return rgbaImage;
@ -1362,8 +1338,11 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format,
If used together with QOpenGLPaintDevice, \a flipped should be the opposite of the value
of QOpenGLPaintDevice::paintFlipped().
The returned image has a format of premultiplied ARGB32 or RGB32. The latter is used
only when internalTextureFormat() is set to \c GL_RGB.
The returned image has a format of premultiplied ARGB32 or RGB32. The latter
is used only when internalTextureFormat() is set to \c GL_RGB. Since Qt 5.2
the function will fall back to premultiplied RGBA8888 or RGBx8888 when
reading to (A)RGB32 is not supported, and this includes OpenGL ES. Since Qt
5.4 an A2BGR30 image is returned if the internal format is RGB10_A2.
If the rendering in the framebuffer was not done with premultiplied alpha in mind,
create a wrapper QImage with a non-premultiplied format. This is necessary before
@ -1376,10 +1355,6 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format,
QImage image(fboImage.constBits(), fboImage.width(), fboImage.height(), QImage::Format_ARGB32);
\endcode
Since Qt 5.2 the function will fall back to premultiplied RGBA8888 or RGBx8888 when
reading to (A)RGB32 is not supported. Since 5.4 an A2BGR30 image is returned if the
internal format is RGB10_A2.
For multisampled framebuffer objects the samples are resolved using the
\c{GL_EXT_framebuffer_blit} extension. If the extension is not available, the contents
of the returned image is undefined.

View File

@ -6248,13 +6248,13 @@ inline void qt_memfill_template(T *dest, T color, int count)
int n = (count + 7) / 8;
switch (count & 0x07)
{
case 0: do { *dest++ = color;
case 7: *dest++ = color;
case 6: *dest++ = color;
case 5: *dest++ = color;
case 4: *dest++ = color;
case 3: *dest++ = color;
case 2: *dest++ = color;
case 0: do { *dest++ = color; Q_FALLTHROUGH();
case 7: *dest++ = color; Q_FALLTHROUGH();
case 6: *dest++ = color; Q_FALLTHROUGH();
case 5: *dest++ = color; Q_FALLTHROUGH();
case 4: *dest++ = color; Q_FALLTHROUGH();
case 3: *dest++ = color; Q_FALLTHROUGH();
case 2: *dest++ = color; Q_FALLTHROUGH();
case 1: *dest++ = color;
} while (--n > 0);
}
@ -6265,7 +6265,7 @@ inline void qt_memfill_template(quint16 *dest, quint16 value, int count)
{
if (count < 3) {
switch (count) {
case 2: *dest++ = value;
case 2: *dest++ = value; Q_FALLTHROUGH();
case 1: *dest = value;
}
return;

View File

@ -237,11 +237,11 @@ void qt_memfill32(quint32 *dest, quint32 value, int count)
{
if (count < 7) {
switch (count) {
case 6: *dest++ = value;
case 5: *dest++ = value;
case 4: *dest++ = value;
case 3: *dest++ = value;
case 2: *dest++ = value;
case 6: *dest++ = value; Q_FALLTHROUGH();
case 5: *dest++ = value; Q_FALLTHROUGH();
case 4: *dest++ = value; Q_FALLTHROUGH();
case 3: *dest++ = value; Q_FALLTHROUGH();
case 2: *dest++ = value; Q_FALLTHROUGH();
case 1: *dest = value;
}
return;
@ -249,16 +249,16 @@ void qt_memfill32(quint32 *dest, quint32 value, int count)
const int align = (quintptr)(dest) & 0xf;
switch (align) {
case 4: *dest++ = value; --count;
case 8: *dest++ = value; --count;
case 4: *dest++ = value; --count; Q_FALLTHROUGH();
case 8: *dest++ = value; --count; Q_FALLTHROUGH();
case 12: *dest++ = value; --count;
}
const int rest = count & 0x3;
if (rest) {
switch (rest) {
case 3: dest[count - 3] = value;
case 2: dest[count - 2] = value;
case 3: dest[count - 3] = value; Q_FALLTHROUGH();
case 2: dest[count - 2] = value; Q_FALLTHROUGH();
case 1: dest[count - 1] = value;
}
}
@ -277,8 +277,8 @@ void qt_memfill32(quint32 *dest, quint32 value, int count)
}
switch (count128 & 0x3) {
case 3: _mm_stream_si128(dst128++, value128);
case 2: _mm_stream_si128(dst128++, value128);
case 3: _mm_stream_si128(dst128++, value128); Q_FALLTHROUGH();
case 2: _mm_stream_si128(dst128++, value128); Q_FALLTHROUGH();
case 1: _mm_stream_si128(dst128++, value128);
}
}
@ -318,7 +318,7 @@ void qt_memfill16(quint16 *dest, quint16 value, int count)
{
if (count < 3) {
switch (count) {
case 2: *dest++ = value;
case 2: *dest++ = value; Q_FALLTHROUGH();
case 1: *dest = value;
}
return;

View File

@ -2308,7 +2308,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
for (int i = 0; i < gradientBounds.size(); ++i)
s << gradientBounds.at(i).function << "0 R ";
s << "]\n"
">>\n";
">>\n"
"endobj\n";
write(data);
} else {
function = functions.at(0);

View File

@ -1822,7 +1822,7 @@ void StyleSheet::buildIndexes(Qt::CaseSensitivity nameCaseSensitivity)
nr.order = i;
QString name = sel.elementName;
if (nameCaseSensitivity == Qt::CaseInsensitive)
name=name.toLower();
name = std::move(name).toLower();
nameIndex.insert(name, nr);
} else {
universalsSelectors += selector;
@ -2027,7 +2027,7 @@ QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
for (int i = 0; i < names.count(); i++) {
QString name = names.at(i);
if (nameCaseSensitivity == Qt::CaseInsensitive)
name = name.toLower();
name = std::move(name).toLower();
QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.nameIndex.constFind(name);
while (it != styleSheet.nameIndex.constEnd() && it.key() == name) {
matchRule(node, it.value(), styleSheet.origin, styleSheet.depth, &weightedRules);
@ -2748,7 +2748,7 @@ bool Parser::testAndParseUri(QString *uri)
index = rewind;
return false;
}
if (name.toLower() != QLatin1String("url")) {
if (name.compare(QLatin1String("url"), Qt::CaseInsensitive) != 0) {
index = rewind;
return false;
}

View File

@ -85,4 +85,55 @@ bool QInputControl::isAcceptableInput(const QKeyEvent *event) const
return false;
}
bool QInputControl::isCommonTextEditShortcut(const QKeyEvent *ke)
{
if (ke->modifiers() == Qt::NoModifier
|| ke->modifiers() == Qt::ShiftModifier
|| ke->modifiers() == Qt::KeypadModifier) {
if (ke->key() < Qt::Key_Escape) {
return true;
} else {
switch (ke->key()) {
case Qt::Key_Return:
case Qt::Key_Enter:
case Qt::Key_Delete:
case Qt::Key_Home:
case Qt::Key_End:
case Qt::Key_Backspace:
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Up:
case Qt::Key_Down:
case Qt::Key_Tab:
return true;
default:
break;
}
}
#if QT_CONFIG(shortcut)
} else if (ke->matches(QKeySequence::Copy)
|| ke->matches(QKeySequence::Paste)
|| ke->matches(QKeySequence::Cut)
|| ke->matches(QKeySequence::Redo)
|| ke->matches(QKeySequence::Undo)
|| ke->matches(QKeySequence::MoveToNextWord)
|| ke->matches(QKeySequence::MoveToPreviousWord)
|| ke->matches(QKeySequence::MoveToStartOfDocument)
|| ke->matches(QKeySequence::MoveToEndOfDocument)
|| ke->matches(QKeySequence::SelectNextWord)
|| ke->matches(QKeySequence::SelectPreviousWord)
|| ke->matches(QKeySequence::SelectStartOfLine)
|| ke->matches(QKeySequence::SelectEndOfLine)
|| ke->matches(QKeySequence::SelectStartOfBlock)
|| ke->matches(QKeySequence::SelectEndOfBlock)
|| ke->matches(QKeySequence::SelectStartOfDocument)
|| ke->matches(QKeySequence::SelectEndOfDocument)
|| ke->matches(QKeySequence::SelectAll)
) {
return true;
#endif
}
return false;
}
QT_END_NAMESPACE

View File

@ -69,6 +69,7 @@ public:
explicit QInputControl(Type type, QObject *parent = nullptr);
bool isAcceptableInput(const QKeyEvent *event) const;
static bool isCommonTextEditShortcut(const QKeyEvent *ke);
protected:
explicit QInputControl(Type type, QObjectPrivate &dd, QObject *parent = nullptr);

View File

@ -133,7 +133,7 @@ bool Qt::mightBeRichText(const QString& text)
return false; // that's not a tag
}
#ifndef QT_NO_TEXTHTMLPARSER
return QTextHtmlParser::lookupElement(tag.toLower()) != -1;
return QTextHtmlParser::lookupElement(std::move(tag).toLower()) != -1;
#else
return false;
#endif // QT_NO_TEXTHTMLPARSER

View File

@ -834,6 +834,8 @@ void QTextDocumentLayoutPrivate::drawBorder(QPainter *painter, const QRectF &rec
#ifndef QT_NO_CSSPARSER
QCss::BorderStyle cssStyle = static_cast<QCss::BorderStyle>(style + 1);
#else
Q_UNUSED(style);
#endif //QT_NO_CSSPARSER
bool turn_off_antialiasing = !(painter->renderHints() & QPainter::Antialiasing);

View File

@ -706,8 +706,8 @@ void QTextHtmlParser::parseTag()
node = resolveParent();
resolveNode();
const int nodeIndex = nodes.count() - 1; // this new node is always the last
#ifndef QT_NO_CSSPARSER
const int nodeIndex = nodes.count() - 1; // this new node is always the last
node->applyCssDeclarations(declarationsForNode(nodeIndex), resourceProvider);
#endif
applyAttributes(node->attributes);
@ -1525,7 +1525,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
} else if (value == QLatin1String("I")) {
node->listStyle = QTextListFormat::ListUpperRoman;
} else {
value = value.toLower();
value = std::move(value).toLower();
if (value == QLatin1String("square"))
node->listStyle = QTextListFormat::ListSquare;
else if (value == QLatin1String("disc"))
@ -1636,7 +1636,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
node->parseStyleAttribute(value, resourceProvider);
#endif
} else if (key == QLatin1String("align")) {
value = value.toLower();
value = std::move(value).toLower();
bool alignmentSet = true;
if (value == QLatin1String("left"))
@ -1664,7 +1664,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
}
}
} else if (key == QLatin1String("valign")) {
value = value.toLower();
value = std::move(value).toLower();
if (value == QLatin1String("top"))
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignTop);
else if (value == QLatin1String("middle"))
@ -1672,7 +1672,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
else if (value == QLatin1String("bottom"))
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignBottom);
} else if (key == QLatin1String("dir")) {
value = value.toLower();
value = std::move(value).toLower();
if (value == QLatin1String("ltr"))
node->blockFormat.setLayoutDirection(Qt::LeftToRight);
else if (value == QLatin1String("rtl"))

View File

@ -574,7 +574,7 @@ static void _q_parseDosDir(const QStringList &tokens, const QString &userName, Q
QString name = tokens.at(3);
info->setName(name);
info->setSymLink(name.toLower().endsWith(QLatin1String(".lnk")));
info->setSymLink(name.endsWith(QLatin1String(".lnk"), Qt::CaseInsensitive));
if (tokens.at(2) == QLatin1String("<DIR>")) {
info->setFile(false);

View File

@ -1387,6 +1387,8 @@ void QHttp2ProtocolHandler::initReplyFromPushPromise(const HttpMessagePair &mess
{
Q_ASSERT(promisedData.contains(cacheKey));
auto promise = promisedData.take(cacheKey);
Q_ASSERT(message.second);
message.second->setSpdyWasUsed(true);
qCDebug(QT_HTTP2) << "found cached/promised response on stream" << promise.reservedID;

View File

@ -327,7 +327,7 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)
acceptLanguage = systemLocale + QLatin1String(",*");
else
acceptLanguage = systemLocale + QLatin1String(",en,*");
request.setHeaderField("Accept-Language", acceptLanguage.toLatin1());
request.setHeaderField("Accept-Language", std::move(acceptLanguage).toLatin1());
}
// set the User Agent

View File

@ -173,7 +173,7 @@ static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy)
Q_UNUSED(proxy)
#endif
return "http-connection:" + result.toLatin1();
return "http-connection:" + std::move(result).toLatin1();
}
class QNetworkAccessCachedHttpConnection: public QHttpNetworkConnection,

View File

@ -1234,7 +1234,14 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
}
q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed);
const QVariant http2Allowed = request.attribute(QNetworkRequest::HTTP2AllowedAttribute);
if (http2Allowed.isValid() && http2Allowed.toBool()) {
q->setAttribute(QNetworkRequest::HTTP2WasUsedAttribute, spdyWasUsed);
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, false);
} else {
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed);
q->setAttribute(QNetworkRequest::HTTP2WasUsedAttribute, false);
}
// reconstruct the HTTP header
QList<QPair<QByteArray, QByteArray> > headerMap = hm;

View File

@ -266,7 +266,10 @@ QT_BEGIN_NAMESPACE
allowed to use HTTP/2 with this request. This applies
to SSL requests or 'cleartext' HTTP/2.
\omitvalue HTTP2WasUsedAttribute
\value HTTP2WasUsedAttribute
Replies only, type: QMetaType::Bool (default: false)
Indicates whether HTTP/2 was used for receiving this reply.
(This value was introduced in 5.9.)
\value EmitAllUploadProgressSignalsAttribute
Requests only, type: QMetaType::Bool (default: false)

View File

@ -615,7 +615,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
return fallbackLists[styleLookupKey.arg(styleHint)];
}
static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName = QString())
CFArrayRef QCoreTextFontDatabase::createDescriptorArrayForFont(CTFontRef font, const QString &fileName)
{
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
QCFType<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(font);
@ -625,7 +625,7 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi
// The physical font source URL (usually a local file or Qt resource) is only required for
// FreeType, when using non-system fonts, and needs some hackery to attach in a format
// agreeable to OSX.
if (!fileName.isEmpty()) {
if (m_useFreeType && !fileName.isEmpty()) {
QCFType<CFURLRef> fontURL;
if (fileName.startsWith(QLatin1String(":/"))) {
@ -662,11 +662,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
if (cgFont) {
if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
fonts = createDescriptorArrayForFont(font
#ifndef QT_NO_FREETYPE
, m_useFreeType ? fileName : QString()
#endif
);
fonts = createDescriptorArrayForFont(font, fileName);
m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
}
}

View File

@ -58,6 +58,7 @@
#include <private/qcore_mac_p.h>
Q_FORWARD_DECLARE_CF_TYPE(CTFontDescriptor);
Q_FORWARD_DECLARE_CF_TYPE(CTFont);
Q_DECLARE_METATYPE(QCFType<CGFontRef>);
Q_DECLARE_METATYPE(QCFType<CFURLRef>);
@ -88,6 +89,7 @@ public:
private:
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName);
#ifndef QT_NO_FREETYPE
bool m_useFreeType;

View File

@ -120,7 +120,7 @@ void QDBusMenuBar::syncMenu(QPlatformMenu *menu)
void QDBusMenuBar::handleReparent(QWindow *newParentWindow)
{
if (newParentWindow && newParentWindow->winId() != m_windowId) {
if (newParentWindow) {
unregisterMenuBar();
m_windowId = newParentWindow->winId();
registerMenuBar();

View File

@ -555,6 +555,7 @@ QIcon QKdeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions
#if QT_CONFIG(mimetype)
return xdgFileIcon(fileInfo);
#else
Q_UNUSED(fileInfo);
return QIcon();
#endif
}
@ -720,6 +721,7 @@ QIcon QGnomeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptio
#if QT_CONFIG(mimetype)
return xdgFileIcon(fileInfo);
#else
Q_UNUSED(fileInfo);
return QIcon();
#endif
}

View File

@ -533,6 +533,12 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para
return pthread_create(&m_qtAppThread, nullptr, startMainMethod, nullptr) == 0;
}
static void quitQtCoreApplication(JNIEnv *env, jclass /*clazz*/)
{
Q_UNUSED(env);
QCoreApplication::quit();
}
static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/)
{
Q_UNUSED(env);
@ -733,6 +739,7 @@ static JNINativeMethod methods[] = {
{"startQtAndroidPlugin", "()Z", (void *)startQtAndroidPlugin},
{"startQtApplication", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApplication},
{"quitQtAndroidPlugin", "()V", (void *)quitQtAndroidPlugin},
{"quitQtCoreApplication", "()V", (void *)quitQtCoreApplication},
{"terminateQt", "()V", (void *)terminateQt},
{"setDisplayMetrics", "(IIIIDDDD)V", (void *)setDisplayMetrics},
{"setSurface", "(ILjava/lang/Object;II)V", (void *)setSurface},

View File

@ -58,6 +58,8 @@
#include <QDebug>
#include <vector>
enum {
defaultWindowWidth = 160,
defaultWindowHeight = 160
@ -1613,6 +1615,13 @@ void QCocoaWindow::recreateWindowIfNeeded()
[m_nsWindow closeAndRelease];
if (isChildNSWindow())
[m_view.window.parentWindow removeChildWindow:m_view.window];
if (isContentView()) {
// We explicitly disassociate m_view from the window's contentView,
// as AppKit does not automatically do this in response to removing
// the view from the NSThemeFrame subview list, so we might end up
// with a NSWindow contentView pointing to a deallocated NSView.
m_view.window.contentView = nil;
}
m_nsWindow = 0;
}
@ -1636,13 +1645,6 @@ void QCocoaWindow::recreateWindowIfNeeded()
[m_nsWindow setContentView:m_view];
[m_view release];
[m_view setPostsFrameChangedNotifications:YES];
// QTBUG-58963
// viewDidChangeFrame() should be called for each window automatically at this point because it is
// registered with Q_NOTIFICATION_HANDLER(NSViewFrameDidChangeNotification);
// The corner case when it's not called and we need to make a manual geometry update is when window's
// size is not specified explicitly but minimumSize is set and matches to the size NSView was created with.
if (QSizeF::fromCGSize(m_view.frame.size) == [QNSView defaultViewSize])
viewDidChangeFrame();
}
}
@ -1862,8 +1864,7 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
// the new state.
return;
}
default:
Q_FALLTHROUGH();
default:;
}
// Then we apply the new state if needed
@ -1881,12 +1882,8 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
[m_nsWindow miniaturize:sender];
break;
case Qt::WindowNoState:
switch (windowState()) {
case Qt::WindowMaximized:
if (windowState() == Qt::WindowMaximized)
toggleMaximized();
default:
Q_FALLTHROUGH();
}
break;
default:
Q_UNREACHABLE();
@ -2068,10 +2065,10 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
}
// Find consecutive registered border areas, starting from the top.
QList<BorderRange> ranges = m_contentBorderAreas.values();
std::vector<BorderRange> ranges(m_contentBorderAreas.cbegin(), m_contentBorderAreas.cend());
std::sort(ranges.begin(), ranges.end());
int effectiveTopContentBorderThickness = m_topContentBorderThickness;
foreach (BorderRange range, ranges) {
for (BorderRange range : ranges) {
// Skip disiabled ranges (typically hidden tool bars)
if (!m_enabledContentBorderAreas.value(range.identifier, false))
continue;

View File

@ -88,7 +88,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
QSet<quint32> m_acceptedKeyDowns;
}
+ (QSizeF)defaultViewSize;
- (id)init;
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
#ifndef QT_NO_OPENGL

View File

@ -140,8 +140,7 @@ static bool _q_dontOverrideCtrlLMB = false;
- (id) init
{
self = [super initWithFrame : NSMakeRect(0, 0, [[self class] defaultViewSize].width(), [[self class] defaultViewSize].height())];
if (self) {
if (self = [super initWithFrame:NSZeroRect]) {
m_backingStore = 0;
m_maskImage = 0;
m_shouldInvalidateWindowShadow = false;
@ -189,11 +188,6 @@ static bool _q_dontOverrideCtrlLMB = false;
[super dealloc];
}
+ (QSizeF)defaultViewSize
{
return QSizeF(300.0, 300.0);
}
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow
{
self = [self init];

View File

@ -1088,6 +1088,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
} break;
case QtWindows::DpiChangedEvent: {
if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_DLGFRAME)
return false; // Fixed-size window should not be resized
platformWindow->setFlag(QWindowsWindow::WithinDpiChanged);
const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam);
SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top,

View File

@ -717,7 +717,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
if (preferredType == QVariant::String)
ret = str;
else
ret = str.toUtf8();
ret = std::move(str).toUtf8();
}
qCDebug(lcQpaMime) << __FUNCTION__ << ret;
return ret;

View File

@ -815,14 +815,14 @@ QString QWindowsFileIconEngine::cacheKey() const
// Return "" for .exe, .lnk and .ico extensions.
// It is faster to just look at the file extensions;
// avoiding slow QFileInfo::isExecutable() (QTBUG-13182)
const QString &suffix = fileInfo().suffix();
QString suffix = fileInfo().suffix();
if (!suffix.compare(QLatin1String("exe"), Qt::CaseInsensitive)
|| !suffix.compare(QLatin1String("lnk"), Qt::CaseInsensitive)
|| !suffix.compare(QLatin1String("ico"), Qt::CaseInsensitive)) {
return QString();
}
return QLatin1String("qt_.")
+ (suffix.isEmpty() ? fileInfo().fileName() : suffix.toUpper()); // handle "Makefile" ;)
+ (suffix.isEmpty() ? fileInfo().fileName() : std::move(suffix).toUpper()); // handle "Makefile" ;)
}
QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon::State)

View File

@ -91,6 +91,7 @@ typedef ITypedEventHandler<CoreWindow*, PointerEventArgs*> PointerHandler;
typedef ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*> SizeChangedHandler;
typedef ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*> VisibilityChangedHandler;
typedef ITypedEventHandler<DisplayInformation*, IInspectable*> DisplayInformationHandler;
typedef ITypedEventHandler<ICorePointerRedirector*, PointerEventArgs*> RedirectHandler;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef ITypedEventHandler<ApplicationView*, IInspectable*> VisibleBoundsChangedHandler;
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
@ -454,6 +455,8 @@ typedef HRESULT (__stdcall ICoreWindow::*CoreWindowCallbackRemover)(EventRegistr
uint qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRegistrationToken);
uint qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall ICorePointerRedirector::*RedirectorCallbackRemover)(EventRegistrationToken);
uint qHash(RedirectorCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef HRESULT (__stdcall IApplicationView2::*ApplicationView2CallbackRemover)(EventRegistrationToken);
uint qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
@ -464,6 +467,7 @@ class QWinRTScreenPrivate
public:
QTouchDevice *touchDevice;
ComPtr<ICoreWindow> coreWindow;
ComPtr<ICorePointerRedirector> redirect;
ComPtr<Xaml::IDependencyObject> canvas;
ComPtr<IApplicationView> view;
ComPtr<IDisplayInformation> displayInformation;
@ -482,6 +486,7 @@ public:
QHash<Qt::Key, KeyInfo> activeKeys;
QHash<CoreWindowCallbackRemover, EventRegistrationToken> windowTokens;
QHash<DisplayCallbackRemover, EventRegistrationToken> displayTokens;
QHash<RedirectorCallbackRemover, EventRegistrationToken> redirectTokens;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QHash<ApplicationView2CallbackRemover, EventRegistrationToken> view2Tokens;
ComPtr<IApplicationView2> view2;
@ -513,6 +518,10 @@ QWinRTScreen::QWinRTScreen()
hr = window->get_CoreWindow(&d->coreWindow);
Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow.As(&d->redirect);
Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow->Activate();
Q_ASSERT_SUCCEEDED(hr);
@ -595,6 +604,10 @@ QWinRTScreen::~QWinRTScreen()
hr = (d->displayInformation.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr);
}
for (QHash<RedirectorCallbackRemover, EventRegistrationToken>::const_iterator i = d->redirectTokens.begin(); i != d->redirectTokens.end(); ++i) {
hr = (d->redirect.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr);
}
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
for (QHash<ApplicationView2CallbackRemover, EventRegistrationToken>::const_iterator i = d->view2Tokens.begin(); i != d->view2Tokens.end(); ++i) {
hr = (d->view2.Get()->*i.key())(i.value());
@ -754,6 +767,9 @@ void QWinRTScreen::initialize()
Q_ASSERT_SUCCEEDED(hr);
onOrientationChanged(Q_NULLPTR, Q_NULLPTR);
onVisibilityChanged(nullptr, nullptr);
hr = d->redirect->add_PointerRoutedReleased(Callback<RedirectHandler>(this, &QWinRTScreen::onRedirectReleased).Get(), &d->redirectTokens[&ICorePointerRedirector::remove_PointerRoutedReleased]);
Q_ASSERT_SUCCEEDED(hr);
}
void QWinRTScreen::setCursorRect(const QRectF &cursorRect)
@ -1378,6 +1394,13 @@ HRESULT QWinRTScreen::onDpiChanged(IDisplayInformation *, IInspectable *)
return S_OK;
}
HRESULT QWinRTScreen::onRedirectReleased(ICorePointerRedirector *, IPointerEventArgs *args)
{
// When dragging ends with a non-mouse input device then onRedirectRelease is invoked.
// QTBUG-58781
return onPointerUpdated(nullptr, args);
}
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
HRESULT QWinRTScreen::onWindowSizeChanged(IApplicationView *, IInspectable *)
#else

View File

@ -52,6 +52,7 @@ namespace ABI {
namespace Core {
struct IAutomationProviderRequestedEventArgs;
struct ICharacterReceivedEventArgs;
struct ICorePointerRedirector;
struct ICoreWindow;
struct ICoreWindowEventArgs;
struct IKeyEventArgs;
@ -149,6 +150,7 @@ private:
#else
HRESULT onWindowSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
#endif
HRESULT onRedirectReleased(ABI::Windows::UI::Core::ICorePointerRedirector *, ABI::Windows::UI::Core::IPointerEventArgs *);
QScopedPointer<QWinRTScreenPrivate> d_ptr;
QRectF mCursorRect;

View File

@ -479,7 +479,7 @@ QByteArray QXcbIntegration::wmClass() const
}
if (!name.isEmpty() && !className.isEmpty())
m_wmClass = name.toLocal8Bit() + '\0' + className.toLocal8Bit() + '\0';
m_wmClass = std::move(name).toLocal8Bit() + '\0' + std::move(className).toLocal8Bit() + '\0';
}
return m_wmClass;
}

View File

@ -305,7 +305,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
QString formatWithCharset = format;
formatWithCharset.append(QLatin1String(";charset=utf-8"));
xcb_atom_t a = connection->internAtom(formatWithCharset.toLatin1());
xcb_atom_t a = connection->internAtom(std::move(formatWithCharset).toLatin1());
if (a && atoms.contains(a)) {
*requestedEncoding = "utf-8";
return a;

View File

@ -1472,8 +1472,8 @@ void QXcbWindow::setParent(const QPlatformWindow *parent)
void QXcbWindow::setWindowTitle(const QString &title)
{
const QString fullTitle = formatWindowTitle(title, QString::fromUtf8(" \xe2\x80\x94 ")); // unicode character U+2014, EM DASH
const QByteArray ba = fullTitle.toUtf8();
QString fullTitle = formatWindowTitle(title, QString::fromUtf8(" \xe2\x80\x94 ")); // unicode character U+2014, EM DASH
const QByteArray ba = std::move(fullTitle).toUtf8();
xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
m_window,

View File

@ -57,11 +57,6 @@
QT_BEGIN_NAMESPACE
static QByteArray standardButtonText(int button)
{
return QGtk3Theme::defaultStandardButtonText(button).toUtf8();
}
class QGtk3Dialog : public QWindow
{
Q_OBJECT
@ -236,7 +231,7 @@ void QGtk3ColorDialogHelper::onColorChanged(QGtk3ColorDialogHelper *dialog)
void QGtk3ColorDialogHelper::applyOptions()
{
GtkDialog *gtkDialog = d->gtkDialog();
gtk_window_set_title(GTK_WINDOW(gtkDialog), options()->windowTitle().toUtf8());
gtk_window_set_title(GTK_WINDOW(gtkDialog), qUtf8Printable(options()->windowTitle()));
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(gtkDialog), options()->testOption(QColorDialogOptions::ShowAlphaChannel));
}
@ -245,8 +240,8 @@ QGtk3FileDialogHelper::QGtk3FileDialogHelper()
{
d.reset(new QGtk3Dialog(gtk_file_chooser_dialog_new("", 0,
GTK_FILE_CHOOSER_ACTION_OPEN,
standardButtonText(QPlatformDialogHelper::Cancel), GTK_RESPONSE_CANCEL,
standardButtonText(QPlatformDialogHelper::Ok), GTK_RESPONSE_OK,
qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Cancel)), GTK_RESPONSE_CANCEL,
qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Ok)), GTK_RESPONSE_OK,
NULL)));
connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted()));
@ -294,7 +289,7 @@ bool QGtk3FileDialogHelper::defaultNameFilterDisables() const
void QGtk3FileDialogHelper::setDirectory(const QUrl &directory)
{
GtkDialog *gtkDialog = d->gtkDialog();
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), directory.toLocalFile().toUtf8());
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(directory.toLocalFile()));
}
QUrl QGtk3FileDialogHelper::directory() const
@ -315,14 +310,20 @@ QUrl QGtk3FileDialogHelper::directory() const
}
void QGtk3FileDialogHelper::selectFile(const QUrl &filename)
{
setFileChooserAction();
selectFileInternal(filename);
}
void QGtk3FileDialogHelper::selectFileInternal(const QUrl &filename)
{
GtkDialog *gtkDialog = d->gtkDialog();
if (options()->acceptMode() == QFileDialogOptions::AcceptSave) {
QFileInfo fi(filename.toLocalFile());
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), fi.path().toUtf8());
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(gtkDialog), fi.fileName().toUtf8());
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(fi.path()));
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(fi.fileName()));
} else {
gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(gtkDialog), filename.toLocalFile().toUtf8());
gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(gtkDialog), qUtf8Printable(filename.toLocalFile()));
}
}
@ -409,16 +410,23 @@ static GtkFileChooserAction gtkFileChooserAction(const QSharedPointer<QFileDialo
}
}
void QGtk3FileDialogHelper::setFileChooserAction()
{
GtkDialog *gtkDialog = d->gtkDialog();
const GtkFileChooserAction action = gtkFileChooserAction(options());
gtk_file_chooser_set_action(GTK_FILE_CHOOSER(gtkDialog), action);
}
void QGtk3FileDialogHelper::applyOptions()
{
GtkDialog *gtkDialog = d->gtkDialog();
const QSharedPointer<QFileDialogOptions> &opts = options();
gtk_window_set_title(GTK_WINDOW(gtkDialog), opts->windowTitle().toUtf8());
gtk_window_set_title(GTK_WINDOW(gtkDialog), qUtf8Printable(opts->windowTitle()));
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(gtkDialog), true);
const GtkFileChooserAction action = gtkFileChooserAction(opts);
gtk_file_chooser_set_action(GTK_FILE_CHOOSER(gtkDialog), action);
setFileChooserAction();
const bool selectMultiple = opts->fileMode() == QFileDialogOptions::ExistingFiles;
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(gtkDialog), selectMultiple);
@ -437,7 +445,7 @@ void QGtk3FileDialogHelper::applyOptions()
setDirectory(opts->initialDirectory());
foreach (const QUrl &filename, opts->initiallySelectedFiles())
selectFile(filename);
selectFileInternal(filename);
const QString initialNameFilter = opts->initiallySelectedNameFilter();
if (!initialNameFilter.isEmpty())
@ -446,19 +454,19 @@ void QGtk3FileDialogHelper::applyOptions()
GtkWidget *acceptButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_OK);
if (acceptButton) {
if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
gtk_button_set_label(GTK_BUTTON(acceptButton), opts->labelText(QFileDialogOptions::Accept).toUtf8());
gtk_button_set_label(GTK_BUTTON(acceptButton), qUtf8Printable(opts->labelText(QFileDialogOptions::Accept)));
else if (opts->acceptMode() == QFileDialogOptions::AcceptOpen)
gtk_button_set_label(GTK_BUTTON(acceptButton), standardButtonText(QPlatformDialogHelper::Open));
gtk_button_set_label(GTK_BUTTON(acceptButton), qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Open)));
else
gtk_button_set_label(GTK_BUTTON(acceptButton), standardButtonText(QPlatformDialogHelper::Save));
gtk_button_set_label(GTK_BUTTON(acceptButton), qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Save)));
}
GtkWidget *rejectButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_CANCEL);
if (rejectButton) {
if (opts->isLabelExplicitlySet(QFileDialogOptions::Reject))
gtk_button_set_label(GTK_BUTTON(rejectButton), opts->labelText(QFileDialogOptions::Reject).toUtf8());
gtk_button_set_label(GTK_BUTTON(rejectButton), qUtf8Printable(opts->labelText(QFileDialogOptions::Reject)));
else
gtk_button_set_label(GTK_BUTTON(rejectButton), standardButtonText(QPlatformDialogHelper::Cancel));
gtk_button_set_label(GTK_BUTTON(rejectButton), qUtf8Printable(QGtk3Theme::defaultStandardButtonText(QPlatformDialogHelper::Cancel)));
}
}
@ -473,12 +481,12 @@ void QGtk3FileDialogHelper::setNameFilters(const QStringList &filters)
foreach (const QString &filter, filters) {
GtkFileFilter *gtkFilter = gtk_file_filter_new();
const QStringRef name = filter.leftRef(filter.indexOf(QLatin1Char('(')));
const QString name = filter.left(filter.indexOf(QLatin1Char('(')));
const QStringList extensions = cleanFilterList(filter);
gtk_file_filter_set_name(gtkFilter, name.isEmpty() ? extensions.join(QLatin1String(", ")).toUtf8() : name.toUtf8());
gtk_file_filter_set_name(gtkFilter, qUtf8Printable(name.isEmpty() ? extensions.join(QLatin1String(", ")) : name));
foreach (const QString &ext, extensions)
gtk_file_filter_add_pattern(gtkFilter, ext.toUtf8());
gtk_file_filter_add_pattern(gtkFilter, qUtf8Printable(ext));
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(gtkDialog), gtkFilter);
@ -520,7 +528,7 @@ static QString qt_fontToString(const QFont &font)
{
PangoFontDescription *desc = pango_font_description_new();
pango_font_description_set_size(desc, (font.pointSizeF() > 0.0 ? font.pointSizeF() : QFontInfo(font).pointSizeF()) * PANGO_SCALE);
pango_font_description_set_family(desc, QFontInfo(font).family().toUtf8());
pango_font_description_set_family(desc, qUtf8Printable(QFontInfo(font).family()));
int weight = font.weight();
if (weight >= QFont::Black)
@ -560,7 +568,7 @@ static QString qt_fontToString(const QFont &font)
static QFont qt_fontFromString(const QString &name)
{
QFont font;
PangoFontDescription *desc = pango_font_description_from_string(name.toUtf8());
PangoFontDescription *desc = pango_font_description_from_string(qUtf8Printable(name));
font.setPointSizeF(static_cast<float>(pango_font_description_get_size(desc)) / PANGO_SCALE);
QString family = QString::fromUtf8(pango_font_description_get_family(desc));
@ -585,7 +593,7 @@ static QFont qt_fontFromString(const QString &name)
void QGtk3FontDialogHelper::setCurrentFont(const QFont &font)
{
GtkFontChooser *gtkDialog = GTK_FONT_CHOOSER(d->gtkDialog());
gtk_font_chooser_set_font(gtkDialog, qt_fontToString(font).toUtf8());
gtk_font_chooser_set_font(gtkDialog, qUtf8Printable(qt_fontToString(font)));
}
QFont QGtk3FontDialogHelper::currentFont() const
@ -612,7 +620,7 @@ void QGtk3FontDialogHelper::applyOptions()
GtkDialog *gtkDialog = d->gtkDialog();
const QSharedPointer<QFontDialogOptions> &opts = options();
gtk_window_set_title(GTK_WINDOW(gtkDialog), opts->windowTitle().toUtf8());
gtk_window_set_title(GTK_WINDOW(gtkDialog), qUtf8Printable(opts->windowTitle()));
}
QT_END_NAMESPACE

View File

@ -110,6 +110,8 @@ private:
static void onFilterChanged(QGtk3FileDialogHelper *helper);
void applyOptions();
void setNameFilters(const QStringList &filters);
void selectFileInternal(const QUrl &filename);
void setFileChooserAction();
QUrl _dir;
QList<QUrl> _selection;

View File

@ -911,7 +911,7 @@ bool QPSQLDriver::open(const QString & db,
connectString.append(QLatin1Char(' ')).append(opt);
}
d->connection = PQconnectdb(connectString.toLocal8Bit().constData());
d->connection = PQconnectdb(std::move(connectString).toLocal8Bit().constData());
if (PQstatus(d->connection) == CONNECTION_BAD) {
setLastError(qMakeError(tr("Unable to connect"), QSqlError::ConnectionError, d));
setOpenError(true);
@ -1073,12 +1073,12 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
else
tbl = tbl.toLower();
tbl = std::move(tbl).toLower();
if (isIdentifierEscaped(schema, QSqlDriver::TableName))
schema = stripDelimiters(schema, QSqlDriver::TableName);
else
schema = schema.toLower();
schema = std::move(schema).toLower();
switch(d->pro) {
case QPSQLDriver::Version6:
@ -1153,12 +1153,12 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
else
tbl = tbl.toLower();
tbl = std::move(tbl).toLower();
if (isIdentifierEscaped(schema, QSqlDriver::TableName))
schema = stripDelimiters(schema, QSqlDriver::TableName);
else
schema = schema.toLower();
schema = std::move(schema).toLower();
QString stmt;
switch(d->pro) {

View File

@ -101,6 +101,7 @@ static inline QString jobHoldToString(const QCUPSSupport::JobHoldUntil jobHold,
return localDateTime.toUTC().time().toString(QStringLiteral("HH:mm"));
}
// else fall through:
Q_FALLTHROUGH();
case QCUPSSupport::NoHold:
return QString();
}

View File

@ -106,7 +106,7 @@ static QByteArray msgBeginFailed(const char *function, const DOCINFO &d)
str << ", document \"" << QString::fromWCharArray(d.lpszDocName) << '"';
if (d.lpszOutput && d.lpszOutput[0])
str << ", file \"" << QString::fromWCharArray(d.lpszOutput) << '"';
return result.toLocal8Bit();
return std::move(result).toLocal8Bit();
}
bool QWin32PrintEngine::begin(QPaintDevice *pdev)

View File

@ -986,8 +986,8 @@ QString QSqlTableModel::orderByClause() const
//we can safely escape the field because it would have been obtained from the database
//and have the correct case
QString field = d->db.driver()->escapeIdentifier(f.name(), QSqlDriver::FieldName);
field.prepend(QLatin1Char('.')).prepend(d->tableName);
QString field = d->tableName + QLatin1Char('.')
+ d->db.driver()->escapeIdentifier(f.name(), QSqlDriver::FieldName);
field = d->sortOrder == Qt::AscendingOrder ? Sql::asc(field) : Sql::desc(field);
return Sql::orderBy(field);
}

View File

@ -199,8 +199,8 @@ namespace QTest {
int formatResult(char * buffer, int bufferSize, T number, int significantDigits)
{
QString result = formatResult(number, significantDigits);
qstrncpy(buffer, result.toLatin1().constData(), bufferSize);
int size = result.count();
qstrncpy(buffer, std::move(result).toLatin1().constData(), bufferSize);
return size;
}
}

View File

@ -447,7 +447,7 @@ int main(int argc, char **argv)
output.write("<node>\n");
for (const ClassDef &cdef : qAsConst(classes)) {
QString xml = qDBusGenerateClassDefXml(&cdef);
output.write(xml.toLocal8Bit());
output.write(std::move(xml).toLocal8Bit());
}
output.write("</node>\n");

View File

@ -217,7 +217,7 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
annotationName += QString::fromLatin1(".%1%2").arg(QLatin1String(direction)).arg(paramId);
QString qttype = annotations.value(annotationName);
if (!qttype.isEmpty())
return qttype.toLatin1();
return std::move(qttype).toLatin1();
QString oldAnnotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName");
if (paramId >= 0)
@ -242,7 +242,7 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
"suggest updating to '%s'\n",
PROGRAMNAME, qPrintable(oldAnnotationName), qPrintable(inputFile),
qPrintable(annotationName));
return qttype.toLatin1();
return std::move(qttype).toLatin1();
}
return QVariant::typeToName(QVariant::Type(type));

View File

@ -48,10 +48,11 @@ namespace {
// Fixup an enumeration name from class Qt.
// They are currently stored as "BottomToolBarArea" instead of "Qt::BottomToolBarArea".
// due to MO issues. This might be fixed in the future.
void fixQtEnumerationName(QString& name) {
QLatin1String qtEnumerationPrefix(const QString &name) {
static const QLatin1String prefix("Qt::");
if (name.indexOf(prefix) != 0)
name.prepend(prefix);
return prefix;
return QLatin1String();
}
// figure out the toolbar area of a DOM attrib list.
// By legacy, it is stored as an integer. As of 4.3.0, it is the enumeration value.
@ -62,16 +63,12 @@ namespace {
switch (pstyle->kind()) {
case DomProperty::Number: {
QString area = QLatin1String("static_cast<Qt::ToolBarArea>(");
area += QString::number(pstyle->elementNumber());
area += QLatin1String("), ");
return area;
return QLatin1String("static_cast<Qt::ToolBarArea>(")
+ QString::number(pstyle->elementNumber()) + QLatin1String("), ");
}
case DomProperty::Enum: {
QString area = pstyle->elementEnum();
fixQtEnumerationName(area);
area += QLatin1String(", ");
return area;
const QString area = pstyle->elementEnum();
return qtEnumerationPrefix(area) + area + QLatin1String(", ");
}
default:
break;

View File

@ -310,6 +310,7 @@ bool QAccessibleTable::selectColumn(int column)
case QAbstractItemView::SingleSelection:
if (view()->selectionBehavior() != QAbstractItemView::SelectColumns && rowCount() > 1)
return false;
Q_FALLTHROUGH();
case QAbstractItemView::ContiguousSelection:
if ((!column || !view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex()))
&& !view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex()))

View File

@ -1500,6 +1500,7 @@ void QGraphicsWidget::changeEvent(QEvent *event)
unsetWindowFrameMargins();
if (d->layout)
d->layout->invalidate();
Q_FALLTHROUGH();
case QEvent::FontChange:
update();
updateGeometry();

View File

@ -4035,6 +4035,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC
switch (static_cast<const QKeyEvent*>(event)->key()) {
case Qt::Key_Backtab:
modifiers = modifiers & ~Qt::ShiftModifier; // special case for backtab
Q_FALLTHROUGH();
case Qt::Key_Down:
case Qt::Key_Up:
case Qt::Key_Left:

View File

@ -2565,6 +2565,7 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
d->updateSectionIndicator(d->section, pos);
break;
} // not moving
Q_FALLTHROUGH();
case QHeaderViewPrivate::SelectSections:
if (!d->clickableSections) {
int section = logicalIndexAt(pos);

View File

@ -55,6 +55,7 @@
#include <qapplication.h>
#include <qdebug.h>
#include <vector>
#include <algorithm>
QT_BEGIN_NAMESPACE
@ -191,9 +192,11 @@ QByteArray QItemEditorFactory::valuePropertyName(int userType) const
QItemEditorFactory::~QItemEditorFactory()
{
//we make sure we delete all the QItemEditorCreatorBase
//this has to be done only once, hence the QSet
QSet<QItemEditorCreatorBase*> set = creatorMap.values().toSet();
qDeleteAll(set);
//this has to be done only once, hence the sort-unique idiom
std::vector<QItemEditorCreatorBase*> creators(creatorMap.cbegin(), creatorMap.cend());
std::sort(creators.begin(), creators.end());
const auto it = std::unique(creators.begin(), creators.end());
qDeleteAll(creators.begin(), it);
}
/*!

View File

@ -1157,6 +1157,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
rect.moveTop(rect.top() - d->viewport->height() + 2 * rect.height());
if (rect.top() < rect.height())
rect.moveTop(rect.height());
Q_FALLTHROUGH();
case MovePrevious:
case MoveUp:
while (intersectVector.isEmpty()) {
@ -1185,6 +1186,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
rect.moveTop(rect.top() + d->viewport->height() - 2 * rect.height());
if (rect.bottom() > contents.height() - rect.height())
rect.moveBottom(contents.height() - rect.height());
Q_FALLTHROUGH();
case MoveNext:
case MoveDown:
while (intersectVector.isEmpty()) {

View File

@ -4882,6 +4882,8 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz.rheight() += 2; // Prevent icons from overlapping.
}
break;
#else
Q_UNUSED(d);
#endif // QT_NO_ITEMVIEWS
#ifndef QT_NO_SPINBOX
case CT_SpinBox:

View File

@ -732,6 +732,8 @@ void QPixmapStyle::drawLineEdit(const QStyleOption *option,
#if QT_CONFIG(combobox)
if (widget && qobject_cast<const QComboBox*>(widget->parentWidget()))
return;
#else
Q_UNUSED(widget);
#endif
const bool enabled = option->state & State_Enabled;
const bool focused = option->state & State_HasFocus;

View File

@ -493,7 +493,7 @@ QMatchData QCompletionEngine::filterHistory()
bool QCompletionEngine::matchHint(QString part, const QModelIndex& parent, QMatchData *hint)
{
if (c->cs == Qt::CaseInsensitive)
part = part.toLower();
part = std::move(part).toLower();
const CacheItem& map = cache[parent];
@ -512,7 +512,7 @@ bool QCompletionEngine::matchHint(QString part, const QModelIndex& parent, QMatc
bool QCompletionEngine::lookupCache(QString part, const QModelIndex& parent, QMatchData *m)
{
if (c->cs == Qt::CaseInsensitive)
part = part.toLower();
part = std::move(part).toLower();
const CacheItem& map = cache[parent];
if (!map.contains(part))
return false;
@ -548,7 +548,7 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con
}
if (c->cs == Qt::CaseInsensitive)
part = part.toLower();
part = std::move(part).toLower();
cache[parent][part] = m;
}
@ -558,7 +558,7 @@ QIndexMapper QSortedModelEngine::indexHint(QString part, const QModelIndex& pare
const QAbstractItemModel *model = c->proxy->sourceModel();
if (c->cs == Qt::CaseInsensitive)
part = part.toLower();
part = std::move(part).toLower();
const CacheItem& map = cache[parent];

View File

@ -64,6 +64,8 @@
#include "qdebug.h"
#include "qtextedit.h"
#include <private/qtextedit_p.h>
#include <private/qwidgettextcontrol_p.h>
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif

View File

@ -536,7 +536,8 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
// If there is a 'before' action, it takes preference
// There's a bug in GHS compiler that causes internal error on the following code.
// The affected GHS compiler versions are 2016.5.4 and 2017.1
// The affected GHS compiler versions are 2016.5.4 and 2017.1. GHS internal reference
// to track the progress of this issue is TOOLS-26637.
// This temporary workaround allows to compile with GHS toolchain and should be
// removed when GHS provides a patch to fix the compiler issue.

View File

@ -2330,6 +2330,9 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
}
#endif
#if !QT_CONFIG(dockwidget) || !QT_CONFIG(tabbar)
Q_UNUSED(group);
#endif
layoutState.unplug(path ,&savedState);
savedState.fitLayout();

View File

@ -1470,6 +1470,17 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event)
}
}
if (isNativeMenuBar() && event->type() == QEvent::ShowToParent) {
// On some desktops like Unity, the D-Bus menu bar is unregistered
// when the window is hidden. So when the window is shown, we need
// to forcefully re-register it. The only way to force re-registering
// with D-Bus menu is the handleReparent method.
QWidget *widget = qobject_cast<QWidget *>(object);
QWindow *handle = widget ? widget->windowHandle() : nullptr;
if (handle != nullptr)
d->platformMenuBar->handleReparent(handle);
}
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) {
if (d->altPressed) {
switch (event->type()) {

View File

@ -1798,9 +1798,9 @@ QTextStream& operator>>(QTextStream& ts, QSplitter& splitter)
QString line = ts.readLine();
line = line.simplified();
line.replace(QLatin1Char(' '), QString());
line = line.toUpper();
line = std::move(line).toUpper();
splitter.restoreState(line.toLatin1());
splitter.restoreState(std::move(line).toLatin1());
return ts;
}

View File

@ -1144,52 +1144,8 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
case QEvent::ShortcutOverride:
if (d->interactionFlags & Qt::TextEditable) {
QKeyEvent* ke = static_cast<QKeyEvent *>(e);
if (ke->modifiers() == Qt::NoModifier
|| ke->modifiers() == Qt::ShiftModifier
|| ke->modifiers() == Qt::KeypadModifier) {
if (ke->key() < Qt::Key_Escape) {
ke->accept();
} else {
switch (ke->key()) {
case Qt::Key_Return:
case Qt::Key_Enter:
case Qt::Key_Delete:
case Qt::Key_Home:
case Qt::Key_End:
case Qt::Key_Backspace:
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Up:
case Qt::Key_Down:
case Qt::Key_Tab:
ke->accept();
default:
break;
}
}
#ifndef QT_NO_SHORTCUT
} else if (ke == QKeySequence::Copy
|| ke == QKeySequence::Paste
|| ke == QKeySequence::Cut
|| ke == QKeySequence::Redo
|| ke == QKeySequence::Undo
|| ke == QKeySequence::MoveToNextWord
|| ke == QKeySequence::MoveToPreviousWord
|| ke == QKeySequence::MoveToStartOfDocument
|| ke == QKeySequence::MoveToEndOfDocument
|| ke == QKeySequence::SelectNextWord
|| ke == QKeySequence::SelectPreviousWord
|| ke == QKeySequence::SelectStartOfLine
|| ke == QKeySequence::SelectEndOfLine
|| ke == QKeySequence::SelectStartOfBlock
|| ke == QKeySequence::SelectEndOfBlock
|| ke == QKeySequence::SelectStartOfDocument
|| ke == QKeySequence::SelectEndOfDocument
|| ke == QKeySequence::SelectAll
) {
if (isCommonTextEditShortcut(ke))
ke->accept();
#endif
}
}
break;
default:

View File

@ -6442,7 +6442,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
if (enc.isEmpty())
enc = encoding.cap(5);
if (!enc.isEmpty())
codec = QTextCodec::codecForName(enc.toLatin1().data());
codec = QTextCodec::codecForName(std::move(enc).toLatin1());
}
if (!codec)
codec = QTextCodec::codecForName("UTF-8");

View File

@ -1407,7 +1407,7 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
QString encoding = extractEncodingDecl(d->encodingDeclChars, &needMoreText);
if (!encoding.isEmpty()) {
if (QTextCodec *codec = QTextCodec::codecForName(encoding.toLatin1())) {
if (QTextCodec *codec = QTextCodec::codecForName(std::move(encoding).toLatin1())) {
/* If the encoding is the same, we don't have to do toUnicode() all over again. */
if(codec->mibEnum() != mib) {
delete d->encMapper;

View File

@ -2,3 +2,4 @@
windows
[finishWithUncontrolledAnimation]
windows
macos-10.12

View File

@ -2,3 +2,5 @@ CONFIG += testcase
TARGET = tst_largefile
QT = core testlib
SOURCES = tst_largefile.cpp
INCLUDEPATH += ../../../../shared/
HEADERS += ../../../../shared/emulationdetector.h

View File

@ -47,6 +47,8 @@
# endif
#endif // Q_OS_WIN
#include "emulationdetector.h"
class tst_LargeFile
: public QObject
{
@ -68,6 +70,10 @@ public:
#else
maxSizeBits = 24; // 16 MiB
#endif
// QEMU only supports < 4GB files
if (EmulationDetector::isRunningArmOnX86())
maxSizeBits = qMin(maxSizeBits, 28);
}
private:

View File

@ -70,6 +70,8 @@ private slots:
void palette();
void modalWindow();
void quitOnLastWindowClosed();
void quitOnLastWindowClosedMulti();
void dontQuitOnLastWindowClosed();
void genericPluginsAndWindowSystemEvents();
void layoutDirection();
void globalShareContext();
@ -791,107 +793,111 @@ void tst_QGuiApplication::modalWindow()
void tst_QGuiApplication::quitOnLastWindowClosed()
{
{
int argc = 0;
QGuiApplication app(argc, 0);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
int argc = 0;
QGuiApplication app(argc, 0);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
QTimer timer;
timer.setInterval(100);
QTimer timer;
timer.setInterval(100);
QSignalSpy spy(&app, SIGNAL(aboutToQuit()));
QSignalSpy spy2(&timer, SIGNAL(timeout()));
QSignalSpy spyAboutToQuit(&app, &QCoreApplication::aboutToQuit);
QSignalSpy spyTimeout(&timer, &QTimer::timeout);
QWindow mainWindow;
mainWindow.setTitle(QStringLiteral("quitOnLastWindowClosedMainWindow"));
mainWindow.resize(windowSize, windowSize);
mainWindow.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing));
QWindow mainWindow;
mainWindow.setTitle(QStringLiteral("quitOnLastWindowClosedMainWindow"));
mainWindow.resize(windowSize, windowSize);
mainWindow.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing));
QWindow dialog;
dialog.setTransientParent(&mainWindow);
dialog.setTitle(QStringLiteral("quitOnLastWindowClosedDialog"));
dialog.resize(windowSize, windowSize);
dialog.setFramePosition(QPoint(screenGeometry.left() + 2 * spacing + windowSize, screenGeometry.top() + spacing));
QWindow dialog;
dialog.setTransientParent(&mainWindow);
dialog.setTitle(QStringLiteral("quitOnLastWindowClosedDialog"));
dialog.resize(windowSize, windowSize);
dialog.setFramePosition(QPoint(screenGeometry.left() + 2 * spacing + windowSize, screenGeometry.top() + spacing));
QVERIFY(app.quitOnLastWindowClosed());
QVERIFY(app.quitOnLastWindowClosed());
mainWindow.show();
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
mainWindow.show();
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
timer.start();
QTimer::singleShot(1000, &mainWindow, SLOT(close())); // This should quit the application
QTimer::singleShot(2000, &app, SLOT(quit())); // This makes sure we quit even if it didn't
timer.start();
QTimer::singleShot(1000, &mainWindow, &QWindow::close); // This should quit the application
QTimer::singleShot(2000, &app, QCoreApplication::quit); // This makes sure we quit even if it didn't
app.exec();
app.exec();
QCOMPARE(spy.count(), 1);
QVERIFY(spy2.count() < 15); // Should be around 10 if closing caused the quit
}
{
int argc = 0;
QGuiApplication app(argc, 0);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
QCOMPARE(spyAboutToQuit.count(), 1);
// Should be around 10 if closing caused the quit
QVERIFY2(spyTimeout.count() < 15, QByteArray::number(spyTimeout.count()).constData());
}
QTimer timer;
timer.setInterval(100);
void tst_QGuiApplication::quitOnLastWindowClosedMulti()
{
int argc = 0;
QGuiApplication app(argc, 0);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
QSignalSpy spy(&app, SIGNAL(aboutToQuit()));
QSignalSpy spy2(&timer, SIGNAL(timeout()));
QTimer timer;
timer.setInterval(100);
QWindow mainWindow;
mainWindow.setTitle(QStringLiteral("quitOnLastWindowClosedMainWindow"));
mainWindow.resize(windowSize, windowSize);
mainWindow.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing));
QSignalSpy spyAboutToQuit(&app, &QCoreApplication::aboutToQuit);
QSignalSpy spyTimeout(&timer, &QTimer::timeout);
QWindow dialog;
dialog.setTitle(QStringLiteral("quitOnLastWindowClosedDialog"));
dialog.resize(windowSize, windowSize);
dialog.setFramePosition(QPoint(screenGeometry.left() + 2 * spacing + windowSize, screenGeometry.top() + spacing));
QWindow mainWindow;
mainWindow.setTitle(QStringLiteral("quitOnLastWindowClosedMultiMainWindow"));
mainWindow.resize(windowSize, windowSize);
mainWindow.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing));
QVERIFY(!dialog.transientParent());
QVERIFY(app.quitOnLastWindowClosed());
QWindow dialog;
dialog.setTitle(QStringLiteral("quitOnLastWindowClosedMultiDialog"));
dialog.resize(windowSize, windowSize);
dialog.setFramePosition(QPoint(screenGeometry.left() + 2 * spacing + windowSize, screenGeometry.top() + spacing));
mainWindow.show();
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
QVERIFY(!dialog.transientParent());
QVERIFY(app.quitOnLastWindowClosed());
timer.start();
QTimer::singleShot(1000, &mainWindow, SLOT(close())); // This should not quit the application
QTimer::singleShot(2000, &app, SLOT(quit()));
mainWindow.show();
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
app.exec();
timer.start();
QTimer::singleShot(1000, &mainWindow, &QWindow::close); // This should not quit the application
QTimer::singleShot(2000, &app, &QCoreApplication::quit);
QCOMPARE(spy.count(), 1);
QVERIFY(spy2.count() > 15); // Should be around 20 if closing did not cause the quit
}
{
int argc = 0;
QGuiApplication app(argc, 0);
app.setQuitOnLastWindowClosed(false);
app.exec();
QTimer timer;
timer.setInterval(2000);
timer.setSingleShot(true);
QObject::connect(&timer, SIGNAL(timeout()), &app, SLOT(quit()));
QCOMPARE(spyAboutToQuit.count(), 1);
// Should be around 20 if closing did not cause the quit
QVERIFY2(spyTimeout.count() > 15, QByteArray::number(spyTimeout.count()).constData());
}
QSignalSpy spy(&app, SIGNAL(lastWindowClosed()));
QSignalSpy spy2(&timer, SIGNAL(timeout()));
void tst_QGuiApplication::dontQuitOnLastWindowClosed()
{
int argc = 0;
QGuiApplication app(argc, 0);
app.setQuitOnLastWindowClosed(false);
QPointer<QWindow> mainWindow = new QWindow;
QTimer timer;
timer.setInterval(2000);
timer.setSingleShot(true);
QObject::connect(&timer, &QTimer::timeout, &app, &QCoreApplication::quit);
mainWindow->show();
QSignalSpy spyLastWindowClosed(&app, &QGuiApplication::lastWindowClosed);
QSignalSpy spyTimeout(&timer, &QTimer::timeout);
QTimer::singleShot(1000, mainWindow, SLOT(close())); // This should not quit the application
timer.start();
QScopedPointer<QWindow> mainWindow(new QWindow);
app.exec();
mainWindow->show();
QCOMPARE(spy2.count(), 1); // quit timer fired
QCOMPARE(spy.count(), 1); // lastWindowClosed emitted
QTimer::singleShot(1000, mainWindow.data(), &QWindow::close); // This should not quit the application
timer.start();
app.setQuitOnLastWindowClosed(true); // restore underlying static to default value
}
app.exec();
app.setQuitOnLastWindowClosed(true); // restore underlying static to default value
QCOMPARE(spyTimeout.count(), 1); // quit timer fired
QCOMPARE(spyLastWindowClosed.count(), 1); // lastWindowClosed emitted
}
static Qt::ScreenOrientation testOrientationToSend = Qt::PrimaryOrientation;

View File

@ -8,4 +8,4 @@ QT += gui-private core-private testlib
SOURCES += tst_qopengl.cpp
linux:qtConfig(xcb-glx):qtConfig(xcb-xlib):!qtConfig(egl): DEFINES += USE_GLX
linux:qtConfig(xcb):qtConfig(xcb-glx):qtConfig(xcb-xlib):!qtConfig(egl): DEFINES += USE_GLX

View File

@ -244,8 +244,13 @@ void tst_QFontDatabase::addAppFont()
QVERIFY(!newFamilies.isEmpty());
QVERIFY(newFamilies.count() >= oldFamilies.count());
for (int i = 0; i < addedFamilies.count(); ++i)
QVERIFY(newFamilies.contains(addedFamilies.at(i)));
for (int i = 0; i < addedFamilies.count(); ++i) {
QString family = addedFamilies.at(i);
QVERIFY(newFamilies.contains(family));
QFont qfont(family);
QFontInfo fi(qfont);
QCOMPARE(fi.family(), family);
}
QVERIFY(QFontDatabase::removeApplicationFont(id));
QCOMPARE(fontDbChangedSpy.count(), 2);

View File

@ -590,8 +590,15 @@ void tst_Http2::replyFinished()
{
QVERIFY(nRequests);
if (const auto reply = qobject_cast<QNetworkReply *>(sender()))
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
QCOMPARE(reply->error(), QNetworkReply::NoError);
const QVariant http2Used(reply->attribute(QNetworkRequest::HTTP2WasUsedAttribute));
QVERIFY(http2Used.isValid());
QVERIFY(http2Used.toBool());
const QVariant spdyUsed(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute));
QVERIFY(spdyUsed.isValid());
QVERIFY(!spdyUsed.toBool());
}
--nRequests;
if (!nRequests && serverGotSettingsACK)

View File

@ -52,6 +52,13 @@
#include <QtNetwork/qnetworksession.h>
#endif
#if defined(Q_OS_LINUX)
#define SHOULD_CHECK_SYSCALL_SUPPORT
#include <netinet/in.h>
#include <sys/socket.h>
#include <errno.h>
#endif
Q_DECLARE_METATYPE(QHostAddress)
QT_FORWARD_DECLARE_CLASS(QUdpSocket)
@ -115,6 +122,12 @@ protected slots:
void async_readDatagramSlot();
private:
bool shouldSkipIpv6TestsForBrokenSetsockopt();
#ifdef SHOULD_CHECK_SYSCALL_SUPPORT
bool ipv6SetsockoptionMissing(int level, int optname);
#endif
bool m_skipUnsupportedIPv6Tests;
QList<QHostAddress> allAddresses;
#ifndef QT_NO_BEARERMANAGEMENT
QNetworkConfigurationManager *netConfMan;
@ -125,6 +138,43 @@ private:
QUdpSocket *m_asyncReceiver;
};
#ifdef SHOULD_CHECK_SYSCALL_SUPPORT
bool tst_QUdpSocket::ipv6SetsockoptionMissing(int level, int optname)
{
int testSocket;
testSocket = socket(PF_INET6, SOCK_DGRAM, 0);
// If we can't test here, assume it's not missing
if (testSocket == -1)
return false;
bool result = false;
if (setsockopt(testSocket, level, optname, nullptr, 0) == -1)
if (errno == ENOPROTOOPT)
result = true;
close(testSocket);
return result;
}
#endif //SHOULD_CHECK_SYSCALL_SUPPORT
bool tst_QUdpSocket::shouldSkipIpv6TestsForBrokenSetsockopt()
{
#ifdef SHOULD_CHECK_SYSCALL_SUPPORT
// Following parameters for setsockopt are not supported by all QEMU versions:
if (ipv6SetsockoptionMissing(SOL_IPV6, IPV6_JOIN_GROUP)
|| ipv6SetsockoptionMissing(SOL_IPV6, IPV6_MULTICAST_HOPS)
|| ipv6SetsockoptionMissing(SOL_IPV6, IPV6_MULTICAST_IF)
|| ipv6SetsockoptionMissing(SOL_IPV6, IPV6_MULTICAST_LOOP)
|| ipv6SetsockoptionMissing(SOL_IPV6, IPV6_RECVHOPLIMIT)) {
return true;
}
#endif //SHOULD_CHECK_SYSCALL_SUPPORT
return false;
}
static QHostAddress makeNonAny(const QHostAddress &address, QHostAddress::SpecialAddress preferForAny = QHostAddress::LocalHost)
{
if (address == QHostAddress::Any)
@ -176,6 +226,7 @@ void tst_QUdpSocket::initTestCase()
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
allAddresses = QNetworkInterface::allAddresses();
m_skipUnsupportedIPv6Tests = shouldSkipIpv6TestsForBrokenSetsockopt();
}
void tst_QUdpSocket::init()
@ -1140,6 +1191,13 @@ void tst_QUdpSocket::multicastTtlOption()
expected = 0;
}
// Some syscalls needed for ipv6 udp multicasting are not functional
if (m_skipUnsupportedIPv6Tests) {
if (bindAddress.protocol() == QAbstractSocket::IPv6Protocol) {
QSKIP("Syscalls needed for ipv6 udp multicasting missing functionality");
}
}
QUdpSocket udpSocket;
#ifdef FORCE_SESSION
udpSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession));
@ -1186,6 +1244,13 @@ void tst_QUdpSocket::multicastLoopbackOption()
expected = 0;
}
// Some syscalls needed for ipv6 udp multicasting are not functional
if (m_skipUnsupportedIPv6Tests) {
if (bindAddress.protocol() == QAbstractSocket::IPv6Protocol) {
QSKIP("Syscalls needed for ipv6 udp multicasting missing functionality");
}
}
QUdpSocket udpSocket;
#ifdef FORCE_SESSION
udpSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession));
@ -1240,6 +1305,13 @@ void tst_QUdpSocket::multicastLeaveAfterClose()
if (!QtNetworkSettings::hasIPv6() && groupAddress.protocol() == QAbstractSocket::IPv6Protocol)
QSKIP("system doesn't support ipv6!");
// Some syscalls needed for ipv6 udp multicasting are not functional
if (m_skipUnsupportedIPv6Tests) {
if (groupAddress.protocol() == QAbstractSocket::IPv6Protocol) {
QSKIP("Syscalls needed for ipv6 udp multicasting missing functionality");
}
}
QUdpSocket udpSocket;
#ifdef FORCE_SESSION
udpSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession));
@ -1280,6 +1352,11 @@ void tst_QUdpSocket::setMulticastInterface()
QFETCH(QNetworkInterface, iface);
QFETCH(QHostAddress, address);
// Some syscalls needed for udp multicasting are not functional
if (m_skipUnsupportedIPv6Tests) {
QSKIP("Syscalls needed for udp multicasting missing functionality");
}
QUdpSocket udpSocket;
// bind initializes the socket
bool bound = udpSocket.bind((address.protocol() == QAbstractSocket::IPv6Protocol
@ -1339,6 +1416,13 @@ void tst_QUdpSocket::multicast()
return;
}
// Some syscalls needed for ipv6 udp multicasting are not functional
if (m_skipUnsupportedIPv6Tests) {
if (groupAddress.protocol() == QAbstractSocket::IPv6Protocol) {
QSKIP("Syscalls needed for ipv6 udp multicasting missing functionality");
}
}
QUdpSocket receiver;
#ifdef FORCE_SESSION
receiver.setProperty("_q_networksession", QVariant::fromValue(networkSession));

View File

@ -5,3 +5,5 @@ windows
rhel-7.2
[protocolServerSide:tls1.0-any]
rhel-7.2
[protocolServerSide]
osx-10.11

View File

@ -29,6 +29,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qthread.h>
#include <QtCore/qoperatingsystemversion.h>
#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qhostinfo.h>
#include <QtNetwork/qnetworkproxy.h>
@ -1170,6 +1171,19 @@ void tst_QSslSocket::protocolServerSide_data()
QTest::addColumn<QSsl::SslProtocol>("clientProtocol");
QTest::addColumn<bool>("works");
// On macOS 10.11 with SecureTransport backend some tests are failing for no
// obvious reason (so no bug in our code): QTBUG-48860 - an error can be
// errSSLInternal or cipher negotiation failure. This problem does not exist
// on macOS before 10.11 and after 10.11, so we adjust these tests only for 10.11.
#if defined(QT_SECURETRANSPORT)
using OSVersion = QOperatingSystemVersion;
const bool testWorks = OSVersion::current() < OSVersion::OSXElCapitan
|| OSVersion::current() > OSVersion::OSXElCapitan;
#else
const bool testWorks = true;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2
#endif
@ -1194,14 +1208,14 @@ void tst_QSslSocket::protocolServerSide_data()
#endif
#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-tls1.0") << QSsl::SslV3 << QSsl::TlsV1_0 << false;
QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true;
QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << testWorks;
QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << false;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a
// numerical IP, so OpenSSL will send a SSL 2 handshake
#elif !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true;
QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << testWorks;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)

View File

@ -1195,7 +1195,9 @@ void tst_QGL::currentFboSync()
QGLFramebufferObject::bindDefault();
QCOMPARE(fbo1.toImage(), fbo2Image);
// Convert the QGLFBO's result since QOpenGLFBO uses a wider
// variety of possible return formats.
QCOMPARE(fbo1.toImage().convertToFormat(fbo2Image.format()), fbo2Image);
}
{

View File

@ -45,3 +45,6 @@ SUBPROGRAMS = \
verifyexceptionthrown \
warnings \
xunit
INCLUDEPATH += ../../../../shared/
HEADERS += ../../../../shared/emulationdetector.h

View File

@ -36,6 +36,8 @@
#include <private/cycle_p.h>
#include "emulationdetector.h"
struct LoggerSet;
class tst_Selftests: public QObject
@ -550,6 +552,7 @@ static QProcessEnvironment processEnvironment()
|| key == QLatin1String("GRAPHICS_ROOT") || key == QLatin1String("TZ")
#elif defined(Q_OS_UNIX)
|| key == QLatin1String("HOME") || key == QLatin1String("USER") // Required for X11 on openSUSE
|| key == QLatin1String("QEMU_SET_ENV") || key == QLatin1String("QEMU_LD_PREFIX") // Required for QEMU
# if !defined(Q_OS_MAC)
|| key == QLatin1String("DISPLAY") || key == QLatin1String("XAUTHLOCALHOSTNAME")
|| key.startsWith(QLatin1String("XDG_"))
@ -641,6 +644,16 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
#ifdef Q_CC_MINGW
&& subdir != QLatin1String("blacklisted") // calls qFatal()
&& subdir != QLatin1String("silent") // calls qFatal()
#endif
#ifdef Q_OS_LINUX
// QEMU outputs to stderr about uncaught signals
&& (!EmulationDetector::isRunningArmOnX86() ||
(subdir != QLatin1String("blacklisted")
&& subdir != QLatin1String("silent")
&& subdir != QLatin1String("assert")
&& subdir != QLatin1String("crashes")
)
)
#endif
&& subdir != QLatin1String("benchlibcallgrind"))
QVERIFY2(err.isEmpty(), err.constData());

View File

@ -9,6 +9,7 @@ ubuntu-14.04
osx
[updateWhileMinimized]
ubuntu-14.04
ubuntu-16.04
rhel-7.1
rhel-7.2
osx

View File

@ -0,0 +1,119 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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 General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** 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-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef EMULATIONDETECTOR_H
#define EMULATIONDETECTOR_H
#if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM)
#define SHOULD_CHECK_ARM_ON_X86
#if QT_CONFIG(process) && !defined(QT_NO_REGULAREXPRESSION)
#include <QProcess>
#include <QRegularExpression>
#endif
#endif
QT_BEGIN_NAMESPACE
// Helper functions for detecting if running emulated
namespace EmulationDetector {
#ifdef SHOULD_CHECK_ARM_ON_X86
static bool isX86SpecificFileAvailable(void);
static bool isReportedArchitectureX86(void);
#endif
/*
* Check if we are running Arm binary on x86 machine.
*
* Currently this is only able to check on Linux. If not able to
* detect, return false.
*/
static bool isRunningArmOnX86()
{
#ifdef SHOULD_CHECK_ARM_ON_X86
if (isX86SpecificFileAvailable())
return true;
if (isReportedArchitectureX86())
return true;
#endif
return false;
}
#ifdef SHOULD_CHECK_ARM_ON_X86
/*
* Check if we can find a file that's only available on x86
*/
static bool isX86SpecificFileAvailable()
{
// MTRR (Memory Type Range Registers) are a feature of the x86 architecture
// and /proc/mtrr is only present (on Linux) for that family.
// However, it's an optional kernel feature, so the absence of the file is
// not sufficient to conclude we're on real hardware.
QFileInfo mtrr("/proc/mtrr");
if (mtrr.exists())
return true;
return false;
}
/*
* Check if architecture reported by the OS is x86
*/
static bool isReportedArchitectureX86(void)
{
#if QT_CONFIG(process) && !defined(QT_NO_REGULAREXPRESSION)
QProcess unamer;
QString machineString;
// Using syscall "uname" is not possible since that would be captured by
// QEMU and result would be the architecture being emulated (e.g. armv7l).
// By using QProcess we get the architecture used by the host.
unamer.start("uname -a");
if (!unamer.waitForFinished()) {
return false;
}
machineString = unamer.readAll();
// Is our current host cpu x86?
if (machineString.contains(QRegularExpression("i386|i686|x86"))) {
return true;
}
#endif
return false;
}
#endif // SHOULD_CHECK_ARM_ON_X86
} // EmulationDetector namespace
QT_END_NAMESPACE
#endif