summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-10-26 15:14:18 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-10-26 15:14:18 +0000
commitf79e7c07237efcefe27d6ed5090e552cd9722e3d (patch)
tree9a1d1ac6576e882e8a8239b0fbb29fd3ddf2e4ad /src
parentea284937eaf27709e7a10a0a7b43e0bc91d4aa36 (diff)
parentfa9d12f4a20d618caedc77880459fa1af75fd50d (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/angle/LICENSE64
-rw-r--r--src/3rdparty/sqlite/patches/0001-Fix-CVE-2017-10989-in-sqlite.patch15
-rw-r--r--src/3rdparty/sqlite/sqlite3.c4
-rw-r--r--src/angle/src/common/gles_common.pri2
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/global/global.pri23
-rw-r--r--src/corelib/global/qglobal.cpp4
-rw-r--r--src/corelib/global/qrandom.cpp8
-rw-r--r--src/corelib/global/qrandom.h12
-rw-r--r--src/corelib/global/qt_windows.h4
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp3
-rw-r--r--src/corelib/io/qloggingcategory.cpp8
-rw-r--r--src/corelib/io/qurl.cpp31
-rw-r--r--src/corelib/kernel/qcoreevent.cpp8
-rw-r--r--src/corelib/thread/qmutex.h2
-rw-r--r--src/corelib/thread/qthreadpool.cpp87
-rw-r--r--src/corelib/thread/qthreadpool_p.h84
-rw-r--r--src/dbus/qdbusintrospection.cpp2
-rw-r--r--src/dbus/qdbusmetatype.cpp1
-rw-r--r--src/gui/kernel/qevent.cpp13
-rw-r--r--src/gui/kernel/qplatformtheme.cpp2
-rw-r--r--src/gui/painting/qdrawhelper.cpp4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qstroker.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp6
-rw-r--r--src/gui/text/qtextodfwriter.cpp1
-rw-r--r--src/gui/util/qgridlayoutengine.cpp6
-rw-r--r--src/gui/util/qhexstring_p.h2
-rw-r--r--src/network/access/qhstsstore.cpp2
-rw-r--r--src/network/access/qhttpmultipart.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp11
-rw-r--r--src/network/access/qhttpnetworkreply.cpp2
-rw-r--r--src/network/access/qnetworkcookiejar.cpp2
-rw-r--r--src/network/access/qnetworkreply.cpp2
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp89
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h4
-rw-r--r--src/network/configure.json32
-rw-r--r--src/network/kernel/kernel.pri2
-rw-r--r--src/network/kernel/qhostaddress.cpp86
-rw-r--r--src/network/kernel/qhostinfo_unix.cpp50
-rw-r--r--src/network/kernel/qhostinfo_win.cpp161
-rw-r--r--src/network/kernel/qnetworkdatagram.cpp4
-rw-r--r--src/network/kernel/qnetworkinterface_win.cpp1
-rw-r--r--src/network/socket/qnet_unix_p.h10
-rw-r--r--src/network/socket/qudpsocket.cpp8
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp2
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm2
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp6
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp6
-rw-r--r--src/plugins/bearer/platformdefs_win.h1
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp2
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp20
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp11
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro11
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm31
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm35
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm11
-rw-r--r--src/plugins/platforms/direct2d/direct2d.pro3
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp22
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
-rw-r--r--src/plugins/platforms/windows/windows.pro3
-rw-r--r--src/plugins/platforms/xcb/qxcbimage.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp4
-rw-r--r--src/plugins/printsupport/cups/qcupsprintengine.cpp2
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.cpp2
-rw-r--r--src/widgets/doc/images/widgets-tutorial-toplevel.pngbin6087 -> 2496 bytes
-rw-r--r--src/widgets/doc/src/qtwidgets-index.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/widgets.qdoc2
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp1
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp2
-rw-r--r--src/widgets/kernel/qshortcut.cpp4
-rw-r--r--src/widgets/kernel/win.pri2
-rw-r--r--src/widgets/styles/qstyle.cpp5
-rw-r--r--src/widgets/styles/qstylehelper.cpp1
-rw-r--r--src/widgets/widgets/qpushbutton.cpp2
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp4
83 files changed, 581 insertions, 522 deletions
diff --git a/src/3rdparty/angle/LICENSE b/src/3rdparty/angle/LICENSE
index bdacb32e36..dc322e998d 100644
--- a/src/3rdparty/angle/LICENSE
+++ b/src/3rdparty/angle/LICENSE
@@ -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.
diff --git a/src/3rdparty/sqlite/patches/0001-Fix-CVE-2017-10989-in-sqlite.patch b/src/3rdparty/sqlite/patches/0001-Fix-CVE-2017-10989-in-sqlite.patch
new file mode 100644
index 0000000000..26d022f6c6
--- /dev/null
+++ b/src/3rdparty/sqlite/patches/0001-Fix-CVE-2017-10989-in-sqlite.patch
@@ -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);
+ }
+ }
+
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);
}
}
diff --git a/src/angle/src/common/gles_common.pri b/src/angle/src/common/gles_common.pri
index ea4fb03aae..5d5682a1df 100644
--- a/src/angle/src/common/gles_common.pri
+++ b/src/angle/src/common/gles_common.pri
@@ -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
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 3ab7794f2e..4d67e5837f 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -48,8 +48,6 @@ win32 {
mingw {
# otherwise mingw headers do not declare common functions like putenv
CONFIG -= strict_c++
- # Override MinGW's definition in _mingw.h
- DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600
}
LIBS_PRIVATE += -lws2_32
!winrt {
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 78b37755a4..7c31df4d6a 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -99,16 +99,13 @@ 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)
-
- qfloat16_tables.commands = $$QMAKE_QFLOAT16_TABLES ${QMAKE_FILE_OUT}
- qfloat16_tables.output = global/qfloat16tables.cpp
- qfloat16_tables.depends = $$QMAKE_QFLOAT16_TABLES
- qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE
- qfloat16_tables.variable_out = SOURCES
- QMAKE_EXTRA_COMPILERS += qfloat16_tables
-}
+QMAKE_QFLOAT16_TABLES_GENERATE = global/qfloat16.h
+
+qtPrepareTool(QMAKE_QFLOAT16_TABLES, qfloat16-tables)
+
+qfloat16_tables.commands = $$QMAKE_QFLOAT16_TABLES ${QMAKE_FILE_OUT}
+qfloat16_tables.output = global/qfloat16tables.cpp
+qfloat16_tables.depends = $$QMAKE_QFLOAT16_TABLES
+qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE
+qfloat16_tables.variable_out = SOURCES
+QMAKE_EXTRA_COMPILERS += qfloat16_tables
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index f2f807e1d9..36b7560398 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -4296,6 +4296,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qDebug(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
Calls the message handler with the debug message \a message. If no
message handler has been installed, the message is printed to
@@ -4332,6 +4333,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qInfo(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
\since 5.5
Calls the message handler with the informational message \a message. If no
@@ -4369,6 +4371,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qWarning(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
Calls the message handler with the warning message \a message. If no
message handler has been installed, the message is printed to
@@ -4406,6 +4409,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qCritical(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
Calls the message handler with the critical message \a message. If no
message handler has been installed, the message is printed to
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index d77ec8075a..9abb9ece7f 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -154,15 +154,19 @@ class SystemRandom
{
static QBasicAtomicInt s_fdp1; // "file descriptor plus 1"
static int openDevice();
+#ifdef Q_CC_GNU
+ // If it's not GCC or GCC-like, then we'll leak the file descriptor
+ __attribute__((destructor))
+#endif
+ static void closeDevice();
SystemRandom() {}
- ~SystemRandom();
public:
enum { EfficientBufferFill = true };
static qssize_t fillBuffer(void *buffer, qssize_t count);
};
QBasicAtomicInt SystemRandom::s_fdp1 = Q_BASIC_ATOMIC_INITIALIZER(0);
-SystemRandom::~SystemRandom()
+void SystemRandom::closeDevice()
{
int fd = s_fdp1.loadAcquire() - 1;
if (fd >= 0)
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index 7f96cd6749..2259f2657a 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -62,8 +62,16 @@ public:
static Q_CORE_EXPORT quint64 generate64();
static double generateDouble()
{
- // use get64() to get enough bits
- return double(generate64()) / ((std::numeric_limits<quint64>::max)() + double(1.0));
+ // IEEE 754 double precision has:
+ // 1 bit sign
+ // 10 bits exponent
+ // 53 bits mantissa
+ // In order for our result to be normalized in the range [0, 1), we
+ // need exactly 53 bits of random data. Use generate64() to get enough.
+ quint64 x = generate64();
+ quint64 limit = Q_UINT64_C(1) << std::numeric_limits<double>::digits;
+ x >>= std::numeric_limits<quint64>::digits - std::numeric_limits<double>::digits;
+ return double(x) / double(limit);
}
static qreal bounded(qreal sup)
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index bc48104edc..67ba27f072 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -48,10 +48,10 @@
#if defined(Q_CC_MINGW)
// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
# ifndef WINVER
-# define WINVER 0x600
+# define WINVER 0x601
# endif
# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x600
+# define _WIN32_WINNT 0x601
# endif
# ifndef NTDDI_VERSION
# define NTDDI_VERSION 0x06000000
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 35ddb41215..944ca232ee 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -595,6 +595,9 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
params.dwSize = sizeof(params);
params.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
params.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
+ params.dwSecurityQosFlags = SECURITY_ANONYMOUS;
+ params.lpSecurityAttributes = NULL;
+ params.hTemplateFile = NULL;
const HANDLE handle =
CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), 0,
FILE_SHARE_READ, OPEN_EXISTING, &params);
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 4256d4b6e1..b029274329 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -445,6 +445,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCDebug(category)
\relates QLoggingCategory
+ \threadsafe
\since 5.2
Returns an output stream for debug messages in the logging category
@@ -469,6 +470,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCDebug(category, const char *message, ...)
\relates QLoggingCategory
+ \threadsafe
\since 5.3
Logs a debug message \a message in the logging category \a category.
@@ -490,6 +492,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCInfo(category)
\relates QLoggingCategory
+ \threadsafe
\since 5.5
Returns an output stream for informational messages in the logging category
@@ -514,6 +517,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCInfo(category, const char *message, ...)
\relates QLoggingCategory
+ \threadsafe
\since 5.5
Logs an informational message \a message in the logging category \a category.
@@ -535,6 +539,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCWarning(category)
\relates QLoggingCategory
+ \threadsafe
\since 5.2
Returns an output stream for warning messages in the logging category
@@ -559,6 +564,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCWarning(category, const char *message, ...)
\relates QLoggingCategory
+ \threadsafe
\since 5.3
Logs a warning message \a message in the logging category \a category.
@@ -580,6 +586,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCCritical(category)
\relates QLoggingCategory
+ \threadsafe
\since 5.2
Returns an output stream for critical messages in the logging category
@@ -604,6 +611,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
/*!
\macro qCCritical(category, const char *message, ...)
\relates QLoggingCategory
+ \threadsafe
\since 5.3
Logs a critical message \a message in the logging category \a category.
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index ac694a464a..a499dc2d30 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -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 '/'");
}
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index e90cd842ab..1e6b328c75 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -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.
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index f40dd3c814..541f6af546 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -251,7 +251,7 @@ class Q_CORE_EXPORT QMutex
public:
enum RecursionMode { NonRecursive, Recursive };
- inline explicit QMutex(RecursionMode mode = NonRecursive) Q_DECL_NOTHROW { Q_UNUSED(mode); }
+ inline Q_DECL_CONSTEXPR explicit QMutex(RecursionMode = NonRecursive) Q_DECL_NOTHROW { }
inline void lock() Q_DECL_NOTHROW {}
inline bool tryLock(int timeout = 0) Q_DECL_NOTHROW { Q_UNUSED(timeout); return true; }
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index fd5a1106a0..157cbeaf4d 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -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))
- queue.removeFirst();
+ 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)
- delete r;
+ 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;
}
}
diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h
index 8b6a8cc476..d03ba9d77f 100644
--- a/src/corelib/thread/qthreadpool_p.h
+++ b/src/corelib/thread/qthreadpool_p.h
@@ -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;
diff --git a/src/dbus/qdbusintrospection.cpp b/src/dbus/qdbusintrospection.cpp
index a700a2a215..6e406f7616 100644
--- a/src/dbus/qdbusintrospection.cpp
+++ b/src/dbus/qdbusintrospection.cpp
@@ -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.
*/
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
index f57eac6477..0729a3cbbb 100644
--- a/src/dbus/qdbusmetatype.cpp
+++ b/src/dbus/qdbusmetatype.cpp
@@ -228,7 +228,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!
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 8f153fa2d3..916b13df44 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -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(),
@@ -2335,6 +2335,13 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const
cursor and touchpad. Qt recognizes these by their names. Otherwise, if the
tablet is configured to use the evdev driver, there will be only one device
and applications may not be able to distinguish the stylus from the eraser.
+
+ \section1 Notes for Windows Users
+
+ Tablet support currently requires the WACOM windows driver providing the DLL
+ \c{wintab32.dll} to be installed. It is contained in older packages,
+ for example \c{pentablet_5.3.5-3.exe}.
+
*/
/*!
@@ -2783,13 +2790,13 @@ Q_GLOBAL_STATIC(NativeGestureEventDataHash, g_nativeGestureEventDataHash)
\a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters.
\since 5.10
*/
-QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos,
+QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *device, const QPointF &localPos, const QPointF &windowPos,
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
mSequenceId(sequenceId), mIntValue(intValue)
{
- g_nativeGestureEventDataHash->insert(this, dev);
+ g_nativeGestureEventDataHash->insert(this, device);
}
QNativeGestureEvent::~QNativeGestureEvent()
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index ebf65eda12..cd3966fb47 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -531,7 +531,7 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
case UiEffects:
return QVariant(int(0));
case SpellCheckUnderlineStyle:
- return QVariant(int(QTextCharFormat::SpellCheckUnderline));
+ return QVariant(int(QTextCharFormat::WaveUnderline));
case TabFocusBehavior:
return QVariant(int(Qt::TabFocusAllControls));
case IconPixmapSizes:
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 5207e861e6..5ec570a5db 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -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);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index b4f717678d..68554c6579 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -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;
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 667c3b0fb5..b95f9b18aa 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -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) {
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index c52792c2d3..4776545be6 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1147,8 +1147,6 @@ void QDashStroker::processCurrentSubpath()
QLineF cline;
- QPainterPath dashPath;
-
QSubpathFlatIterator it(&m_elements, m_dashThreshold);
qfixed2d prev = it.next();
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 1653ac8c33..8fe474af2c 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1333,9 +1333,9 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value DashDotLine Dashs and dots are drawn using Qt::DashDotLine.
\value DashDotDotLine Underlines draw drawn using Qt::DashDotDotLine.
\value WaveUnderline The text is underlined using a wave shaped line.
- \value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle
- style hint of the QApplication style. By default this is mapped to
- WaveUnderline, on \macos it is mapped to DashDotLine.
+ \value SpellCheckUnderline The underline is drawn depending on the SpellCheckUnderlineStyle
+ theme hint of QPlatformTheme. By default this is mapped to
+ WaveUnderline, on \macos it is mapped to DotLine.
\sa Qt::PenStyle
*/
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index a9eb2d4de9..30f5bc1051 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -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);
diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp
index 8ff2a3eeec..33adac40b2 100644
--- a/src/gui/util/qgridlayoutengine.cpp
+++ b/src/gui/util/qgridlayoutengine.cpp
@@ -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);
diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h
index 511eec0f1b..d30a8eeee8 100644
--- a/src/gui/util/qhexstring_p.h
+++ b/src/gui/util/qhexstring_p.h
@@ -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
{
diff --git a/src/network/access/qhstsstore.cpp b/src/network/access/qhstsstore.cpp
index 239a52b7a4..6d7f60ba8d 100644
--- a/src/network/access/qhstsstore.cpp
+++ b/src/network/access/qhstsstore.cpp
@@ -114,7 +114,7 @@ void QHstsStore::synchronize()
if (observedPolicies.size()) {
beginHstsGroups();
- for (const QHstsPolicy &policy : observedPolicies) {
+ for (const QHstsPolicy &policy : qAsConst(observedPolicies)) {
const QString key(host_name_to_settings_key(policy.host()));
// If we fail to write a new, updated policy, we also remove the old one.
if (policy.isExpired() || !serializePolicy(key, policy))
diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp
index 303c145394..58d306d5f9 100644
--- a/src/network/access/qhttpmultipart.cpp
+++ b/src/network/access/qhttpmultipart.cpp
@@ -476,6 +476,8 @@ bool QHttpMultiPartIODevice::isSequential() const
bool QHttpMultiPartIODevice::reset()
{
+ // Reset QIODevice's data
+ QIODevice::reset();
for (int a = 0; a < multiPart->parts.count(); a++)
if (!multiPart->parts[a].d->reset())
return false;
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index f21acc7574..5f75172c90 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -604,14 +604,21 @@ 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())
reply->setRedirectUrl(redirectUrl);
- if (qobject_cast<QHttpNetworkConnection *>(connection))
+ if ((statusCode == 307 || statusCode == 308) && !resetUploadData()) {
+ // Couldn't reset the upload data, which means it will be unable to POST the data -
+ // this would lead to a long wait until it eventually failed and then retried.
+ // Instead of doing that we fail here instead, resetUploadData will already have emitted
+ // a ContentReSendError, so we're done.
+ } else if (qobject_cast<QHttpNetworkConnection *>(connection)) {
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+ }
break;
}
case 401: // auth required
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 612abb9044..778ba821e8 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -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
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index 232c2b47a5..f62a03b11d 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -140,7 +140,7 @@ void QNetworkCookieJar::setAllCookies(const QList<QNetworkCookie> &cookieList)
static inline bool isParentPath(const QString &path, const QString &reference)
{
- if (path.startsWith(reference)) {
+ if ((path.isEmpty() && reference == QLatin1String("/")) || path.startsWith(reference)) {
//The cookie-path and the request-path are identical.
if (path.length() == reference.length())
return true;
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index cabea86521..11d8f0e3f7 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -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.
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 684fee610c..4ac046ef58 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -165,6 +165,16 @@ static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &hea
}
}
+#if QT_CONFIG(bearermanagement)
+static bool isSessionNeeded(const QUrl &url)
+{
+ // Connections to the local machine does not require a session
+ QString host = url.host().toLower();
+ return !QHostAddress(host).isLoopback() && host != QLatin1String("localhost")
+ && host != QSysInfo::machineHostName().toLower();
+}
+#endif // bearer management
+
QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manager,
const QNetworkRequest& request,
QNetworkAccessManager::Operation& operation,
@@ -1115,10 +1125,15 @@ QNetworkAccessManager::Operation QNetworkReplyHttpImplPrivate::getRedirectOperat
switch (currentOp) {
case QNetworkAccessManager::HeadOperation:
return QNetworkAccessManager::HeadOperation;
+ case QNetworkAccessManager::PostOperation:
+ // We MUST keep using POST when being redirected with 307 or 308.
+ if (statusCode == 307 || statusCode == 308)
+ return QNetworkAccessManager::PostOperation;
+ break;
default:
break;
}
- // For now, we're always returning GET for anything other than HEAD
+ // Use GET for everything else.
return QNetworkAccessManager::GetOperation;
}
@@ -1193,11 +1208,30 @@ void QNetworkReplyHttpImplPrivate::followRedirect()
{
Q_Q(QNetworkReplyHttpImpl);
+ rawHeaders.clear();
cookedHeaders.clear();
if (managerPrivate->thread)
managerPrivate->thread->disconnect();
+#if QT_CONFIG(bearermanagement)
+ // If the original request didn't need a session (i.e. it was to localhost)
+ // then we might not have a session open, to which to redirect, if the
+ // new URL is remote. When this happens, we need to open the session now:
+ if (managerPrivate && isSessionNeeded(url)) {
+ if (auto session = managerPrivate->getNetworkSession()) {
+ if (session->state() != QNetworkSession::State::Connected || !session->isOpen()) {
+ startWaitForSession(session);
+ // Need to set 'request' to the redirectRequest so that when QNAM restarts
+ // the request after the session starts it will not repeat the previous request.
+ request = redirectRequest;
+ // Return now, QNAM will start the request when the session has started.
+ return;
+ }
+ }
+ }
+#endif // bearer management
+
QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection,
Q_ARG(QNetworkRequest, redirectRequest));
}
@@ -1210,6 +1244,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
@@ -1783,10 +1818,8 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest)
}
// This is not ideal.
- const QString host = url.host();
- if (host == QLatin1String("localhost") ||
- QHostAddress(host).isLoopback()) {
- // Don't need an open session for localhost access.
+ if (!isSessionNeeded(url)) {
+ // Don't need to check for an open session if we don't need one.
postRequest(newHttpRequest);
return true;
}
@@ -1810,6 +1843,34 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest)
#endif
}
+#if QT_CONFIG(bearermanagement)
+bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer<QNetworkSession> &session)
+{
+ Q_Q(QNetworkReplyHttpImpl);
+ state = WaitingForSession;
+
+ if (session) {
+ QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)),
+ q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection);
+
+ if (!session->isOpen()) {
+ QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute,
+ QVariant::fromValue(false));
+ session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground);
+ session->open();
+ }
+ return true;
+ }
+ const Qt::ConnectionType connection = synchronous ? Qt::DirectConnection : Qt::QueuedConnection;
+ qWarning("Backend is waiting for QNetworkSession to connect, but there is none!");
+ QMetaObject::invokeMethod(q, "_q_error", connection,
+ Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError),
+ Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error.")));
+ QMetaObject::invokeMethod(q, "_q_finished", connection);
+ return false;
+}
+#endif // QT_CONFIG(bearermanagement)
+
void QNetworkReplyHttpImplPrivate::_q_startOperation()
{
Q_Q(QNetworkReplyHttpImpl);
@@ -1837,24 +1898,8 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
// backend failed to start because the session state is not Connected.
// QNetworkAccessManager will call reply->backend->start() again for us when the session
// state changes.
- state = WaitingForSession;
-
- if (session) {
- QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)),
- q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection);
-
- if (!session->isOpen()) {
- session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground);
- session->open();
- }
- } else {
- qWarning("Backend is waiting for QNetworkSession to connect, but there is none!");
- QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection,
- Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError),
- Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error.")));
- QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);
+ if (!startWaitForSession(session))
return;
- }
} else if (session) {
QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)),
diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index 91e9207601..8d2bd132b0 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -161,6 +161,10 @@ signals:
class QNetworkReplyHttpImplPrivate: public QNetworkReplyPrivate
{
+#if QT_CONFIG(bearermanagement)
+ bool startWaitForSession(QSharedPointer<QNetworkSession> &session);
+#endif
+
public:
static QHttpNetworkRequest::Priority convert(const QNetworkRequest::Priority& prio);
diff --git a/src/network/configure.json b/src/network/configure.json
index b1c943de6f..d46fbfc101 100644
--- a/src/network/configure.json
+++ b/src/network/configure.json
@@ -89,31 +89,6 @@
},
"tests": {
- "getaddrinfo": {
- "label": "getaddrinfo()",
- "type": "compile",
- "test": {
- "head": [
- "#include <stdio.h>",
- "#include <stdlib.h>",
- "#ifdef __MINGW32__",
- "# include <winsock2.h>",
- "# include <ws2tcpip.h>",
- "#else",
- "# include <sys/types.h>",
- "# include <sys/socket.h>",
- "# include <netdb.h>",
- "#endif"
- ],
- "main": [
- "addrinfo *res = 0;",
- "(void) getaddrinfo(\"foo\", 0, 0, &res);",
- "freeaddrinfo(res);",
- "gai_strerror(0);"
- ]
- },
- "use": "network"
- },
"getifaddrs": {
"label": "getifaddrs()",
"type": "compile",
@@ -170,11 +145,6 @@
"emitIf": "config.darwin",
"output": [ "feature", "privateFeature" ]
},
- "getaddrinfo": {
- "label": "getaddrinfo()",
- "condition": "tests.getaddrinfo",
- "output": [ "feature" ]
- },
"getifaddrs": {
"label": "getifaddrs()",
"condition": "tests.getifaddrs",
@@ -337,7 +307,7 @@ For example:
"args": "corewlan",
"condition": "config.darwin"
},
- "getaddrinfo", "getifaddrs", "ipv6ifname", "libproxy",
+ "getifaddrs", "ipv6ifname", "libproxy",
{
"type": "feature",
"args": "securetransport",
diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
index 716f745bc9..54b61f3ad3 100644
--- a/src/network/kernel/kernel.pri
+++ b/src/network/kernel/kernel.pri
@@ -49,8 +49,6 @@ win32: {
SOURCES += kernel/qdnslookup_win.cpp \
kernel/qnetworkinterface_win.cpp
LIBS_PRIVATE += -ldnsapi -liphlpapi
- DEFINES += WINVER=0x0600 _WIN32_WINNT=0x0600
-
} else {
SOURCES += kernel/qdnslookup_winrt.cpp \
kernel/qnetworkinterface_winrt.cpp
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index 8b380960e6..72b6d2dc70 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -534,49 +534,6 @@ QHostAddress::QHostAddress(SpecialAddress 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.
*/
QHostAddress::~QHostAddress()
@@ -740,6 +697,49 @@ void QHostAddress::setAddress(const struct sockaddr *sockaddr)
}
/*!
+ \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.
For example, if the address is 127.0.0.1, the returned value is
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index 91e5d18ae5..d22608e22f 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -66,10 +66,6 @@
# include <gnu/lib-names.h>
#endif
-#if defined (QT_NO_GETADDRINFO)
-static QBasicMutex getHostByNameMutex;
-#endif
-
QT_BEGIN_NAMESPACE
// Almost always the same. If not, specify in qplatformdefs.h.
@@ -188,7 +184,6 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QHostAddress address;
if (address.setAddress(hostName)) {
// Reverse lookup
-#if !defined (QT_NO_GETADDRINFO)
sockaddr_in sa4;
sockaddr_in6 sa6;
sockaddr *sa = 0;
@@ -211,12 +206,6 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
char hbuf[NI_MAXHOST];
if (sa && getnameinfo(sa, saSize, hbuf, sizeof(hbuf), 0, 0, 0) == 0)
results.setHostName(QString::fromLatin1(hbuf));
-#else
- in_addr_t inetaddr = qt_safe_inet_addr(hostName.toLatin1().constData());
- struct hostent *ent = gethostbyaddr((const char *)&inetaddr, sizeof(inetaddr), AF_INET);
- if (ent)
- results.setHostName(QString::fromLatin1(ent->h_name));
-#endif
if (results.hostName().isEmpty())
results.setHostName(address.toString());
@@ -235,7 +224,6 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
return results;
}
-#if !defined (QT_NO_GETADDRINFO)
// Call getaddrinfo, and place all IPv4 addresses at the start and
// the IPv6 addresses at the end of the address list in results.
addrinfo *res = 0;
@@ -302,39 +290,6 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
results.setErrorString(QString::fromLocal8Bit(gai_strerror(result)));
}
-#else
- // Fall back to gethostbyname for platforms that don't define
- // getaddrinfo. gethostbyname does not support IPv6, and it's not
- // reentrant on all platforms. For now this is okay since we only
- // use one QHostInfoAgent, but if more agents are introduced, locking
- // must be provided.
- QMutexLocker locker(&getHostByNameMutex);
- hostent *result = gethostbyname(aceHostname.constData());
- if (result) {
- if (result->h_addrtype == AF_INET) {
- QList<QHostAddress> addresses;
- for (char **p = result->h_addr_list; *p != 0; p++) {
- QHostAddress addr;
- addr.setAddress(ntohl(*((quint32 *)*p)));
- if (!addresses.contains(addr))
- addresses.prepend(addr);
- }
- results.setAddresses(addresses);
- } else {
- results.setError(QHostInfo::UnknownError);
- results.setErrorString(tr("Unknown address type"));
- }
-#if !defined(Q_OS_VXWORKS)
- } else if (h_errno == HOST_NOT_FOUND || h_errno == NO_DATA
- || h_errno == NO_ADDRESS) {
- results.setError(QHostInfo::HostNotFound);
- results.setErrorString(tr("Host not found"));
-#endif
- } else {
- results.setError(QHostInfo::UnknownError);
- results.setErrorString(tr("Unknown error"));
- }
-#endif // !defined (QT_NO_GETADDRINFO)
#if defined(QHOSTINFO_DEBUG)
if (results.error() != QHostInfo::NoError) {
@@ -377,11 +332,6 @@ QString QHostInfo::localDomainName()
if (local_res_init && local_res) {
// using thread-unsafe version
-#if defined(QT_NO_GETADDRINFO)
- // We have to call res_init to be sure that _res was initialized
- // So, for systems without getaddrinfo (which is thread-safe), we lock the mutex too
- QMutexLocker locker(&getHostByNameMutex);
-#endif
local_res_init();
QString domainName = QUrl::fromAce(local_res->defdname);
if (domainName.isEmpty())
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 9e5d556f2b..bea24b0af2 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -50,50 +50,12 @@ QT_BEGIN_NAMESPACE
//#define QHOSTINFO_DEBUG
-// Older SDKs do not include the addrinfo struct declaration, so we
-// include a copy of it here.
-struct qt_addrinfo
-{
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- size_t ai_addrlen;
- char *ai_canonname;
- sockaddr *ai_addr;
- qt_addrinfo *ai_next;
-};
-
//###
#define QT_SOCKLEN_T int
#ifndef NI_MAXHOST // already defined to 1025 in ws2tcpip.h?
#define NI_MAXHOST 1024
#endif
-typedef int (__stdcall *getnameinfoProto)(const sockaddr *, QT_SOCKLEN_T, const char *, DWORD, const char *, DWORD, int);
-typedef int (__stdcall *getaddrinfoProto)(const char *, const char *, const qt_addrinfo *, qt_addrinfo **);
-typedef int (__stdcall *freeaddrinfoProto)(qt_addrinfo *);
-static getnameinfoProto local_getnameinfo = 0;
-static getaddrinfoProto local_getaddrinfo = 0;
-static freeaddrinfoProto local_freeaddrinfo = 0;
-
-static bool resolveLibraryInternal()
-{
- // Attempt to resolve getaddrinfo(); without it we'll have to fall
- // back to gethostbyname(), which has no IPv6 support.
-#if defined (Q_OS_WINRT)
- local_getaddrinfo = (getaddrinfoProto) &getaddrinfo;
- local_freeaddrinfo = (freeaddrinfoProto) &freeaddrinfo;
- local_getnameinfo = (getnameinfoProto) getnameinfo;
-#else
- local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getaddrinfo");
- local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "freeaddrinfo");
- local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getnameinfo");
-#endif
- return true;
-}
-Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))
-
static void translateWSAError(int error, QHostInfo *results)
{
switch (error) {
@@ -114,49 +76,39 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
{
QSysInfo::machineHostName(); // this initializes ws2_32.dll
- // Load res_init on demand.
- resolveLibrary();
-
QHostInfo results;
#if defined(QHOSTINFO_DEBUG)
qDebug("QHostInfoAgent::fromName(): looking up \"%s\" (IPv6 support is %s)",
hostName.toLatin1().constData(),
- (local_getaddrinfo && local_freeaddrinfo) ? "enabled" : "disabled");
+ (getaddrinfo && freeaddrinfo) ? "enabled" : "disabled");
#endif
QHostAddress address;
if (address.setAddress(hostName)) {
// Reverse lookup
- if (local_getnameinfo) {
- sockaddr_in sa4;
- sockaddr_in6 sa6;
- sockaddr *sa;
- QT_SOCKLEN_T saSize;
- if (address.protocol() == QAbstractSocket::IPv4Protocol) {
- sa = (sockaddr *)&sa4;
- saSize = sizeof(sa4);
- memset(&sa4, 0, sizeof(sa4));
- sa4.sin_family = AF_INET;
- sa4.sin_addr.s_addr = htonl(address.toIPv4Address());
- } else {
- sa = (sockaddr *)&sa6;
- saSize = sizeof(sa6);
- memset(&sa6, 0, sizeof(sa6));
- sa6.sin6_family = AF_INET6;
- memcpy(&sa6.sin6_addr, address.toIPv6Address().c, sizeof(sa6.sin6_addr));
- }
-
- char hbuf[NI_MAXHOST];
- if (local_getnameinfo(sa, saSize, hbuf, sizeof(hbuf), 0, 0, 0) == 0)
- results.setHostName(QString::fromLatin1(hbuf));
+ sockaddr_in sa4;
+ sockaddr_in6 sa6;
+ sockaddr *sa;
+ QT_SOCKLEN_T saSize;
+ if (address.protocol() == QAbstractSocket::IPv4Protocol) {
+ sa = (sockaddr *)&sa4;
+ saSize = sizeof(sa4);
+ memset(&sa4, 0, sizeof(sa4));
+ sa4.sin_family = AF_INET;
+ sa4.sin_addr.s_addr = htonl(address.toIPv4Address());
} else {
- unsigned long addr = inet_addr(hostName.toLatin1().constData());
- struct hostent *ent = gethostbyaddr((const char*)&addr, sizeof(addr), AF_INET);
- if (ent)
- results.setHostName(QString::fromLatin1(ent->h_name));
+ sa = (sockaddr *)&sa6;
+ saSize = sizeof(sa6);
+ memset(&sa6, 0, sizeof(sa6));
+ sa6.sin6_family = AF_INET6;
+ memcpy(&sa6.sin6_addr, address.toIPv6Address().c, sizeof(sa6.sin6_addr));
}
+ char hbuf[NI_MAXHOST];
+ if (getnameinfo(sa, saSize, hbuf, sizeof(hbuf), 0, 0, 0) == 0)
+ results.setHostName(QString::fromLatin1(hbuf));
+
if (results.hostName().isEmpty())
results.setHostName(address.toString());
results.setAddresses(QList<QHostAddress>() << address);
@@ -172,64 +124,35 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
return results;
}
- if (local_getaddrinfo && local_freeaddrinfo) {
- // Call getaddrinfo, and place all IPv4 addresses at the start
- // and the IPv6 addresses at the end of the address list in
- // results.
- qt_addrinfo *res;
- int err = local_getaddrinfo(aceHostname.constData(), 0, 0, &res);
- if (err == 0) {
- QList<QHostAddress> addresses;
- for (qt_addrinfo *p = res; p != 0; p = p->ai_next) {
- switch (p->ai_family) {
- case AF_INET: {
- QHostAddress addr;
- addr.setAddress(ntohl(((sockaddr_in *) p->ai_addr)->sin_addr.s_addr));
- if (!addresses.contains(addr))
- addresses.append(addr);
- }
- break;
- case AF_INET6: {
- QHostAddress addr;
- addr.setAddress(((sockaddr_in6 *) p->ai_addr)->sin6_addr.s6_addr);
- if (!addresses.contains(addr))
- addresses.append(addr);
- }
- break;
- default:
- results.setError(QHostInfo::UnknownError);
- results.setErrorString(tr("Unknown address type"));
- }
+ addrinfo *res;
+ int err = getaddrinfo(aceHostname.constData(), 0, 0, &res);
+ if (err == 0) {
+ QList<QHostAddress> addresses;
+ for (addrinfo *p = res; p != 0; p = p->ai_next) {
+ switch (p->ai_family) {
+ case AF_INET: {
+ QHostAddress addr;
+ addr.setAddress(ntohl(((sockaddr_in *) p->ai_addr)->sin_addr.s_addr));
+ if (!addresses.contains(addr))
+ addresses.append(addr);
+ }
+ break;
+ case AF_INET6: {
+ QHostAddress addr;
+ addr.setAddress(((sockaddr_in6 *) p->ai_addr)->sin6_addr.s6_addr);
+ if (!addresses.contains(addr))
+ addresses.append(addr);
}
- results.setAddresses(addresses);
- local_freeaddrinfo(res);
- } else {
- translateWSAError(WSAGetLastError(), &results);
- }
- } else {
- // Fall back to gethostbyname, which only supports IPv4.
- hostent *ent = gethostbyname(aceHostname.constData());
- if (ent) {
- char **p;
- QList<QHostAddress> addresses;
- switch (ent->h_addrtype) {
- case AF_INET:
- for (p = ent->h_addr_list; *p != 0; p++) {
- long *ip4Addr = (long *) *p;
- QHostAddress temp;
- temp.setAddress(ntohl(*ip4Addr));
- addresses << temp;
- }
break;
default:
results.setError(QHostInfo::UnknownError);
results.setErrorString(tr("Unknown address type"));
- break;
}
- results.setAddresses(addresses);
- } else {
- translateWSAError(WSAGetLastError(), &results);
}
+ results.setAddresses(addresses);
+ freeaddrinfo(res);
+ } else {
+ translateWSAError(WSAGetLastError(), &results);
}
#if defined(QHOSTINFO_DEBUG)
diff --git a/src/network/kernel/qnetworkdatagram.cpp b/src/network/kernel/qnetworkdatagram.cpp
index dd412b69d1..d167190684 100644
--- a/src/network/kernel/qnetworkdatagram.cpp
+++ b/src/network/kernel/qnetworkdatagram.cpp
@@ -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
diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp
index 8344fb04c2..64c3fa6f83 100644
--- a/src/network/kernel/qnetworkinterface_win.cpp
+++ b/src/network/kernel/qnetworkinterface_win.cpp
@@ -56,6 +56,7 @@
// (http://sourceforge.net/p/mingw-w64/mailman/message/32935366/)
#include <winsock2.h>
#include <ws2ipdef.h>
+#include <wincrypt.h>
#include <iphlpapi.h>
#include <ws2tcpip.h>
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h
index 73d7ec2e77..5359872f96 100644
--- a/src/network/socket/qnet_unix_p.h
+++ b/src/network/socket/qnet_unix_p.h
@@ -174,16 +174,6 @@ static inline int qt_safe_ioctl(int sockfd, unsigned long request, T arg)
#endif
}
-// VxWorks' headers do not specify any const modifiers
-static inline in_addr_t qt_safe_inet_addr(const char *cp)
-{
-#ifdef Q_OS_VXWORKS
- return ::inet_addr((char *) cp);
-#else
- return ::inet_addr(cp);
-#endif
-}
-
static inline int qt_safe_sendmsg(int sockfd, const struct msghdr *msg, int flags)
{
#ifdef MSG_NOSIGNAL
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index 37b385dfb5..79629a07f2 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -454,10 +454,12 @@ 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())
- result.d->data.truncate(readBytes);
+ readBytes = 0;
+ }
+
+ result.d->data.truncate(readBytes);
return result;
}
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index a8d09feb31..e29ebbe028 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -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;
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 7694bfd6bb..6347d4d231 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -666,7 +666,7 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f)
return kCTFontUIFontSystem;
case QPlatformTheme::TipLabelFont:
- return kCTFontToolTipFontType;
+ return kCTFontUIFontToolTip;
case QPlatformTheme::StatusBarFont:
return kCTFontUIFontSystem;
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
index 5198ffb9f8..bd625f230f 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
@@ -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;
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index cd3b202001..7b0aa52831 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -55,10 +55,10 @@
#if defined(Q_OS_WIN32)
// PMIB_TCPTABLE2 is only available since Vista
-#if _WIN32_WINNT < 0x0600
+#if _WIN32_WINNT < 0x0601
# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0600
-#endif // _WIN32_WINNT < 0x0600
+# define _WIN32_WINNT 0x0601
+#endif // _WIN32_WINNT < 0x0601
#include "../platformdefs_win.h"
#include <iphlpapi.h>
#endif
diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h
index 5a8487d868..0477dc45c3 100644
--- a/src/plugins/bearer/platformdefs_win.h
+++ b/src/plugins/bearer/platformdefs_win.h
@@ -45,6 +45,7 @@
#include <winsock2.h>
#include <mswsock.h>
#undef interface
+#include <wincrypt.h>
#include <winioctl.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index 809aa68365..b5a0a5bbeb 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -520,7 +520,7 @@ static inline int fromBase8(const char *s, const char *end)
{
int result = 0;
while (*s && s != end) {
- if (*s <= '0' || *s >= '7')
+ if (*s < '0' || *s > '7')
return 0;
result *= 8;
result += *s - '0';
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index 06624415d3..e4d670239f 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -104,11 +104,11 @@ namespace QtAndroidAccessibility
static jintArray childIdListForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
{
QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface) {
+ if (iface && iface->isValid()) {
jintArray jArray = env->NewIntArray(jsize(iface->childCount()));
for (int i = 0; i < iface->childCount(); ++i) {
QAccessibleInterface *child = iface->child(i);
- if (child) {
+ if (child && child->isValid()) {
QAccessible::Id ifaceId = QAccessible::uniqueId(child);
jint jid = ifaceId;
env->SetIntArrayRegion(jArray, i, 1, &jid);
@@ -123,9 +123,9 @@ namespace QtAndroidAccessibility
static jint parentId(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
{
QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface) {
+ if (iface && iface->isValid()) {
QAccessibleInterface *parent = iface->parent();
- if (parent) {
+ if (parent && parent->isValid()) {
if (parent->role() == QAccessible::Application)
return -1;
return QAccessible::uniqueId(parent);
@@ -151,7 +151,7 @@ namespace QtAndroidAccessibility
static jint hitTest(JNIEnv */*env*/, jobject /*thiz*/, jfloat x, jfloat y)
{
QAccessibleInterface *root = interfaceFromId(-1);
- if (root) {
+ if (root && root->isValid()) {
QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window());
QAccessibleInterface *child = root->childAt(pos.x(), pos.y());
@@ -170,7 +170,7 @@ namespace QtAndroidAccessibility
{
// qDebug() << "A11Y: CLICK: " << objectId;
QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface && iface->actionInterface()) {
+ if (iface && iface->isValid() && iface->actionInterface()) {
if (iface->actionInterface()->actionNames().contains(QAccessibleActionInterface::pressAction()))
iface->actionInterface()->doAction(QAccessibleActionInterface::pressAction());
else
@@ -182,13 +182,17 @@ namespace QtAndroidAccessibility
static jboolean scrollForward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
{
QAccessibleInterface *iface = interfaceFromId(objectId);
- return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::increaseAction());
+ if (iface && iface->isValid())
+ return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::increaseAction());
+ return false;
}
static jboolean scrollBackward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
{
QAccessibleInterface *iface = interfaceFromId(objectId);
- return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::decreaseAction());
+ if (iface && iface->isValid())
+ return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::decreaseAction());
+ return false;
}
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 8b0b18a846..2bdd49dc50 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -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());
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 55a9d76b67..5354bdafbc 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -1,6 +1,6 @@
TARGET = qcocoa
-OBJECTIVE_SOURCES += main.mm \
+SOURCES += main.mm \
qcocoaintegration.mm \
qcocoascreen.mm \
qcocoatheme.mm \
@@ -32,9 +32,8 @@ OBJECTIVE_SOURCES += main.mm \
qcocoasystemtrayicon.mm \
qcocoaintrospection.mm \
qcocoakeymapper.mm \
- qcocoamimetypes.mm
-
-SOURCES += messages.cpp
+ qcocoamimetypes.mm \
+ messages.cpp
HEADERS += qcocoaintegration.h \
qcocoascreen.h \
@@ -70,7 +69,7 @@ HEADERS += qcocoaintegration.h \
qcocoamimetypes.h
qtConfig(opengl.*) {
- OBJECTIVE_SOURCES += qcocoaglcontext.mm
+ SOURCES += qcocoaglcontext.mm
HEADERS += qcocoaglcontext.h
}
@@ -89,7 +88,7 @@ CONFIG += no_app_extension_api_only
qtHaveModule(widgets) {
QT_FOR_CONFIG += widgets
- OBJECTIVE_SOURCES += \
+ SOURCES += \
qpaintengine_mac.mm \
qprintengine_mac.mm \
qcocoaprintersupport.mm \
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 6af22facf9..13e9d8809e 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -92,7 +92,6 @@
QT_USE_NAMESPACE
-@class QT_MANGLE_NAMESPACE(QNSMenu);
@class QT_MANGLE_NAMESPACE(QNSImageView);
@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate>
@@ -123,16 +122,8 @@ QT_USE_NAMESPACE
-(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton;
@end
-@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu <NSMenuDelegate> {
- QPlatformMenu *qmenu;
-}
--(QPlatformMenu*)menu;
--(id)initWithQMenu:(QPlatformMenu*)qmenu;
-@end
-
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem);
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView);
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSMenu);
QT_BEGIN_NAMESPACE
class QSystemTrayIconSys
@@ -447,26 +438,4 @@ QT_END_NAMESPACE
@end
-class QSystemTrayIconQMenu : public QPlatformMenu
-{
-public:
- void doAboutToShow() { emit aboutToShow(); }
-private:
- QSystemTrayIconQMenu();
-};
-
-@implementation QNSMenu
--(id)initWithQMenu:(QPlatformMenu*)qm {
- self = [super init];
- if (self) {
- self->qmenu = qm;
- [self setDelegate:self];
- }
- return self;
-}
--(QPlatformMenu*)menu {
- return qmenu;
-}
-@end
-
#endif // QT_NO_SYSTEMTRAYICON
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 2094f29770..2aab5fd545 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -55,6 +55,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qcoregraphics_p.h>
#include <QtGui/qpainter.h>
+#include <QtGui/qtextformat.h>
#include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
#include <QtThemeSupport/private/qabstractfileiconengine_p.h>
#include <qpa/qplatformdialoghelper.h>
@@ -344,6 +345,8 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
return QVariant(QChar(0x2022));
case QPlatformTheme::UiEffects:
return QVariant(int(HoverEffect));
+ case QPlatformTheme::SpellCheckUnderlineStyle:
+ return QVariant(int(QTextCharFormat::DotLine));
default:
break;
}
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 4028db2ce9..d9d7870da0 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -262,7 +262,7 @@ public: // for QNSView
bool m_hasModalSession;
bool m_frameStrutEventsEnabled;
- bool m_isExposed;
+ QRect m_exposedRect;
int m_registerTouchCount;
bool m_resizableTransientParent;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 8e5a9268ec..ed942af1b1 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -150,7 +150,6 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle)
, m_needsInvalidateShadow(false)
, m_hasModalSession(false)
, m_frameStrutEventsEnabled(false)
- , m_isExposed(false)
, m_registerTouchCount(0)
, m_resizableTransientParent(false)
, m_alertRequest(NoAlertRequest)
@@ -692,7 +691,7 @@ void QCocoaWindow::lower()
bool QCocoaWindow::isExposed() const
{
- return m_isExposed;
+ return !m_exposedRect.isEmpty();
}
bool QCocoaWindow::isOpaque() const
@@ -1120,7 +1119,7 @@ void QCocoaWindow::handleGeometryChange()
void QCocoaWindow::handleExposeEvent(const QRegion &region)
{
- const bool wasExposed = isExposed();
+ const QRect previouslyExposedRect = m_exposedRect;
// Ideally we'd implement isExposed() in terms of these properties,
// plus the occlusionState of the NSWindow, and let the expose event
@@ -1133,27 +1132,29 @@ void QCocoaWindow::handleExposeEvent(const QRegion &region)
// a window being obscured is an empty region, and in the case of
// a drawRect call is a non-null region, even if occlusionState
// is still hidden. This ensures the window is prepared for display.
- m_isExposed = m_view.window.visible
- && m_view.window.screen
- && !geometry().size().isEmpty()
- && !region.isEmpty()
- && !m_view.hiddenOrHasHiddenAncestor;
+ if (m_view.window.visible && m_view.window.screen
+ && !geometry().size().isEmpty() && !region.isEmpty()
+ && !m_view.hiddenOrHasHiddenAncestor) {
+ m_exposedRect = region.boundingRect();
+ } else {
+ m_exposedRect = QRect();
+ }
QWindowPrivate *windowPrivate = qt_window_private(window());
if (windowPrivate->updateRequestPending) {
// We can only deliver update request events when the window is exposed,
- // and we also have to make sure we deliver the first expose event after
- // becoming exposed as a real expose event, otherwise the exposed state
- // of the QWindow is never updated.
- // FIXME: Should this logic live in QGuiApplication?
- if (wasExposed && m_isExposed) {
+ // and we also have to make sure we deliver any change to the exposed
+ // rect as a real expose event (including going from non-exposed to
+ // exposed). FIXME: Should this logic live in QGuiApplication?
+ if (isExposed() && m_exposedRect == previouslyExposedRect) {
qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::handleExposeEvent" << window() << region << "as update request";
windowPrivate->deliverUpdateRequest();
return;
+ } else {
+ // Since updateRequestPending is still set, we will issue a deferred setNeedsDisplay
+ // from drawRect and get back into this code on the next display cycle, delivering
+ // the pending update request.
}
-
- // FIXME: Should we re-trigger setNeedsDisplay in case of !wasExposed && m_isExposed?
- // Or possibly send the expose event first, and then the update request?
}
qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::handleExposeEvent" << window() << region << "isExposed" << isExposed();
@@ -1669,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;
}
@@ -1693,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];
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 054dca122f..9708aa4ce6 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -324,12 +324,13 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
m_platformWindow->handleExposeEvent(exposedRegion);
- // A call to QWindow::requestUpdate was issued during the expose event, but
- // AppKit will reset the needsDisplay state of the view after completing the
- // current display cycle, so we need to defer the request to redisplay.
- // FIXME: Perhaps this should be a trigger to enable CADisplayLink?
if (qt_window_private(m_platformWindow->window())->updateRequestPending) {
- qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:] deferring setNeedsDisplay";
+ // A call to QWindow::requestUpdate was issued during the expose event, or we
+ // had to deliver a real expose event and still need to deliver the update.
+ // But AppKit will reset the needsDisplay state of the view after completing
+ // the current display cycle, so we need to defer the request to redisplay.
+ // FIXME: Perhaps this should be a trigger to enable CADisplayLink?
+ qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:] issuing deferred setNeedsDisplay due to pending update request";
dispatch_async(dispatch_get_main_queue (), ^{
[self setNeedsDisplay:YES];
});
diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro
index 87405ae19f..99b5491912 100644
--- a/src/plugins/platforms/direct2d/direct2d.pro
+++ b/src/plugins/platforms/direct2d/direct2d.pro
@@ -2,9 +2,10 @@ TARGET = qdirect2d
QT += \
core-private gui-private \
- eventdispatcher_support-private accessibility_support-private \
+ eventdispatcher_support-private \
fontdatabase_support-private theme_support-private
+qtConfig(accessibility): QT += accessibility_support-private
qtConfig(vulkan): QT += vulkan_support-private
LIBS += -ldwmapi -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 722c5118fe..d07c413100 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -47,7 +47,9 @@
#include "qwindowsmenu.h"
#include "qwindowsmime.h"
#include "qwindowsinputcontext.h"
-#include "qwindowstabletsupport.h"
+#if QT_CONFIG(tabletevent)
+# include "qwindowstabletsupport.h"
+#endif
#include "qwindowstheme.h"
#include <private/qguiapplication_p.h>
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 2c9228be44..cf83525c6c 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -39,7 +39,9 @@
#define QT_NO_URL_CAST_FROM_STRING 1
-#define _WIN32_WINNT 0x0600
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0601
+#endif
#include "qwindowscombase.h"
#include "qwindowsdialoghelpers.h"
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 2f556a66df..814291c54a 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -37,13 +37,6 @@
**
****************************************************************************/
-#if defined(WINVER) && WINVER < 0x0601
-# undef WINVER
-#endif
-#if !defined(WINVER)
-# define WINVER 0x0601 // Enable touch functions for MinGW
-#endif
-
#include "qwindowsmousehandler.h"
#include "qwindowskeymapper.h"
#include "qwindowscontext.h"
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index b1f0062979..fba4e8f386 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -352,16 +352,26 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L
{
PACKET proximityBuffer[1]; // we are only interested in the first packet in this case
const int totalPacks = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, 1, proximityBuffer);
- if (!totalPacks)
- return false;
+
if (!LOWORD(lParam)) {
qCDebug(lcQpaTablet) << "leave proximity for device #" << m_currentDevice;
- QWindowSystemInterface::handleTabletLeaveProximityEvent(proximityBuffer[0].pkTime,
- m_devices.at(m_currentDevice).currentDevice,
- m_devices.at(m_currentDevice).currentPointerType,
- m_devices.at(m_currentDevice).uniqueId);
+ if (totalPacks > 0) {
+ QWindowSystemInterface::handleTabletLeaveProximityEvent(proximityBuffer[0].pkTime,
+ m_devices.at(m_currentDevice).currentDevice,
+ m_devices.at(m_currentDevice).currentPointerType,
+ m_devices.at(m_currentDevice).uniqueId);
+ } else {
+ QWindowSystemInterface::handleTabletLeaveProximityEvent(m_devices.at(m_currentDevice).currentDevice,
+ m_devices.at(m_currentDevice).currentPointerType,
+ m_devices.at(m_currentDevice).uniqueId);
+
+ }
return true;
}
+
+ if (!totalPacks)
+ return false;
+
const UINT currentCursor = proximityBuffer[0].pkCursor;
UINT physicalCursorId;
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &physicalCursorId);
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index a1ccf1f83c..651c661d6b 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -38,9 +38,9 @@
****************************************************************************/
// SHSTOCKICONINFO is only available since Vista
-#if _WIN32_WINNT < 0x0600
+#if _WIN32_WINNT < 0x0601
# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0600
+# define _WIN32_WINNT 0x0601
#endif
#include "qwindowstheme.h"
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 16df5974ad..24eab2c662 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -702,7 +702,7 @@ void WindowCreationData::initialize(const QWindow *w, HWND hwnd, bool frameChang
{
if (!hwnd)
return;
- UINT swpFlags = SWP_NOMOVE | SWP_NOSIZE;
+ UINT swpFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER;
if (frameChange)
swpFlags |= SWP_FRAMECHANGED;
if (topLevel) {
@@ -906,7 +906,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);
}
}
@@ -914,7 +914,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);
}
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index 4d788d91f8..174bc7b609 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -2,9 +2,10 @@ TARGET = qwindows
QT += \
core-private gui-private \
- eventdispatcher_support-private accessibility_support-private \
+ eventdispatcher_support-private \
fontdatabase_support-private theme_support-private
+qtConfig(accessibility): QT += accessibility_support-private
qtConfig(vulkan): QT += vulkan_support-private
LIBS += -lgdi32 -ldwmapi
diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp
index e259fbf0b4..e18a08755b 100644
--- a/src/plugins/platforms/xcb/qxcbimage.cpp
+++ b/src/plugins/platforms/xcb/qxcbimage.cpp
@@ -184,7 +184,7 @@ QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap
image = std::move(image).rgbSwapped();
// 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)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 475a4e37f3..9c34fccd48 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -859,7 +859,9 @@ void QXcbWindow::hide()
if (QWindow *childWindow = childWindowAt(enterWindow, cursorPos))
enterWindow = childWindow;
const QPoint localPos = enterWindow->mapFromGlobal(cursorPos);
- QWindowSystemInterface::handleEnterEvent(enterWindow, localPos, cursorPos);
+ QWindowSystemInterface::handleEnterEvent(enterWindow,
+ localPos * QHighDpiScaling::factor(enterWindow),
+ nativePos);
}
}
}
diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp
index e7949d3a0b..6a4eecb06d 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp
@@ -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();
diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp
index e384a1e194..ba2c75ad66 100644
--- a/src/tools/uic/cpp/cppwritedeclaration.cpp
+++ b/src/tools/uic/cpp/cppwritedeclaration.cpp
@@ -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();
diff --git a/src/widgets/doc/images/widgets-tutorial-toplevel.png b/src/widgets/doc/images/widgets-tutorial-toplevel.png
index a80d13c50d..bf7879f5aa 100644
--- a/src/widgets/doc/images/widgets-tutorial-toplevel.png
+++ b/src/widgets/doc/images/widgets-tutorial-toplevel.png
Binary files differ
diff --git a/src/widgets/doc/src/qtwidgets-index.qdoc b/src/widgets/doc/src/qtwidgets-index.qdoc
index c05b16a0a0..7cd1c8d735 100644
--- a/src/widgets/doc/src/qtwidgets-index.qdoc
+++ b/src/widgets/doc/src/qtwidgets-index.qdoc
@@ -118,7 +118,7 @@ interfaces
which use lists and tables are structured to separate the data and view
using models, views, and delegates.
- \image windowsvista-treeview.png
+ \image windows-treeview.png
\section1 Graphics View
diff --git a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
index 700a4479fd..3b134a3f96 100644
--- a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
@@ -62,7 +62,7 @@
\table
\row
- \li \image windowsvista-treeview.png
+ \li \image windows-treeview.png
\li \image fusion-calendarwidget.png
\li \image qundoview.png
\endtable
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 9d70825b0e..211c09ee71 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -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();
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 15e6b0eb99..23e727e670 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -2194,7 +2194,7 @@ QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const Q
{
QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport;
if (!overwrite) {
- const int margin = 2;
+ const int margin = qBound(2, qRound(qreal(rect.height()) / 5.5), 12);
if (pos.y() - rect.top() < margin) {
r = QAbstractItemView::AboveItem;
} else if (rect.bottom() - pos.y() < margin) {
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 0585a59e89..f944a7097b 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -289,8 +289,10 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
// not the QMenu.) Since we can also reach this code by climbing the menu
// hierarchy (see below), or when the shortcut is not a key-equivalent, we
// need to check whether the QPA menu is actually disabled.
+ // When there is no QPA menu, there will be no QCocoaMenuDelegate checking
+ // for the actual shortcuts. We can then fallback to our own logic.
QPlatformMenu *pm = menu->platformMenu();
- if (!pm || !pm->isEnabled())
+ if (pm && !pm->isEnabled())
continue;
#endif
QAction *a = menu->menuAction();
diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri
index 7cef2d14a8..f6877b02db 100644
--- a/src/widgets/kernel/win.pri
+++ b/src/widgets/kernel/win.pri
@@ -3,5 +3,3 @@
INCLUDEPATH += ../3rdparty/wintab
!winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi
-# Override MinGW's definition in _mingw.h
-mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 0350d5e1a5..faa5f1e67e 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1840,9 +1840,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_UnderlineShortcut Whether shortcuts are underlined.
- \value SH_SpellCheckUnderlineStyle A
- QTextCharFormat::UnderlineStyle value that specifies the way
- misspelled words should be underlined.
+ \value SH_SpellCheckUnderlineStyle Obsolete. Use SpellCheckUnderlineStyle
+ hint in QPlatformTheme instead.
\value SH_SpinBox_AnimateButton Animate a click when up or down is
pressed in a spin box.
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index e560e713fb..4f498efac0 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -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
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index caf175e6ff..8187b8f35c 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
\ingroup basicwidgets
\inmodule QtWidgets
- \image windows-pushbutton.jpg
+ \image windows-pushbutton.png
The push button, or command button, is perhaps the most commonly
used widget in any graphical user interface. Push (click) a button
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index 3612a04e99..d4f14ad1d4 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -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