summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-13 01:00:13 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-13 01:00:13 +0100
commit0441d959ff87431ab432ce0c30bbb857a631742e (patch)
tree25c6c4293f74e39b9d4cf45b15957f233cffa9c5 /src
parentae0dd3201bc13b81c62752bb04e42362c78bfe16 (diff)
parent8c685b765bf4ceba3c4cf8fdd9c9d680f338b7a9 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/angle/src/common/mathutil.h8
-rw-r--r--src/3rdparty/angle/src/common/platform.h2
-rw-r--r--src/3rdparty/sha3/qt_attribution.json2
-rw-r--r--src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch63
-rw-r--r--src/corelib/global/qprocessordetection.h9
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp21
-rw-r--r--src/corelib/thread/qthreadpool.cpp79
-rw-r--r--src/corelib/thread/qthreadpool_p.h6
-rw-r--r--src/corelib/tools/qline.cpp7
-rw-r--r--src/corelib/tools/qt_attribution.json4
-rw-r--r--src/gui/doc/snippets/qimagewriter/main.cpp71
-rw-r--r--src/gui/image/qimagewriter.cpp10
-rw-r--r--src/gui/kernel/qscreen.cpp7
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp14
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm5
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp3
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm2
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp5
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp6
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp7
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp3
25 files changed, 275 insertions, 77 deletions
diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
index 372e432066..88aedddfe8 100644
--- a/src/3rdparty/angle/src/common/mathutil.h
+++ b/src/3rdparty/angle/src/common/mathutil.h
@@ -150,7 +150,7 @@ inline bool supportsSSE2()
return supports;
}
-#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
+#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
{
int info[4];
__cpuid(info, 0);
@@ -162,7 +162,7 @@ inline bool supportsSSE2()
supports = (info[3] >> 26) & 1;
}
}
-#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
+#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
checked = true;
return supports;
#else // defined(ANGLE_USE_SSE)
@@ -884,14 +884,14 @@ inline uint32_t BitfieldReverse(uint32_t value)
// Count the 1 bits.
#if defined(ANGLE_PLATFORM_WINDOWS)
-#if defined(_M_ARM)
+#if defined(_M_ARM) || defined(_M_ARM64)
inline int BitCount(uint32_t bits)
{
bits = bits - ((bits >> 1) & 0x55555555);
bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
return (((bits + (bits >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
-#else // _M_ARM
+#else // _M_ARM || _M_ARM64
inline int BitCount(uint32_t bits)
{
return static_cast<int>(__popcnt(bits));
diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
index 47cd57b999..fb251da579 100644
--- a/src/3rdparty/angle/src/common/platform.h
+++ b/src/3rdparty/angle/src/common/platform.h
@@ -83,7 +83,7 @@
# undef far
#endif
-#if defined(_MSC_VER) && !defined(_M_ARM)
+#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
#include <intrin.h>
#define ANGLE_USE_SSE
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) && !defined(__MINGW32__)
diff --git a/src/3rdparty/sha3/qt_attribution.json b/src/3rdparty/sha3/qt_attribution.json
index 4866be32ea..5e6e993e19 100644
--- a/src/3rdparty/sha3/qt_attribution.json
+++ b/src/3rdparty/sha3/qt_attribution.json
@@ -17,9 +17,11 @@
"Name": "Secure Hash Algorithm SHA-3 - Keccak",
"QDocModule": "qtcore",
"QtUsage": "Used in Qt Core (QCryptographicHash).",
+ "Files": "https://keccak.team/obsolete/KeccakReferenceAndOptimized-3.2.zip - but it's obsolete",
"Files": "KeccakF-1600-32-rvk.macros KeccakF-1600-32.macros KeccakF-1600-64.macros KeccakF-1600-interface.h KeccakF-1600-opt32.c KeccakF-1600-opt64.c KeccakF-1600-unrolling.macros KeccakNISTInterface.c KeccakNISTInterface.h KeccakSponge.c KeccakSponge.h",
"Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.",
+ "Version": "3.2",
"License": "Creative Commons Zero v1.0 Universal",
"LicenseId": "CC0-1.0",
"LicenseFile": "CC0_LICENSE",
diff --git a/src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch b/src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch
new file mode 100644
index 0000000000..3a43894a8a
--- /dev/null
+++ b/src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch
@@ -0,0 +1,63 @@
+From 416fb93dae5009bb51da9f6720a95918a2c79e78 Mon Sep 17 00:00:00 2001
+From: Thomas Miller <thomaslmiller91@gmail.com>
+Date: Tue Oct 16 08:29:58 2018 -0700
+Subject: [PATCH] ANGLE: Fix build for ARM64
+
+__popcnt, SSE, and intrin.h are not available when building for ARM64.
+---
+ src/3rdparty/angle/src/common/mathutil.h | 8 ++++----
+ src/3rdparty/angle/src/common/platform.h | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
+index 372e432066..88aedddfe8 100644
+--- a/src/3rdparty/angle/src/common/mathutil.h
++++ b/src/3rdparty/angle/src/common/mathutil.h
+@@ -150,7 +150,7 @@ inline bool supportsSSE2()
+ return supports;
+ }
+
+-#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
++#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
+ {
+ int info[4];
+ __cpuid(info, 0);
+@@ -162,7 +162,7 @@ inline bool supportsSSE2()
+ supports = (info[3] >> 26) & 1;
+ }
+ }
+-#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
++#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
+ checked = true;
+ return supports;
+ #else // defined(ANGLE_USE_SSE)
+@@ -884,14 +884,14 @@ inline uint32_t BitfieldReverse(uint32_t value)
+
+ // Count the 1 bits.
+ #if defined(ANGLE_PLATFORM_WINDOWS)
+-#if defined(_M_ARM)
++#if defined(_M_ARM) || defined(_M_ARM64)
+ inline int BitCount(uint32_t bits)
+ {
+ bits = bits - ((bits >> 1) & 0x55555555);
+ bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
+ return (((bits + (bits >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
+ }
+-#else // _M_ARM
++#else // _M_ARM || _M_ARM64
+ inline int BitCount(uint32_t bits)
+ {
+ return static_cast<int>(__popcnt(bits));
+diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
+index 47cd57b999..fb251da579 100644
+--- a/src/3rdparty/angle/src/common/platform.h
++++ b/src/3rdparty/angle/src/common/platform.h
+@@ -83,7 +83,7 @@
+ # undef far
+ #endif
+
+-#if defined(_MSC_VER) && !defined(_M_ARM)
++#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
+ #include <intrin.h>
+ #define ANGLE_USE_SSE
+ #elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) && !defined(__MINGW32__)
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index aaa27dff4a..77b3ba36b0 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -94,8 +94,8 @@
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to
auto-detection implemented below.
*/
-#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__) || defined(__ARM64__)
-# if defined(__aarch64__) || defined(__ARM64__)
+#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)
+# if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
# define Q_PROCESSOR_ARM_64
# define Q_PROCESSOR_WORDSIZE 8
# else
@@ -110,7 +110,8 @@
# elif defined(__ARM64_ARCH_8__) \
|| defined(__aarch64__) \
|| defined(__ARMv8__) \
- || defined(__ARMv8_A__)
+ || defined(__ARMv8_A__) \
+ || defined(_M_ARM64)
# define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \
@@ -148,7 +149,7 @@
# else
# error "ARM architecture too old"
# endif
-# if defined(__ARMEL__)
+# if defined(__ARMEL__) || defined(_M_ARM64)
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# elif defined(__ARMEB__)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 5a5a3a82c6..b2d81066db 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -285,7 +285,7 @@ mtime(const T &statBuffer, int)
{ return timespecToMSecs(statBuffer.st_mtimespec); }
#endif
-#ifndef st_mtimensec
+#if !defined(st_mtimensec) && !defined(__alpha__)
// Xtimensec
template <typename T>
Q_DECL_UNUSED static typename std::enable_if<(&T::st_atimensec, true), qint64>::type
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 3b7135e582..a5e629b646 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -330,13 +330,24 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path
while (it.hasNext()) {
QString path = it.next();
int id = pathToID.take(path);
- QString x = idToPath.take(id);
- if (x.isEmpty() || x != path)
+
+ // Multiple paths could be associated to the same watch descriptor
+ // when a file is moved and added with the new name.
+ // So we should find and delete the correct one by using
+ // both id and path
+ auto path_range = idToPath.equal_range(id);
+ auto path_it = std::find(path_range.first, path_range.second, path);
+ if (path_it == idToPath.end())
continue;
- int wd = id < 0 ? -id : id;
- // qDebug() << "removing watch for path" << path << "wd" << wd;
- inotify_rm_watch(inotifyFd, wd);
+ const ssize_t num_elements = std::distance(path_range.first, path_range.second);
+ idToPath.erase(path_it);
+
+ // If there was only one path associated to the given id we should remove the watch
+ if (num_elements == 1) {
+ int wd = id < 0 ? -id : id;
+ inotify_rm_watch(inotifyFd, wd);
+ }
it.remove();
if (id < 0) {
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index ea2c611082..4d2389f699 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -39,7 +39,7 @@
#include "qthreadpool.h"
#include "qthreadpool_p.h"
-#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
#include <algorithm>
@@ -130,11 +130,6 @@ void QThreadPoolThread::run()
}
} while (true);
- if (manager->isExiting) {
- registerThreadInactive();
- break;
- }
-
// if too many threads are active, expire this thread
bool expired = manager->tooManyThreadsActive();
if (!expired) {
@@ -145,6 +140,10 @@ void QThreadPoolThread::run()
++manager->activeThreads;
if (manager->waitingThreads.removeOne(this))
expired = true;
+ if (!manager->allThreads.contains(this)) {
+ registerThreadInactive();
+ break;
+ }
}
if (expired) {
manager->expiredThreads.enqueue(this);
@@ -267,7 +266,7 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable)
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)
- allThreads.append(thread.data());
+ allThreads.insert(thread.data());
++activeThreads;
if (runnable->autoDelete())
@@ -278,49 +277,54 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable)
/*!
\internal
- Makes all threads exit, waits for each thread to exit and deletes it.
+
+ Helper function only to be called from waitForDone(int)
*/
void QThreadPoolPrivate::reset()
{
- QMutexLocker locker(&mutex);
- isExiting = true;
-
- while (!allThreads.empty()) {
- // move the contents of the set out so that we can iterate without the lock
- QList<QThreadPoolThread *> allThreadsCopy;
- allThreadsCopy.swap(allThreads);
- locker.unlock();
+ // move the contents of the set out so that we can iterate without the lock
+ QSet<QThreadPoolThread *> allThreadsCopy;
+ allThreadsCopy.swap(allThreads);
+ expiredThreads.clear();
+ waitingThreads.clear();
+ mutex.unlock();
- for (QThreadPoolThread *thread : qAsConst(allThreadsCopy)) {
+ for (QThreadPoolThread *thread: qAsConst(allThreadsCopy)) {
+ if (!thread->isFinished()) {
thread->runnableReady.wakeAll();
thread->wait();
- delete thread;
}
-
- locker.relock();
- // repeat until all newly arrived threads have also completed
+ delete thread;
}
- waitingThreads.clear();
- expiredThreads.clear();
+ mutex.lock();
+}
+
+/*!
+ \internal
- isExiting = false;
+ Helper function only to be called from waitForDone(int)
+*/
+bool QThreadPoolPrivate::waitForDone(const QDeadlineTimer &timer)
+{
+ while (!(queue.isEmpty() && activeThreads == 0) && !timer.hasExpired())
+ noActiveThreads.wait(&mutex, timer);
+
+ return queue.isEmpty() && activeThreads == 0;
}
bool QThreadPoolPrivate::waitForDone(int msecs)
{
QMutexLocker locker(&mutex);
- if (msecs < 0) {
- while (!(queue.isEmpty() && activeThreads == 0))
- noActiveThreads.wait(locker.mutex());
- } else {
- QElapsedTimer timer;
- timer.start();
- int t;
- while (!(queue.isEmpty() && activeThreads == 0) &&
- ((t = msecs - timer.elapsed()) > 0))
- noActiveThreads.wait(locker.mutex(), t);
- }
+ QDeadlineTimer timer(msecs);
+ do {
+ if (!waitForDone(timer))
+ return false;
+ reset();
+ // More threads can be started during reset(), in that case continue
+ // waiting if we still have time left.
+ } while ((!queue.isEmpty() || activeThreads) && !timer.hasExpired());
+
return queue.isEmpty() && activeThreads == 0;
}
@@ -686,10 +690,7 @@ void QThreadPool::releaseThread()
bool QThreadPool::waitForDone(int msecs)
{
Q_D(QThreadPool);
- bool rc = d->waitForDone(msecs);
- if (rc)
- d->reset();
- return rc;
+ return d->waitForDone(msecs);
}
/*!
diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h
index 0e6a00d243..952e02ef20 100644
--- a/src/corelib/thread/qthreadpool_p.h
+++ b/src/corelib/thread/qthreadpool_p.h
@@ -63,6 +63,8 @@ QT_REQUIRE_CONFIG(thread);
QT_BEGIN_NAMESPACE
+class QDeadlineTimer;
+
class QueuePage {
public:
enum {
@@ -163,12 +165,13 @@ public:
void startThread(QRunnable *runnable = 0);
void reset();
bool waitForDone(int msecs);
+ bool waitForDone(const QDeadlineTimer &timer);
void clear();
void stealAndRunRunnable(QRunnable *runnable);
void deletePageIfFinished(QueuePage *page);
mutable QMutex mutex;
- QList<QThreadPoolThread *> allThreads;
+ QSet<QThreadPoolThread *> allThreads;
QQueue<QThreadPoolThread *> waitingThreads;
QQueue<QThreadPoolThread *> expiredThreads;
QVector<QueuePage*> queue;
@@ -179,7 +182,6 @@ public:
int reservedThreads = 0;
int activeThreads = 0;
uint stackSize = 0;
- bool isExiting = false;
};
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 9704a00b85..949f63ea15 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -387,10 +387,9 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
\value UnboundedIntersection The two lines intersect, but not
within the range defined by their lengths. This will be the case
- if the lines are not parallel.
-
- intersect() will also return this value if the intersect point is
- within the start and end point of only one of the lines.
+ if the lines are not parallel. intersect() will also return this
+ value if the intersect point is within the start and end point of
+ only one of the lines.
\value BoundedIntersection The two lines intersect with each other
within the start and end points of each line.
diff --git a/src/corelib/tools/qt_attribution.json b/src/corelib/tools/qt_attribution.json
index 5bb95c9f5b..a842d9467b 100644
--- a/src/corelib/tools/qt_attribution.json
+++ b/src/corelib/tools/qt_attribution.json
@@ -4,12 +4,14 @@
"Name": "Unicode Character Database (UCD)",
"QDocModule": "qtcore",
"QtUsage": "Qt Core uses data obtained from UCD files for working with characters and strings.",
+ "Files": "For update, see qtbase/util/unicode/README",
"Files": "qunicodetables_p.h qunicodetables.cpp",
"Description": "The Unicode Character Database (UCD) is a set of files that
define the Unicode character properties and internal mappings.",
"Homepage": "https://www.unicode.org/ucd/",
- "Version": "10.0.0",
+ "Version": "Don't use the Unicode standard version; UCD has its own 'Revision' numbers",
+ "Version": "20",
"License": "Unicode License Agreement - Data Files and Software (2016)",
"LicenseId": "Unicode-DFS-2016",
"LicenseFile": "UNICODE_LICENSE.txt",
diff --git a/src/gui/doc/snippets/qimagewriter/main.cpp b/src/gui/doc/snippets/qimagewriter/main.cpp
new file mode 100644
index 0000000000..3758110356
--- /dev/null
+++ b/src/gui/doc/snippets/qimagewriter/main.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Samuel Gaist <samuel.gaist@idiap.ch>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "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 The Qt Company Ltd nor the names of its
+** 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+//! [0]
+ QString imagePath(QStringLiteral("path/image.jpeg"));
+ QImage image(64, 64, QImage::Format_RGB32);
+ image.fill(Qt::red);
+ {
+ QImageWriter writer(imagePath);
+ writer.write(image);
+ }
+
+ QFile::rename(imagePath,
+ QStringLiteral("path/other_image.jpeg"));
+//! [0]
+
+ return 0;
+}
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 5ce7e309bb..d3f9a9b881 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -71,6 +71,16 @@
formats, in addition to any image format plugins that support
writing.
+ \note QImageWriter assumes exclusive control over the file or
+ device that is assigned. Any attempts to modify the assigned file
+ or device during the lifetime of the QImageWriter object will
+ yield undefined results. If immediate access to a resource is
+ desired, the use of a scope is the recommended method.
+
+ For example:
+
+ \snippet qimagewriter/main.cpp 0
+
\sa QImageReader, QImageIOHandler, QImageIOPlugin
*/
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 479e228e27..f208eb02be 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -701,6 +701,11 @@ void QScreenPrivate::updatePrimaryOrientation()
border of the window. If \a height is negative, the function
copies everything to the bottom of the window.
+ The offset and size arguments are specified in device independent
+ pixels. The returned pixmap may be larger than the requested size
+ when grabbing from a high-DPI screen. Call QPixmap::devicePixelRatio()
+ to determine if this is the case.
+
The window system identifier (\c WId) can be retrieved using the
QWidget::winId() function. The rationale for using a window
identifier and not a QWidget, is to enable grabbing of windows
@@ -748,7 +753,7 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height)
QPixmap result =
platformScreen->grabWindow(window, nativePos.x(), nativePos.y(),
nativeSize.width(), nativeSize.height());
- result.setDevicePixelRatio(factor);
+ result.setDevicePixelRatio(result.devicePixelRatio() * factor);
return result;
}
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 6ca4bc8209..008f695da0 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1912,7 +1912,7 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co
}
/*!
- Prints the document to the given \a printer. The QPageablePaintDevice must be
+ Prints the document to the given \a printer. The QPagedPaintDevice must be
set up before being used with this function.
This is only a convenience method to print the whole document to the printer.
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index b380b0f7d6..24c17124dc 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -1383,20 +1383,24 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
// No data was available for reading
r = -2;
break;
- case EBADF:
- case EINVAL:
- case EIO:
- //error string is now set in read(), not here in nativeRead()
- break;
case ECONNRESET:
#if defined(Q_OS_VXWORKS)
case ESHUTDOWN:
#endif
r = 0;
break;
+ case ETIMEDOUT:
+ socketError = QAbstractSocket::SocketTimeoutError;
+ break;
default:
+ socketError = QAbstractSocket::NetworkError;
break;
}
+
+ if (r == -1) {
+ hasSetSocketError = true;
+ socketErrorString = qt_error_string();
+ }
}
#if defined (QNATIVESOCKETENGINE_DEBUG)
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm
index f82ef202b1..0d6567070e 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.mm
+++ b/src/plugins/platforms/cocoa/qcocoascreen.mm
@@ -466,6 +466,7 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
const qreal dpr = devicePixelRatio();
QPixmap windowPixmap(windowSize * dpr);
+ windowPixmap.setDevicePixelRatio(dpr);
windowPixmap.fill(Qt::transparent);
for (uint i = 0; i < displayCount; ++i) {
@@ -473,8 +474,8 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
// Calculate the position and size of the requested area
QPoint pos(qAbs(bounds.origin.x - x), qAbs(bounds.origin.y - y));
- QSize size(qMin(pos.x() + width, qRound(bounds.size.width)),
- qMin(pos.y() + height, qRound(bounds.size.height)));
+ QSize size(qMin(width, qRound(bounds.size.width)),
+ qMin(height, qRound(bounds.size.height)));
pos *= dpr;
size *= dpr;
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 681b35eb7c..b629cc00a3 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -558,6 +558,10 @@ public:
SFGAOF attributes() const { return m_attributes; }
QString normalDisplay() const // base name, usually
{ return displayName(m_item, SIGDN_NORMALDISPLAY); }
+ QString urlString() const
+ { return displayName(m_item, SIGDN_URL); }
+ QString fileSysPath() const
+ { return displayName(m_item, SIGDN_FILESYSPATH); }
QString desktopAbsoluteParsing() const
{ return displayName(m_item, SIGDN_DESKTOPABSOLUTEPARSING); }
QString path() const; // Only set for 'FileSystem' (SFGAO_FILESYSTEM) items
@@ -734,7 +738,8 @@ void QWindowsShellItem::format(QDebug &d) const
if (canCopy())
d << " [copyable]";
d << ", normalDisplay=\"" << normalDisplay()
- << "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing() << '"';
+ << "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing()
+ << "\", urlString=\"" << urlString() << "\", fileSysPath=\"" << fileSysPath() << '"';
const QString pathS = path();
if (!pathS.isEmpty())
d << ", path=\"" << pathS << '"';
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 9e6101b758..96abfdb9d7 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -1263,6 +1263,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
}
#endif // !QT_NO_SHORTCUT
key_recorder.storeKey(int(msg.wParam), a, state, text);
+
+ // QTBUG-71210
+ // VK_PACKET specifies multiple characters. The system only sends the first
+ // character of this sequence for each.
+ if (msg.wParam == VK_PACKET)
+ code = asciiToKeycode(char(uch.cell()), state);
+
QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code,
modifiers, scancode, quint32(msg.wParam), nModifiers, text, false);
result =true;
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index c8c806749f..ba9a3e68ee 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -837,6 +837,9 @@ void QXcbBackingStore::endPaint()
QImage QXcbBackingStore::toImage() const
{
+ // If the backingstore is rgbSwapped, return the internal image type here.
+ if (!m_rgbImage.isNull())
+ return m_rgbImage;
return m_image && m_image->image() ? *m_image->image() : QImage();
}
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 0204bd6104..1fd3420899 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -1512,7 +1512,7 @@ QRectF QMacStylePrivate::CocoaControl::adjustedControlFrame(const QRectF &rect)
frameRect = frameRect.translated(rect.topLeft());
if (type == QMacStylePrivate::Button_PullDown || type == QMacStylePrivate::Button_PopupButton) {
if (size == QStyleHelper::SizeLarge)
- frameRect = frameRect.adjusted(0, 0, -6, 0).translated(3, -1);
+ frameRect = frameRect.adjusted(0, 0, -6, 0).translated(3, 0);
else if (size == QStyleHelper::SizeSmall)
frameRect = frameRect.adjusted(0, 0, -4, 0).translated(2, 1);
else if (size == QStyleHelper::SizeMini)
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
index 2115a14adf..738905a9a0 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
@@ -212,8 +212,11 @@ static QString generateInterfaceXml(const ClassDef *mo)
access |= 2;
int typeId = QMetaType::type(mp.type.constData());
- if (!typeId)
+ if (!typeId) {
+ fprintf(stderr, PROGRAMNAME ": unregistered type: '%s', ignoring\n",
+ mp.type.constData());
continue;
+ }
const char *signature = QDBusMetaType::typeToSignature(typeId);
if (!signature)
continue;
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 99157747dd..d8cd19ef1a 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1844,10 +1844,10 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
"<p>Qt licensed under our commercial license agreement is appropriate "
"for development of proprietary/commercial software where you do not "
"want to share any source code with third parties or otherwise cannot "
- "comply with the terms of the GNU LGPL version 3.</p>"
- "<p>Qt licensed under the GNU LGPL version 3 is appropriate for the "
+ "comply with the terms of GNU (L)GPL.</p>"
+ "<p>Qt licensed under GNU (L)GPL is appropriate for the "
"development of Qt&nbsp;applications provided you can comply with the terms "
- "and conditions of the GNU LGPL version 3.</p>"
+ "and conditions of the respective licenses.</p>"
"<p>Please see <a href=\"http://%2/\">%2</a> "
"for an overview of Qt licensing.</p>"
"<p>Copyright (C) %1 The Qt Company Ltd and other "
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index b40c2d12ad..a32eb2a03b 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -101,6 +101,13 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen))
return;
+
+ // Foreign Windows do not have backing store content and must not be flushed
+ if (QWindow *widgetWindow = widget->windowHandle()) {
+ if (widgetWindow->type() == Qt::ForeignWindow)
+ return;
+ }
+
static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS");
if (fpsDebug) {
if (!widgetBackingStore->perfFrames++)
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 0b2d72f330..279c6c0282 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -642,7 +642,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (!widget)
widget = m_widget;
- if (event->type() == QEvent::MouseButtonPress)
+ const bool initialPress = event->buttons() == event->button();
+ if (event->type() == QEvent::MouseButtonPress && initialPress)
qt_button_down = widget;
QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(),