Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10

This commit is contained in:
Liang Qi 2017-10-17 17:24:01 +00:00 committed by The Qt Project
commit 7e4571b7e7
55 changed files with 744 additions and 219 deletions

259
dist/changes-5.9.2 vendored Normal file
View File

@ -0,0 +1,259 @@
Qt 5.9.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.9.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- Building examples inside the Qt source tree while not building Qt itself
is rejected now, because this can cause hard to debug configuration
issues. If building isolated examples is needed, you may still use shadow
builds.
- This version of Qt restores compatibility with pre-5.9.0 calculation of
QCryptographicHash algorithms that were labelled "Sha3_nnn": that is,
applications compiled with old versions of Qt will continue using the
Keccak algorithm. Applications recompiled with this version will use
SHA-3, unless QT_SHA3_KECCAK_COMPAT is #define'd prior to #include
<QCryptographicHash>.
****************************************************************************
* General Notes *
****************************************************************************
Binary Compatibility Note
-------------------------
- The variable QOperatingSystemVersion::AndroidOreo was added in this
release. Code that uses this variable will not run under Qt 5.9.1. If
backwards compatibility is desired, use instead
QOperatingSystemVersion(QOperatingSystemVersion::Android, 8)
[This is similar to QOperatingSystemVersion::MacOSHighSierra added in
5.9.1]
- This version of Qt changes the values assigned to enumerations
QCryptographicHash::Sha3_nnn. Applications compiled with this version and
using those enumerations will not work with Qt 5.9.0 and 5.9.1, unless
QT_SHA3_KECCAK_COMPAT is defined.
Deprecation Notice
------------------
- Starting with Qt 5.10, IPv6 support will be mandatory for all platforms.
Systems without proper IPv6 support, such as the getaddrinfo() function
or the proper socket address structures, will not be able to build
QtNetwork anymore.
Third-Party Code
----------------
- [QTBUG-31020] zlib was updated to version 1.2.11.
- libpng was updated to version 1.6.32
****************************************************************************
* Library *
****************************************************************************
QtCore
------
- [QTBUG-61350] Fixed the conversion from string to double of the strings
"0E+1" and "0E-1" (with capital E), which QString::toDouble(),
QByteArray::toDouble() and similar functions reported as invalid.
- QFile:
* [QTBUG-57023] Reverted an incorrect change from Qt 5.9.0 that forbade
the creation and access to Alternate Data Streams on NTFS on Windows.
This means that file names containing a colon (':') are allowed again,
but note that they are not regular files.
- QFileInfo:
* [QTBUG-62802] Relative symbolic links on Windows are now resolved to
their absolute path by symLinkTarget().
- QFileSystemWatcher:
* [QTBUG-62242] Fixed a crash on Windows if this class was instantiated
before QCoreApplication was created.
* [QTBUG-61792] Fixed an issue on Windows that would cause this class not
to monitor files properly if the directory containing the monitored
files was added to the list of watched paths after the files.
- QLocale:
* [QTBUG-53565] Fixed the conversion of QTime to string form and parsing
from string form to always treat the value as the decimal fraction of
the seconds component. That is, the string format ".z" produces/parses
".2" for 200 milliseconds and ".002" for 2 milliseconds. Use of "z" or
"zzz" is discouraged outside decimal fractions to avoid surprises.
* [QTBUG-61949] Fixed bcp57Name() to return "en" for the QLocale::c()
locale. Previously, it returned "C", which is not a valid BCP47
language tag.
- QProcess:
* [QTBUG-61634] Added a workaround for a rare race-condition bug in
some C libraries that caused the child process started by QProcess to
hang after trying to launch a non-existent executable or change to a
non-existent directory.
* [QTBUG-62584] Fixed a race-condition bug that could cause
waitForXxx() functions to hang forever if a slot triggered by that
function futher started a nested event loop.
- QTimeZone:
* [QTBUG-63205] Fixed a bug that would cause QTimeZone to mis-parse
timezone files on Unix systems if they contained leap second
information.
- QVariant:
* [QTBUG-61471] Fixed QVariant to actually perform the conversions
between QVariantHash and QVariantMap in the respective .toHash() and
.toMap() functions. QVariant already reported true in .canConvert()
between those two types.
QtDBus
------
- [QTBUG-62284] Fixed a race condition in QDBusAbstractInterface that
could cause the class to never see the notification that the remote
service became available and cause isValid() to change to true.
QtGui
-----
- Text:
* [QTBUG-61520] Fixed matching of non-regular font weights for
application fonts on macOS.
QtNetwork
---------
- [QTBUG-61692] Fixed the handling of application-wide proxy settings (set
with QNetworkProxy): previously, QTcpSocket would directly fall back to
the system settings if the object-specific setting was
QNetworkProxy::DefaultProxy.
- QLocalSocket:
* [QTBUG-61643] Fixed an issue with Qt pipe-handling code that could
cause deadlocks on Windows, most often if the QLocalSocket object tried
to wait for more data during application shutdown.
QtTest
------
- Added flowId to messages when logging in TeamCity format. FlowId is used
to distinguish logging from multiple processes running in parallel.
QtWidgets
---------
- Android:
* [QTBUG-48639] Fixed label duplication for buttons when using style
sheets with the Android style.
- QLineEdit:
* [QTBUG-60319] Fixed behavior of the ImSurroundingText query.
Previously, it returned a masked text whose length may be less than
the cursor position. Now it returns unmasked text, so the text length
is always greater than or equal to the cursor position.
- QMenu:
* [QTBUG-59794] Fixed menu size issue when using high DPI on
multi-screen system.
****************************************************************************
* Compiler-specific Changes *
****************************************************************************
clang
-----
- [QTBUG-61840][QTBUG-62085] Fixed an issue that caused recent Clang
versions to print a warning about [[nodiscard].
Visual Studio
-------------
- [QTBUG-61902] Changed Qt uses of certain C++ Standard Library functions
that Visual Studio warns about. Now Qt public headers call
Microsoft-specific versions that do not produce warnings.
****************************************************************************
* Platform-specific Changes *
****************************************************************************
macOS
-----
- [QTBUG-59222] Switching focus objects inside a top level window while
composing text using dead keys or input method events would leave the
application in an inconsistent state. The composition now automatically
cancels when the focus object changes.
Windows
-------
- [QTBUG-57916] Fixed build with ANGLE and newer MinGW versions.
- [QTBUG-62083] Fixed Qt trying to steal certain events from user windows if
the event ID was WM_USER.
****************************************************************************
* Tools *
****************************************************************************
configure & build system
------------------------
- [QTBUG-35928][QTBUG-41908][Apple] Qt can now be built using just the
Xcode Command Line Tools, without needing to install the full Xcode IDE.
- [QTBUG-55755][Windows] All Qt .exe files now include meta information,
like .dll files already did.
- [QTBUG-58012] (Re-)added a way to specify alternative ICU libraries.
- [QTBUG-62150] Fixed detection of ICU in static builds.
- [QTBUG-53537][X11] Added missing detection of Xinerama.
- [QTBUG-61731][X11] Fixed detection of AT-SPI, allowing accessibility
support to be built again.
- [X11] Fixed detection of x11-xcb with pkg-config.
- [CMake] All Qt module defines are now propagated to the config files.
qmake
-----
- [QTBUG-31034] Added qmake feature and configure option to use ccache.
- [QTBUG-48342] Fixed generation of extraneous slashes in -project mode.
- [QTBUG-55633] Fixed misparsing of some string literal concatenations
as C++11 raw strings. This affects dependency scanning.
- [QTBUG-59301][Xcode] Fixed duplicate references in project files.
- [QTBUG-59827][nmake] The 'clean' target now deletes backup files of
MSVC manifests.
- [QTBUG-60455][Android] libc++ is now used instead of libstdc++ when
building with the android-clang mkspec.
- [QTBUG-60430][iOS] Fixed handling of the deprecated variable
QMAKE_IOS_TARGETED_DEVICE_FAMILY.
- [QTBUG-60899][WinRT] Fixed capability handling for Win10 targets.
- [WinRT] Added support for new Win10 capabilities.
- [QTBUG-61335][MinGW] Worked around LTO+MRI linker issue when cross-
building from Linux.
- [QTBUG-61411][Windows] _UNICODE is now defined, consistently with VS.
- [QTBUG-61688][MSVC] Fixed compilation of precompiled headers with
CONFIG+=silent. Done by removing redundant progress messages.
- [QTBUG-61690][QTBUG-61735] Fixed detection of compiler default search
paths for various compilers and platforms.
- [QTBUG-63197][Windows] Fixed moc'ing in a build directory with spaces
when INCLUDEPATH contains 40+ entries.
- [Android] Fixed building with ndkr16+ by using unified headers.
- [Windows] Fixed repeated installation of read-only files.
- [VS] Fixed deployment rules in created solution files.

View File

@ -129,6 +129,10 @@ PatternLineEdit::PatternLineEdit(QWidget *parent) :
connect(escapeSelectionAction, &QAction::triggered, this, &PatternLineEdit::escapeSelection);
connect(copyToCodeAction, &QAction::triggered, this, &PatternLineEdit::copyToCode);
connect(pasteFromCodeAction, &QAction::triggered, this, &PatternLineEdit::pasteFromCode);
#if !QT_CONFIG(clipboard)
copyToCodeAction->setEnabled(false);
pasteFromCodeAction->setEnabled(false);
#endif
}
void PatternLineEdit::escapeSelection()
@ -144,12 +148,16 @@ void PatternLineEdit::escapeSelection()
void PatternLineEdit::copyToCode()
{
#if QT_CONFIG(clipboard)
QGuiApplication::clipboard()->setText(patternToCode(text()));
#endif
}
void PatternLineEdit::pasteFromCode()
{
#if QT_CONFIG(clipboard)
setText(codeToPattern(QGuiApplication::clipboard()->text()));
#endif
}
void PatternLineEdit::contextMenuEvent(QContextMenuEvent *event)
@ -316,7 +324,7 @@ void RegularExpressionDialog::refresh()
void RegularExpressionDialog::copyEscapedPatternToClipboard()
{
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
QClipboard *clipboard = QGuiApplication::clipboard();
if (clipboard)
clipboard->setText(escapedPatternLineEdit->text());
@ -361,7 +369,7 @@ QWidget *RegularExpressionDialog::setupLeftUi()
palette.setBrush(QPalette::Base, palette.brush(QPalette::Disabled, QPalette::Base));
escapedPatternLineEdit->setPalette(palette);
#ifndef QT_NO_CLIPBOARD
#if QT_CONFIG(clipboard)
QAction *copyEscapedPatternAction = new QAction(this);
copyEscapedPatternAction->setText(tr("Copy to clipboard"));
copyEscapedPatternAction->setIcon(QIcon(QStringLiteral(":/images/copy.png")));

View File

@ -1,10 +1,5 @@
win32 {
cmake_version_output = $$system(cmake --version 2>NUL, lines)
} else {
cmake_version_output = $$system(cmake --version 2>/dev/null, lines)
}
cmake_version_output = $$system(cmake --version 2>$$QMAKE_SYSTEM_NULL_DEVICE, lines)
# First line
cmake_version_output = $$first(cmake_version_output)
# Format is "cmake version X.Y.Z"
@ -19,12 +14,7 @@ isEmpty(CMAKE_VERSION) {
return()
}
win32 {
CTEST_VERSION = $$system(ctest --version 2>NUL)
} else {
CTEST_VERSION = $$system(ctest --version 2>/dev/null)
}
CTEST_VERSION = $$system(ctest --version 2>$$QMAKE_SYSTEM_NULL_DEVICE)
isEmpty(CTEST_VERSION) {
message("ctest executable not found. Not running CMake unit tests")
return()

View File

@ -291,10 +291,7 @@ defineReplace(pkgConfigExecutable) {
}
}
equals(QMAKE_HOST.os, Windows): \
PKG_CONFIG += 2> NUL
else: \
PKG_CONFIG += 2> /dev/null
PKG_CONFIG += 2> $$QMAKE_SYSTEM_NULL_DEVICE
return($$PKG_CONFIG)
}

View File

@ -82,6 +82,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \
QMAKE_MKDIR = mkdir # legacy
QMAKE_MKDIR_CMD = if not exist %1 mkdir %1 & if not exist %1 exit 1
QMAKE_STREAM_EDITOR = $(QMAKE) -install sed
QMAKE_SHELL_NULL_DEVICE = NUL
QMAKE_INSTALL_FILE = copy /y
QMAKE_INSTALL_PROGRAM = copy /y
} else {
@ -101,6 +102,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \
QMAKE_MKDIR = mkdir -p # legacy
QMAKE_MKDIR_CMD = test -d %1 || mkdir -p %1
QMAKE_STREAM_EDITOR = sed
QMAKE_SHELL_NULL_DEVICE = /dev/null
equals(QMAKE_HOST.os, Windows) {
MINGW_IN_SHELL = 1 # legacy
@ -120,7 +122,9 @@ QMAKE_INSTALL_DIR = $$QMAKE_COPY_DIR
equals(QMAKE_HOST.os, Windows) {
QMAKE_SYMBOLIC_LINK = $(QMAKE) -install ln -f -s
QMAKE_LN_SHLIB = $(QMAKE) -install ln -s
QMAKE_SYSTEM_NULL_DEVICE = NUL
} else {
QMAKE_SYMBOLIC_LINK = ln -f -s
QMAKE_LN_SHLIB = ln -s
QMAKE_SYSTEM_NULL_DEVICE = /dev/null
}

View File

@ -32,15 +32,11 @@ isEmpty($${target_prefix}.INCDIRS) {
# Get default include and library paths from compiler
#
gcc {
!equals(QMAKE_HOST.os, Windows) {
cmd_prefix = "LC_ALL=C"
cmd_suffix = "</dev/null >/dev/null"
null_file = /dev/null
} else {
cmd_suffix = "<$$QMAKE_SYSTEM_NULL_DEVICE >$$QMAKE_SYSTEM_NULL_DEVICE"
equals(QMAKE_HOST.os, Windows): \
cmd_prefix = "set LC_ALL=C&"
cmd_suffix = "<NUL >NUL"
null_file = NUL
}
else: \
cmd_prefix = "LC_ALL=C"
cxx_flags = $$QMAKE_CXXFLAGS
@ -59,7 +55,7 @@ isEmpty($${target_prefix}.INCDIRS) {
rim_qcc: \
# Need the cc1plus and ld command lines to pick up the paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$QMAKE_SYSTEM_NULL_DEVICE -v
else: darwin:clang: \
# Need to link to pick up library paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v
@ -175,9 +171,8 @@ defineReplace(qtVariablesFromMSVC) {
}
defineReplace(qtVariablesFromGCC) {
null_device = /dev/null
equals(QMAKE_HOST.os, Windows): null_device = NUL
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$null_device 2>$$null_device", lines, ec)
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) \
<$$QMAKE_SYSTEM_NULL_DEVICE 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec)
!equals(ec, 0): qtCompilerErrror($$1)
return($$ret)
}

View File

@ -36,12 +36,6 @@
#include <stdlib.h>
#include <time.h>
#ifdef Q_OS_WIN
#define NULL_DEVICE "NUL"
#else
#define NULL_DEVICE "/dev/null"
#endif
QT_BEGIN_NAMESPACE
MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator()
@ -329,7 +323,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" <<var("QMAKE_PRE_LINK");
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" NULL_DEVICE;
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE");
if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
} else {

View File

@ -1,32 +1,32 @@
// Copyright (C) 2002-2013 The ANGLE Project Authors.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
// Ltd., nor the names of their contributors may be used to endorse
// or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2002-2013 The ANGLE Project Authors.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
Ltd., nor the names of their contributors may be used to endorse
or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,15 @@
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index 7f5e75921f..f5c6180a03 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -165733,6 +165733,10 @@ static int getNodeSize(
rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
if( rc!=SQLITE_OK ){
*pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
+ }else if( pRtree->iNodeSize<(512-64) ){
+ rc = SQLITE_CORRUPT;
+ *pzErr = sqlite3_mprintf("undersize RTree blobs in \"%q_node\"",
+ pRtree->zName);
}
}

View File

@ -165733,6 +165733,10 @@ static int getNodeSize(
rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
if( rc!=SQLITE_OK ){
*pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
}else if( pRtree->iNodeSize<(512-64) ){
rc = SQLITE_CORRUPT;
*pzErr = sqlite3_mprintf("undersize RTree blobs in \"%q_node\"",
pRtree->zName);
}
}

View File

@ -585,7 +585,7 @@ angle_d3d11: SHADERS = VS_Passthrough2D \
for (SHADER, SHADERS) {
INPUT = $$eval($${SHADER}.input)
OUT_DIR = $$OUT_PWD/libANGLE/$$relative_path($$dirname($$INPUT), $$ANGLE_DIR/src/libANGLE)/compiled
fxc_$${SHADER}.commands = $$FXC /nologo /E $${SHADER} /T $$eval($${SHADER}.type) /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
fxc_$${SHADER}.commands = $$FXC -nologo -E $${SHADER} -T $$eval($${SHADER}.type) -Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
fxc_$${SHADER}.output = $$OUT_DIR/$$eval($${SHADER}.output)
fxc_$${SHADER}.input = $$INPUT
fxc_$${SHADER}.dependency_type = TYPE_C

View File

@ -99,8 +99,6 @@ gcc:ltcg {
SOURCES += $$VERSIONTAGGING_SOURCES
}
# On AARCH64 the fp16 extension is mandatory, so we don't need the conversion tables.
!contains(QT_ARCH, "arm64") {
QMAKE_QFLOAT16_TABLES_GENERATE = global/qfloat16.h
qtPrepareTool(QMAKE_QFLOAT16_TABLES, qfloat16-tables)
@ -111,4 +109,3 @@ gcc:ltcg {
qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE
qfloat16_tables.variable_out = SOURCES
QMAKE_EXTRA_COMPILERS += qfloat16_tables
}

View File

@ -499,9 +499,10 @@ public:
InvalidFragmentError = Fragment << 8,
// the following two cases are only possible in combination
// with presence/absence of the authority and scheme. See validityError().
// the following three cases are only possible in combination with
// presence/absence of the path, authority and scheme. See validityError().
AuthorityPresentAndPathIsRelative = Authority << 8 | Path << 8 | 0x10000,
AuthorityAbsentAndPathIsDoubleSlash,
RelativeUrlPathContainsColonBeforeSlash = Scheme << 8 | Authority << 8 | Path << 8 | 0x10000,
NoError = 0
@ -1627,19 +1628,32 @@ inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, int *p
return error->code;
}
// There are two more cases of invalid URLs that QUrl recognizes and they
// There are three more cases of invalid URLs that QUrl recognizes and they
// are only possible with constructed URLs (setXXX methods), not with
// parsing. Therefore, they are tested here.
//
// The two cases are a non-empty path that doesn't start with a slash and:
// Two cases are a non-empty path that doesn't start with a slash and:
// - with an authority
// - without an authority, without scheme but the path with a colon before
// the first slash
// The third case is an empty authority and a non-empty path that starts
// with "//".
// Those cases are considered invalid because toString() would produce a URL
// that wouldn't be parsed back to the same QUrl.
if (path.isEmpty() || path.at(0) == QLatin1Char('/'))
if (path.isEmpty())
return NoError;
if (path.at(0) == QLatin1Char('/')) {
if (sectionIsPresent & QUrlPrivate::Authority || port != -1 ||
path.length() == 1 || path.at(1) != QLatin1Char('/'))
return NoError;
if (source) {
*source = path;
*position = 0;
}
return AuthorityAbsentAndPathIsDoubleSlash;
}
if (sectionIsPresent & QUrlPrivate::Host) {
if (source) {
*source = path;
@ -2514,10 +2528,7 @@ void QUrl::setPath(const QString &path, ParsingMode mode)
mode = TolerantMode;
}
int from = 0;
while (from < data.length() - 2 && data.midRef(from, 2) == QLatin1String("//"))
++from;
d->setPath(data, from, data.length());
d->setPath(data, 0, data.length());
// optimized out, since there is no path delimiter
// if (path.isNull())
@ -3989,6 +4000,8 @@ static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &err
case QUrlPrivate::AuthorityPresentAndPathIsRelative:
return QStringLiteral("Path component is relative and authority is present");
case QUrlPrivate::AuthorityAbsentAndPathIsDoubleSlash:
return QStringLiteral("Path component starts with '//' and authority is absent");
case QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash:
return QStringLiteral("Relative URL's path component contains ':' before any '/'");
}

View File

@ -170,10 +170,10 @@ QT_BEGIN_NAMESPACE
\value LeaveEditFocus An editor widget loses focus for editing. QT_KEYPAD_NAVIGATION must be defined.
\value LeaveWhatsThisMode Send to toplevel widgets when the application leaves "What's This?" mode.
\value LocaleChange The system locale has changed.
\value NonClientAreaMouseButtonDblClick A mouse double click occurred outside the client area.
\value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area.
\value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area.
\value NonClientAreaMouseMove A mouse move occurred outside the client area.
\value NonClientAreaMouseButtonDblClick A mouse double click occurred outside the client area (QMouseEvent).
\value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area (QMouseEvent).
\value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area (QMouseEvent).
\value NonClientAreaMouseMove A mouse move occurred outside the client area (QMouseEvent).
\value MacSizeChange The user changed his widget sizes (\macos only).
\value MetaCall An asynchronous method invocation via QMetaObject::invokeMethod().
\value ModifiedChange Widgets modification state has been changed.

View File

@ -73,7 +73,7 @@ public:
\internal
*/
QThreadPoolThread::QThreadPoolThread(QThreadPoolPrivate *manager)
:manager(manager), runnable(0)
:manager(manager), runnable(nullptr)
{
setStackSize(manager->stackSize);
}
@ -86,7 +86,7 @@ void QThreadPoolThread::run()
QMutexLocker locker(&manager->mutex);
for(;;) {
QRunnable *r = runnable;
runnable = 0;
runnable = nullptr;
do {
if (r) {
@ -118,8 +118,19 @@ void QThreadPoolThread::run()
if (manager->tooManyThreadsActive())
break;
r = !manager->queue.isEmpty() ? manager->queue.takeFirst().first : 0;
} while (r != 0);
if (manager->queue.isEmpty()) {
r = nullptr;
break;
}
QueuePage *page = manager->queue.first();
r = page->pop();
if (page->isFinished()) {
manager->queue.removeFirst();
delete page;
}
} while (true);
if (manager->isExiting) {
registerThreadInactive();
@ -160,6 +171,7 @@ QThreadPoolPrivate:: QThreadPoolPrivate()
bool QThreadPoolPrivate::tryStart(QRunnable *task)
{
Q_ASSERT(task != nullptr);
if (allThreads.isEmpty()) {
// always create at least one thread
startThread(task);
@ -180,7 +192,7 @@ bool QThreadPoolPrivate::tryStart(QRunnable *task)
if (!expiredThreads.isEmpty()) {
// restart an expired thread
QThreadPoolThread *thread = expiredThreads.dequeue();
Q_ASSERT(thread->runnable == 0);
Q_ASSERT(thread->runnable == nullptr);
++activeThreads;
@ -196,22 +208,25 @@ bool QThreadPoolPrivate::tryStart(QRunnable *task)
return true;
}
inline bool operator<(int priority, const QPair<QRunnable *, int> &p)
{ return p.second < priority; }
inline bool operator<(const QPair<QRunnable *, int> &p, int priority)
{ return priority < p.second; }
inline bool comparePriority(int priority, const QueuePage *p)
{
return p->priority() < priority;
}
void QThreadPoolPrivate::enqueueTask(QRunnable *runnable, int priority)
{
Q_ASSERT(runnable != nullptr);
if (runnable->autoDelete())
++runnable->ref;
// put it on the queue
QVector<QPair<QRunnable *, int> >::const_iterator begin = queue.constBegin();
QVector<QPair<QRunnable *, int> >::const_iterator it = queue.constEnd();
if (it != begin && priority > (*(it - 1)).second)
it = std::upper_bound(begin, --it, priority);
queue.insert(it - begin, qMakePair(runnable, priority));
for (QueuePage *page : qAsConst(queue)) {
if (page->priority() == priority && !page->isFull()) {
page->push(runnable);
return;
}
}
auto it = std::upper_bound(queue.constBegin(), queue.constEnd(), priority, comparePriority);
queue.insert(std::distance(queue.constBegin(), it), new QueuePage(runnable, priority));
}
int QThreadPoolPrivate::activeThreadCount() const
@ -225,8 +240,18 @@ int QThreadPoolPrivate::activeThreadCount() const
void QThreadPoolPrivate::tryToStartMoreThreads()
{
// try to push tasks on the queue to any available threads
while (!queue.isEmpty() && tryStart(queue.constFirst().first))
while (!queue.isEmpty()) {
QueuePage *page = queue.first();
if (!tryStart(page->first()))
break;
page->pop();
if (page->isFinished()) {
queue.removeFirst();
delete page;
}
}
}
bool QThreadPoolPrivate::tooManyThreadsActive() const
@ -240,6 +265,7 @@ bool QThreadPoolPrivate::tooManyThreadsActive() const
*/
void QThreadPoolPrivate::startThread(QRunnable *runnable)
{
Q_ASSERT(runnable != nullptr);
QScopedPointer <QThreadPoolThread> thread(new QThreadPoolThread(this));
thread->setObjectName(QLatin1String("Thread (pooled)"));
Q_ASSERT(!allThreads.contains(thread.data())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here)
@ -303,12 +329,14 @@ bool QThreadPoolPrivate::waitForDone(int msecs)
void QThreadPoolPrivate::clear()
{
QMutexLocker locker(&mutex);
for (QVector<QPair<QRunnable *, int> >::const_iterator it = queue.constBegin();
it != queue.constEnd(); ++it) {
QRunnable* r = it->first;
if (r->autoDelete() && !--r->ref)
for (QueuePage *page : qAsConst(queue)) {
while (!page->isFinished()) {
QRunnable *r = page->pop();
if (r && r->autoDelete() && !--r->ref)
delete r;
}
}
qDeleteAll(queue);
queue.clear();
}
@ -333,22 +361,21 @@ bool QThreadPool::tryTake(QRunnable *runnable)
{
Q_D(QThreadPool);
if (runnable == 0)
if (runnable == nullptr)
return false;
{
QMutexLocker locker(&d->mutex);
auto it = d->queue.begin();
auto end = d->queue.end();
while (it != end) {
if (it->first == runnable) {
d->queue.erase(it);
for (QueuePage *page : qAsConst(d->queue)) {
if (page->tryTake(runnable)) {
if (page->isFinished()) {
d->queue.removeOne(page);
delete page;
}
if (runnable->autoDelete())
--runnable->ref; // undo ++ref in start()
return true;
}
++it;
}
}

View File

@ -63,6 +63,87 @@
QT_BEGIN_NAMESPACE
class QueuePage {
public:
enum {
MaxPageSize = 256
};
QueuePage(QRunnable *runnable, int pri)
: m_priority(pri)
{
push(runnable);
}
bool isFull() {
return m_lastIndex >= MaxPageSize - 1;
}
bool isFinished() {
return m_firstIndex > m_lastIndex;
}
void push(QRunnable *runnable) {
Q_ASSERT(runnable != nullptr);
Q_ASSERT(!isFull());
m_lastIndex += 1;
m_entries[m_lastIndex] = runnable;
}
void skipToNextOrEnd() {
while (!isFinished() && m_entries[m_firstIndex] == nullptr) {
m_firstIndex += 1;
}
}
QRunnable *first() {
Q_ASSERT(!isFinished());
QRunnable *runnable = m_entries[m_firstIndex];
Q_ASSERT(runnable);
return runnable;
}
QRunnable *pop() {
Q_ASSERT(!isFinished());
QRunnable *runnable = first();
Q_ASSERT(runnable);
// clear the entry although this should not be necessary
m_entries[m_firstIndex] = nullptr;
m_firstIndex += 1;
// make sure the next runnable returned by first() is not a nullptr
skipToNextOrEnd();
return runnable;
}
bool tryTake(QRunnable *runnable) {
Q_ASSERT(!isFinished());
for (int i = m_firstIndex; i <= m_lastIndex; i++) {
if (m_entries[i] == runnable) {
m_entries[i] = nullptr;
if (i == m_firstIndex) {
// make sure first() does not return a nullptr
skipToNextOrEnd();
}
return true;
}
}
return false;
}
int priority() const {
return m_priority;
}
private:
int m_priority = 0;
int m_firstIndex = 0;
int m_lastIndex = -1;
QRunnable *m_entries[MaxPageSize];
};
class QThreadPoolThread;
class Q_CORE_EXPORT QThreadPoolPrivate : public QObjectPrivate
{
@ -84,12 +165,13 @@ public:
bool waitForDone(int msecs);
void clear();
void stealAndRunRunnable(QRunnable *runnable);
void deletePageIfFinished(QueuePage *page);
mutable QMutex mutex;
QList<QThreadPoolThread *> allThreads;
QQueue<QThreadPoolThread *> waitingThreads;
QQueue<QThreadPoolThread *> expiredThreads;
QVector<QPair<QRunnable *, int> > queue;
QVector<QueuePage*> queue;
QWaitCondition noActiveThreads;
int expiryTimeout = 30000;

View File

@ -195,7 +195,7 @@ QT_BEGIN_NAMESPACE
\inmodule QtDBus
\brief Information about one interface on the bus.
Each interface on D-Bus has an unique \a name, identifying where that interface was defined.
Each interface on D-Bus has a unique \a name, identifying where that interface was defined.
Interfaces may have annotations, methods, signals and properties, but none are mandatory.
*/

View File

@ -216,7 +216,6 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock)
void QDBusMetaType::registerMarshallOperators(int id, MarshallFunction mf,
DemarshallFunction df)
{
QByteArray var;
QVector<QDBusCustomTypeInfo> *ct = customTypes();
if (id < 0 || !mf || !df || !ct)
return; // error!

View File

@ -1124,7 +1124,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
The event is propagated up the parent widget chain until a widget
accepts it or an event filter consumes it.
The QWidget::setEnable() function can be used to enable or disable
The QWidget::setEnabled() function can be used to enable or disable
mouse and keyboard events for a widget.
The event handlers QWidget::keyPressEvent(), QWidget::keyReleaseEvent(),

View File

@ -5572,6 +5572,8 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
if (end <= start)
continue;
Q_ASSERT(end - start <= buffer_size);
QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);
@ -5845,6 +5847,8 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
if (end <= start)
continue;
Q_ASSERT(end - start <= buffer_size);
QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);

View File

@ -1638,7 +1638,7 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
QPointF p = lines[i].p1();
QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()),
QPointF(p.x() + width*0.5, p.y())));
d->rasterizer->rasterizeLine(line.p1(), line.p2(), 1);
d->rasterizer->rasterizeLine(line.p1(), line.p2(), width / line.length());
}
continue;
}

View File

@ -6261,6 +6261,8 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
if (theme)
underlineStyle = QTextCharFormat::UnderlineStyle(theme->themeHint(QPlatformTheme::SpellCheckUnderlineStyle).toInt());
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) // still not resolved
underlineStyle = QTextCharFormat::WaveUnderline;
}
if (underlineStyle == QTextCharFormat::WaveUnderline) {

View File

@ -1147,8 +1147,6 @@ void QDashStroker::processCurrentSubpath()
QLineF cline;
QPainterPath dashPath;
QSubpathFlatIterator it(&m_elements, m_dashThreshold);
qfixed2d prev = it.next();

View File

@ -381,7 +381,6 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
}
if (image.isNull()) {
QString context;
if (image.isNull()) { // try direct loading
name = imageFormat.name(); // remove qrc:/ prefix again
image.load(name);

View File

@ -1051,10 +1051,12 @@ void QGridLayoutEngine::setGeometries(const QRectF &contentsGeometry, const QAbs
if (m_snapToPixelGrid) {
// x and y should already be rounded, but the call to geometryWithin() above might
// result in a geom with x,y at half-pixels (due to centering within the cell)
geom.setX(qround(geom.x()));
// QRectF may change the width as it wants to maintain the right edge. In this
// case the width need to be preserved.
geom.moveLeft(qround(geom.x()));
// Do not snap baseline aligned items, since that might cause the baselines to not be aligned.
if (align != Qt::AlignBaseline)
geom.setY(qround(geom.y()));
geom.moveTop(qround(geom.y()));
}
visualRect(&geom, visualDirection(), contentsGeometry);
item->setGeometry(geom);

View File

@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
// internal helper. Converts an integer value to an unique string token
// internal helper. Converts an integer value to a unique string token
template <typename T>
struct HexString
{

View File

@ -600,7 +600,8 @@ void QHttpNetworkConnectionChannel::handleStatus()
case 302:
case 303:
case 305:
case 307: {
case 307:
case 308: {
// Parse the response headers and get the "location" url
QUrl redirectUrl = connection->d_func()->parseRedirectResponse(socket, reply);
if (redirectUrl.isValid())

View File

@ -96,7 +96,7 @@ void QHttpNetworkReply::setRedirectUrl(const QUrl &url)
bool QHttpNetworkReply::isHttpRedirect(int statusCode)
{
return (statusCode == 301 || statusCode == 302 || statusCode == 303
|| statusCode == 305 || statusCode == 307);
|| statusCode == 305 || statusCode == 307 || statusCode == 308);
}
qint64 QHttpNetworkReply::contentLength() const

View File

@ -297,7 +297,7 @@ QNetworkReplyPrivate::QNetworkReplyPrivate()
This signal is emitted if the QNetworkRequest::FollowRedirectsAttribute was
set in the request and the server responded with a 3xx status (specifically
301, 302, 303, 305 or 307 status code) with a valid url in the location
301, 302, 303, 305, 307 or 308 status code) with a valid url in the location
header, indicating a HTTP redirect. The \a url parameter contains the new
redirect url as returned by the server in the location header.

View File

@ -1204,6 +1204,7 @@ void QNetworkReplyHttpImplPrivate::checkForRedirect(const int statusCode)
case 302: // Found
case 303: // See Other
case 307: // Temporary Redirect
case 308: // Permanent Redirect
// What do we do about the caching of the HTML note?
// The response to a 303 MUST NOT be cached, while the response to
// all of the others is cacheable if the headers indicate it to be

View File

@ -463,49 +463,6 @@ QHostAddress::QHostAddress(SpecialAddress address)
setAddress(address);
}
/*!
\overload
\since 5.8
Sets the special address specified by \a address.
*/
void QHostAddress::setAddress(SpecialAddress address)
{
d->clear();
Q_IPV6ADDR ip6;
memset(&ip6, 0, sizeof ip6);
quint32 ip4 = INADDR_ANY;
switch (address) {
case Null:
return;
case Broadcast:
ip4 = INADDR_BROADCAST;
break;
case LocalHost:
ip4 = INADDR_LOOPBACK;
break;
case AnyIPv4:
break;
case LocalHostIPv6:
ip6[15] = 1;
Q_FALLTHROUGH();
case AnyIPv6:
d->setAddress(ip6);
return;
case Any:
d->protocol = QAbstractSocket::AnyIPProtocol;
return;
}
// common IPv4 part
d->setAddress(ip4);
}
/*!
Destroys the host address object.
*/
@ -669,6 +626,49 @@ void QHostAddress::setAddress(const struct sockaddr *sockaddr)
#endif
}
/*!
\overload
\since 5.8
Sets the special address specified by \a address.
*/
void QHostAddress::setAddress(SpecialAddress address)
{
clear();
Q_IPV6ADDR ip6;
memset(&ip6, 0, sizeof ip6);
quint32 ip4 = INADDR_ANY;
switch (address) {
case Null:
return;
case Broadcast:
ip4 = INADDR_BROADCAST;
break;
case LocalHost:
ip4 = INADDR_LOOPBACK;
break;
case AnyIPv4:
break;
case LocalHostIPv6:
ip6[15] = 1;
Q_FALLTHROUGH();
case AnyIPv6:
d->setAddress(ip6);
return;
case Any:
d->protocol = QAbstractSocket::AnyIPProtocol;
return;
}
// common IPv4 part
d->setAddress(ip4);
}
/*!
Returns the IPv4 address as a number.

View File

@ -124,9 +124,7 @@ QT_BEGIN_NAMESPACE
\row \li Linux \li Supported \li Supported \li Supported
\row \li OS X \li Supported \li Supported \li Only for IPv6
\row \li Other Unix supporting RFC 3542 \li Only for IPv6 \li Only for IPv6 \li Only for IPv6
\row \li Windows XP and older \li Not supported \li Not supported \li Not supported
\row \li Windows Vista & up \li Supported \li Supported \li Supported
\row \li Windows CE \li Not supported \li Not supported \li Not supported
\row \li Windows (desktop) \li Supported \li Supported \li Supported
\row \li Windows RT \li Not supported \li Not supported \li Not supported
\endtable

View File

@ -454,9 +454,11 @@ QNetworkDatagram QUdpSocket::receiveDatagram(qint64 maxSize)
QAbstractSocketEngine::WantAll);
d->hasPendingData = false;
d->socketEngine->setReadNotificationEnabled(true);
if (readBytes < 0)
if (readBytes < 0) {
d->setErrorAndEmit(d->socketEngine->error(), d->socketEngine->errorString());
else if (readBytes != result.d->data.size())
readBytes = 0;
}
result.d->data.truncate(readBytes);
return result;
}

View File

@ -92,7 +92,7 @@ EphemeralSecKeychain::EphemeralSecKeychain()
{
const auto uuid = QUuid::createUuid();
if (uuid.isNull()) {
qCWarning(lcSsl) << "Failed to create an unique keychain name";
qCWarning(lcSsl) << "Failed to create a unique keychain name";
return;
}

View File

@ -666,7 +666,7 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f)
return kCTFontUIFontSystem;
case QPlatformTheme::TipLabelFont:
return kCTFontToolTipFontType;
return kCTFontUIFontToolTip;
case QPlatformTheme::StatusBarFont:
return kCTFontUIFontSystem;

View File

@ -1980,12 +1980,6 @@ QFont QWindowsFontDatabase::systemDefaultFont()
// long deprecated; the message font of the NONCLIENTMETRICS structure obtained by
// SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be used instead (see
// QWindowsTheme::refreshFonts(), typically "Segoe UI, 9pt"), which is larger.
// In single monitor setups, the point sizes revolve around 8 (depending on UI
// scale factor, but not proportional to it). However, in multi monitor setups,
// where the DPI of the primary monitor are smaller than those of the secondary,
// large bogus values are returned. Limit to 8.25 in that case.
if (GetSystemMetrics(SM_CMONITORS) > 1 && systemFont.pointSizeF() > 8.25)
systemFont.setPointSizeF(8.25);
#endif // Qt 5
qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
return systemFont;

View File

@ -450,6 +450,17 @@ static jboolean startQtAndroidPlugin(JNIEnv* /*env*/, jobject /*object*//*, jobj
static void *startMainMethod(void */*data*/)
{
{
JNIEnv* env = nullptr;
JavaVMAttachArgs args;
args.version = JNI_VERSION_1_6;
args.name = "QtMainThread";
args.group = NULL;
JavaVM *vm = QtAndroidPrivate::javaVM();
if (vm != 0)
vm->AttachCurrentThread(&env, &args);
}
QVarLengthArray<const char *> params(m_applicationParams.size());
for (int i = 0; i < m_applicationParams.size(); i++)
params[i] = static_cast<const char *>(m_applicationParams[i].constData());

View File

@ -1670,6 +1670,7 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
if (!m_drawContentBorderGradient) {
window.styleMask = window.styleMask & ~NSTexturedBackgroundWindowMask;
[window.contentView.superview setNeedsDisplay:YES];
window.titlebarAppearsTransparent = NO;
return;
}
@ -1694,6 +1695,7 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
int effectiveBottomContentBorderThickness = m_bottomContentBorderThickness;
[window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask];
window.titlebarAppearsTransparent = YES;
[window setContentBorderThickness:effectiveTopContentBorderThickness forEdge:NSMaxYEdge];
[window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];

View File

@ -899,7 +899,7 @@ void QWindowsBaseWindow::raise_sys()
const Qt::WindowType type = window()->type();
if (type == Qt::Popup
|| type == Qt::SubWindow // Special case for QTBUG-63121: MDI subwindows with WindowStaysOnTopHint
|| (window()->flags() & (Qt::WindowStaysOnTopHint | Qt::WindowStaysOnBottomHint)) == 0) {
|| !(window()->flags() & Qt::WindowStaysOnBottomHint)) {
SetWindowPos(handle(), HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}
}
@ -907,7 +907,7 @@ void QWindowsBaseWindow::raise_sys()
void QWindowsBaseWindow::lower_sys()
{
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window();
if ((window()->flags() & (Qt::WindowStaysOnTopHint | Qt::WindowStaysOnBottomHint)) == 0)
if (!(window()->flags() & Qt::WindowStaysOnTopHint))
SetWindowPos(handle(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}

View File

@ -78,6 +78,16 @@ QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t d
&& visual->green_mask == 0xff00 && visual->blue_mask == 0xff)
return QImage::Format_RGB32;
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
if (depth == 24 && format->bits_per_pixel == 32 && visual->blue_mask == 0xff0000
&& visual->green_mask == 0xff00 && visual->red_mask == 0xff)
return QImage::Format_RGBX8888;
} else {
if (depth == 24 && format->bits_per_pixel == 32 && visual->blue_mask == 0xff00
&& visual->green_mask == 0xff0000 && visual->red_mask == 0xff000000)
return QImage::Format_RGBX8888;
}
if (depth == 16 && format->bits_per_pixel == 16 && visual->red_mask == 0xf800
&& visual->green_mask == 0x7e0 && visual->blue_mask == 0x1f)
return QImage::Format_RGB16;
@ -123,8 +133,9 @@ QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap
}
break;
}
case QImage::Format_RGB32: // fall-through
case QImage::Format_ARGB32_Premultiplied: {
case QImage::Format_RGB32:
case QImage::Format_ARGB32_Premultiplied:
case QImage::Format_RGBX8888: {
uint *p = (uint*)image.scanLine(i);
uint *end = p + image.width();
while (p < end) {
@ -141,7 +152,7 @@ QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap
}
// fix-up alpha channel
if (format == QImage::Format_RGB32) {
if (format == QImage::Format_RGB32 || format == QImage::Format_RGBX8888) {
QRgb *p = (QRgb *)image.bits();
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x)

View File

@ -293,7 +293,7 @@ void QCupsPrintEnginePrivate::changePrinter(const QString &newPrinter)
// Try create the printer, only use it if it returns valid
QPrintDevice printDevice = ps->createPrintDevice(newPrinter);
if (!m_printDevice.isValid())
if (!printDevice.isValid())
return;
m_printDevice.swap(printDevice);
printerName = m_printDevice.id();

View File

@ -70,7 +70,7 @@ void WriteDeclaration::acceptUI(DomUI *node)
QString qualifiedClassName = node->elementClass() + m_option.postfix;
QString className = qualifiedClassName;
QString varName = m_driver->findOrInsertWidget(node->elementWidget());
m_driver->findOrInsertWidget(node->elementWidget());
QString widgetClassName = node->elementWidget()->attributeClass();
QString exportMacro = node->elementExportMacro();

View File

@ -925,7 +925,6 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap
scaledRadius /= scale;
QImage srcImage;
QImage destImage;
if (srcRect == src.rect()) {
srcImage = src.toImage();

View File

@ -278,7 +278,6 @@ void drawDial(const QStyleOptionSlider *option, QPainter *painter)
buttonColor.setHsv(buttonColor .hue(),
qMin(140, buttonColor .saturation()),
qMax(180, buttonColor.value()));
QColor shadowColor(0, 0, 0, 20);
if (enabled) {
// Drop shadow

View File

@ -119,7 +119,9 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
QMouseEvent *e = static_cast<QMouseEvent *>(ee);
if (w->isMaximized())
break;
if (!widget->rect().contains(widget->mapFromGlobal(e->globalPos())))
const QRect widgetRect = widget->rect().marginsAdded(QMargins(range, range, range, range));
const QPoint cursorPoint = widget->mapFromGlobal(e->globalPos());
if (!widgetRect.contains(cursorPoint) || mode == Center || mode == Nowhere)
return false;
if (e->button() == Qt::LeftButton) {
#if 0 // Used to be included in Qt4 for Q_WS_X11

View File

@ -2057,6 +2057,14 @@ void tst_QUrl::isValid()
QVERIFY(url.errorString().contains("Path component is relative and authority is present"));
}
{
QUrl url("http:");
url.setPath("//example.com");
QVERIFY(!url.isValid());
QVERIFY(url.toString().isEmpty());
QVERIFY(url.errorString().contains("Path component starts with '//' and authority is absent"));
}
{
QUrl url;
url.setPath("http://example.com");
@ -3632,12 +3640,12 @@ void tst_QUrl::setComponents_data()
QTest::newRow("path-%3A-before-slash") << QUrl()
<< int(Path) << "c%3A/" << Tolerant << true
<< PrettyDecoded << "c%3A/" << "c%3A/";
QTest::newRow("path-doubleslash") << QUrl("trash:/")
QTest::newRow("path-doubleslash") << QUrl("http://example.com")
<< int(Path) << "//path" << Tolerant << true
<< PrettyDecoded << "/path" << "trash:/path";
<< PrettyDecoded << "//path" << "http://example.com//path";
QTest::newRow("path-withdotdot") << QUrl("file:///tmp")
<< int(Path) << "//tmp/..///root/." << Tolerant << true
<< PrettyDecoded << "/tmp/..///root/." << "file:///tmp/..///root/.";
<< PrettyDecoded << "//tmp/..///root/." << "file:////tmp/..///root/.";
// the other fields can be present and be empty
// that is, their delimiters would be present, but there would be nothing to one side
@ -3760,6 +3768,9 @@ void tst_QUrl::setComponents_data()
QTest::newRow("invalid-path-2") << QUrl("http://example.com")
<< int(Path) << "relative" << Strict << false
<< PrettyDecoded << "relative" << "";
QTest::newRow("invalid-path-3") << QUrl("trash:/")
<< int(Path) << "//path" << Tolerant << false
<< PrettyDecoded << "//path" << "";
// -- test bad percent encoding --
// unnecessary to test the scheme, since percent-decoding is not performed in it;

View File

@ -94,6 +94,7 @@ private slots:
void destroyingWaitsForTasksToFinish();
void stackSize();
void stressTest();
void takeAllAndIncreaseMaxThreadCount();
private:
QMutex m_functionTestMutex;
@ -1203,5 +1204,68 @@ void tst_QThreadPool::stressTest()
}
}
void tst_QThreadPool::takeAllAndIncreaseMaxThreadCount() {
class Task : public QRunnable
{
public:
Task(QSemaphore *mainBarrier, QSemaphore *threadBarrier)
: m_mainBarrier(mainBarrier)
, m_threadBarrier(threadBarrier)
{
setAutoDelete(false);
}
void run() {
m_mainBarrier->release();
m_threadBarrier->acquire();
}
private:
QSemaphore *m_mainBarrier;
QSemaphore *m_threadBarrier;
};
QSemaphore mainBarrier;
QSemaphore taskBarrier;
QThreadPool threadPool;
threadPool.setMaxThreadCount(1);
Task *task1 = new Task(&mainBarrier, &taskBarrier);
Task *task2 = new Task(&mainBarrier, &taskBarrier);
Task *task3 = new Task(&mainBarrier, &taskBarrier);
threadPool.start(task1);
threadPool.start(task2);
threadPool.start(task3);
mainBarrier.acquire(1);
QCOMPARE(threadPool.activeThreadCount(), 1);
QVERIFY(!threadPool.tryTake(task1));
QVERIFY(threadPool.tryTake(task2));
QVERIFY(threadPool.tryTake(task3));
// A bad queue implementation can segfault here because two consecutive items in the queue
// have been taken
threadPool.setMaxThreadCount(4);
// Even though we increase the max thread count, there should only be one job to run
QCOMPARE(threadPool.activeThreadCount(), 1);
// Make sure jobs 2 and 3 never started
QCOMPARE(mainBarrier.available(), 0);
taskBarrier.release(1);
threadPool.waitForDone();
QCOMPARE(threadPool.activeThreadCount(), 0);
delete task1;
delete task2;
delete task3;
}
QTEST_MAIN(tst_QThreadPool);
#include "tst_qthreadpool.moc"

View File

@ -7,4 +7,4 @@ windows
[openGLPaintDevice]
windows
[wglContextWrap]
windows-7
windows

View File

@ -488,6 +488,8 @@ private Q_SLOTS:
void ioHttpUserVerifiedRedirect_data();
void ioHttpUserVerifiedRedirect();
void ioHttpCookiesDuringRedirect();
void ioHttpRedirect_data();
void ioHttpRedirect();
#ifndef QT_NO_SSL
void putWithServerClosingConnectionImmediately();
#endif
@ -8438,6 +8440,44 @@ void tst_QNetworkReply::ioHttpCookiesDuringRedirect()
QVERIFY(target.receivedData.contains("\r\nCookie: hello=world\r\n"));
}
void tst_QNetworkReply::ioHttpRedirect_data()
{
QTest::addColumn<QString>("status");
QTest::addRow("301") << "301 Moved Permanently";
QTest::addRow("302") << "302 Found";
QTest::addRow("303") << "303 See Other";
QTest::addRow("305") << "305 Use Proxy";
QTest::addRow("307") << "307 Temporary Redirect";
QTest::addRow("308") << "308 Permanent Redirect";
}
void tst_QNetworkReply::ioHttpRedirect()
{
QFETCH(QString, status);
MiniHttpServer target(httpEmpty200Response, false);
QUrl targetUrl("http://localhost/");
targetUrl.setPort(target.serverPort());
QString redirectReply = QStringLiteral("HTTP/1.1 %1\r\n"
"Content-Type: text/plain\r\n"
"location: %2\r\n"
"\r\n").arg(status, targetUrl.toString());
MiniHttpServer redirectServer(redirectReply.toLatin1(), false);
QUrl url("http://localhost/");
url.setPort(redirectServer.serverPort());
QNetworkRequest request(url);
auto oldRedirectPolicy = manager.redirectPolicy();
manager.setRedirectPolicy(QNetworkRequest::RedirectPolicy::NoLessSafeRedirectPolicy);
QNetworkReplyPtr reply(manager.get(request));
// Set policy back to what it was
manager.setRedirectPolicy(oldRedirectPolicy);
QCOMPARE(waitForFinish(reply), int(Success));
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
}
#ifndef QT_NO_SSL
class PutWithServerClosingConnectionImmediatelyHandler: public QObject

View File

@ -1,5 +1,7 @@
[]
rhel-7.1
rhel-7.2
rhel-7.3
rhel-7.4
[customGesture]
opensuse-13.1

View File

@ -689,7 +689,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot()
}
}
if (testDir.isEmpty())
QSKIP("This test requires to have an unique directory of at least six ascii characters under c:/");
QSKIP("This test requires to have a unique directory of at least six ascii characters under c:/");
#else
fd.setFilter(QDir::Hidden | QDir::AllDirs | QDir::Files | QDir::System);
fd.setDirectory("/");

View File

@ -14,6 +14,8 @@ ubuntu-14.04
ubuntu-16.04
rhel-7.1
rhel-7.2
rhel-7.3
rhel-7.4
osx
[focusProxyAndInputMethods]
linux

View File

@ -1,9 +1,5 @@
[check_menuPosition]
ubuntu-14.04
ubuntu-16.04
[taskQTBUG4965_escapeEaten]
ubuntu-14.04
ubuntu-16.04
redhatenterpriselinuxworkstation-6.6
[task256322_highlight]
osx

View File

@ -1374,6 +1374,7 @@ void tst_QMenuBar::menubarSizeHint()
void tst_QMenuBar::taskQTBUG4965_escapeEaten()
{
QMenuBar menubar;
menubar.setNativeMenuBar(false);
QMenu menu("menu1");
QAction *first = menubar.addMenu(&menu);
menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC"));

View File

@ -562,7 +562,7 @@ void tst_QXmlSimpleReader::inputFromSocket()
QSKIP("WinRT does not support connecting to localhost");
#endif
QTRY_VERIFY(server->listening);
QTRY_VERIFY_WITH_TIMEOUT(server->listening, 15000);
QTcpSocket sock;
sock.connectToHost(QHostAddress::LocalHost, TEST_PORT);