summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-06-07 17:10:56 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-06-07 17:10:57 +0200
commitfc5da399c3145621c5945d53dde7b37fa463c6e9 (patch)
tree8deec4c78b5add097ba7f2b1e371f27e3ae759c5 /src
parent225dcf355a95f272aaa7ac236c7274e254dca41c (diff)
parenta14a943f9ac3d1e85514d7fb6688c84e624ac850 (diff)
Merge 5.11 into 5.11.1
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.cpp4
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp16
-rw-r--r--src/corelib/thread/qatomic_msvc.h485
-rw-r--r--src/corelib/thread/qbasicatomic.h14
-rw-r--r--src/corelib/thread/qthread.cpp19
-rw-r--r--src/corelib/thread/thread.pri2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp6
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp7
-rw-r--r--src/gui/painting/qpagesize.cpp6
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--src/network/access/http2/hpacktable.cpp2
-rw-r--r--src/network/kernel/qhostaddress.cpp2
-rw-r--r--src/network/ssl/qsslconfiguration.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp9
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp8
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm18
-rw-r--r--src/testlib/qbenchmarkmetric.cpp4
-rw-r--r--src/widgets/util/qcompleter.cpp1
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp4
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp2
22 files changed, 567 insertions, 50 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 2fbd31b3d7..605683b852 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -3990,7 +3990,7 @@ Q_GLOBAL_STATIC(QInternal_CallBackTable, global_callback_table)
bool QInternal::registerCallback(Callback cb, qInternalCallback callback)
{
- if (cb >= 0 && cb < QInternal::LastCallback) {
+ if (unsigned(cb) < unsigned(QInternal::LastCallback)) {
QInternal_CallBackTable *cbt = global_callback_table();
cbt->callbacks.resize(cb + 1);
cbt->callbacks[cb].append(callback);
@@ -4001,7 +4001,7 @@ bool QInternal::registerCallback(Callback cb, qInternalCallback callback)
bool QInternal::unregisterCallback(Callback cb, qInternalCallback callback)
{
- if (cb >= 0 && cb < QInternal::LastCallback) {
+ if (unsigned(cb) < unsigned(QInternal::LastCallback)) {
if (global_callback_table.exists()) {
QInternal_CallBackTable *cbt = global_callback_table();
return (bool) cbt->callbacks[cb].removeAll(callback);
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp
index 6356a3581b..9dadebc999 100644
--- a/src/corelib/mimetypes/qmimemagicrule.cpp
+++ b/src/corelib/mimetypes/qmimemagicrule.cpp
@@ -315,18 +315,14 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
break;
case Big32:
case Little32:
- if (m_number <= quint32(-1)) {
- m_number = m_type == Little32 ? qFromLittleEndian<quint32>(m_number) : qFromBigEndian<quint32>(m_number);
- if (m_numberMask != 0)
- m_numberMask = m_type == Little32 ? qFromLittleEndian<quint32>(m_numberMask) : qFromBigEndian<quint32>(m_numberMask);
- }
+ m_number = m_type == Little32 ? qFromLittleEndian<quint32>(m_number) : qFromBigEndian<quint32>(m_number);
+ if (m_numberMask != 0)
+ m_numberMask = m_type == Little32 ? qFromLittleEndian<quint32>(m_numberMask) : qFromBigEndian<quint32>(m_numberMask);
Q_FALLTHROUGH();
case Host32:
- if (m_number <= quint32(-1)) {
- if (m_numberMask == 0)
- m_numberMask = quint32(-1);
- m_matchFunction = &QMimeMagicRule::matchNumber<quint32>;
- }
+ if (m_numberMask == 0)
+ m_numberMask = quint32(-1);
+ m_matchFunction = &QMimeMagicRule::matchNumber<quint32>;
break;
default:
break;
diff --git a/src/corelib/thread/qatomic_msvc.h b/src/corelib/thread/qatomic_msvc.h
new file mode 100644
index 0000000000..5eae2bdc48
--- /dev/null
+++ b/src/corelib/thread/qatomic_msvc.h
@@ -0,0 +1,485 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QATOMIC_MSVC_H
+#define QATOMIC_MSVC_H
+
+#include <QtCore/qgenericatomic.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// use compiler intrinsics for all atomic functions
+# define QT_INTERLOCKED_PREFIX _
+# define QT_INTERLOCKED_PROTOTYPE
+# define QT_INTERLOCKED_DECLARE_PROTOTYPES
+# define QT_INTERLOCKED_INTRINSIC
+# define Q_ATOMIC_INT16_IS_SUPPORTED
+
+# ifdef _WIN64
+# define Q_ATOMIC_INT64_IS_SUPPORTED
+# endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Prototype declaration
+
+#define QT_INTERLOCKED_CONCAT_I(prefix, suffix) \
+ prefix ## suffix
+#define QT_INTERLOCKED_CONCAT(prefix, suffix) \
+ QT_INTERLOCKED_CONCAT_I(prefix, suffix)
+
+// MSVC intrinsics prefix function names with an underscore. Also, if platform
+// SDK headers have been included, the Interlocked names may be defined as
+// macros.
+// To avoid double underscores, we paste the prefix with Interlocked first and
+// then the remainder of the function name.
+#define QT_INTERLOCKED_FUNCTION(name) \
+ QT_INTERLOCKED_CONCAT( \
+ QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, Interlocked), name)
+
+#ifndef QT_INTERLOCKED_VOLATILE
+# define QT_INTERLOCKED_VOLATILE volatile
+#endif
+
+#ifndef QT_INTERLOCKED_PREFIX
+#define QT_INTERLOCKED_PREFIX
+#endif
+
+#ifndef QT_INTERLOCKED_PROTOTYPE
+#define QT_INTERLOCKED_PROTOTYPE
+#endif
+
+#ifdef QT_INTERLOCKED_DECLARE_PROTOTYPES
+#undef QT_INTERLOCKED_DECLARE_PROTOTYPES
+
+extern "C" {
+
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
+
+# if !defined(__i386__) && !defined(_M_IX86)
+ void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
+ void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
+ __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
+# endif
+
+# ifdef Q_ATOMIC_INT16_IS_SUPPORTED
+ short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment16 )(short QT_INTERLOCKED_VOLATILE *);
+ short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement16 )(short QT_INTERLOCKED_VOLATILE *);
+ short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange16 )(short QT_INTERLOCKED_VOLATILE *, short, short);
+ short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange16 )(short QT_INTERLOCKED_VOLATILE *, short);
+ short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd16 )(short QT_INTERLOCKED_VOLATILE *, short);
+# endif
+# ifdef Q_ATOMIC_INT64_IS_SUPPORTED
+ __int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment64 )(__int64 QT_INTERLOCKED_VOLATILE *);
+ __int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement64 )(__int64 QT_INTERLOCKED_VOLATILE *);
+ __int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64, __int64);
+ __int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
+ //above already: qint64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(qint64 QT_INTERLOCKED_VOLATILE *, qint64);
+# endif
+}
+
+#endif // QT_INTERLOCKED_DECLARE_PROTOTYPES
+
+#undef QT_INTERLOCKED_PROTOTYPE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef QT_INTERLOCKED_INTRINSIC
+#undef QT_INTERLOCKED_INTRINSIC
+
+# pragma intrinsic (_InterlockedIncrement)
+# pragma intrinsic (_InterlockedDecrement)
+# pragma intrinsic (_InterlockedExchange)
+# pragma intrinsic (_InterlockedCompareExchange)
+# pragma intrinsic (_InterlockedExchangeAdd)
+
+# if !defined(_M_IX86)
+# pragma intrinsic (_InterlockedCompareExchangePointer)
+# pragma intrinsic (_InterlockedExchangePointer)
+# pragma intrinsic (_InterlockedExchangeAdd64)
+# endif
+
+#endif // QT_INTERLOCKED_INTRINSIC
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Interlocked* replacement macros
+
+#if defined(__i386__) || defined(_M_IX86)
+
+# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
+ reinterpret_cast<void *>( \
+ QT_INTERLOCKED_FUNCTION(CompareExchange)( \
+ reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \
+ long(newValue), \
+ long(expectedValue)))
+
+# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
+ QT_INTERLOCKED_FUNCTION(Exchange)( \
+ reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \
+ long(newValue))
+
+# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
+ QT_INTERLOCKED_FUNCTION(ExchangeAdd)( \
+ reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \
+ (valueToAdd))
+
+#else // !defined(__i386__) && !defined(_M_IX86)
+
+# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
+ QT_INTERLOCKED_FUNCTION(CompareExchangePointer)( \
+ (void * QT_INTERLOCKED_VOLATILE *)(value), \
+ (void *) (newValue), \
+ (void *) (expectedValue))
+
+# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
+ QT_INTERLOCKED_FUNCTION(ExchangePointer)( \
+ (void * QT_INTERLOCKED_VOLATILE *)(value), \
+ (void *) (newValue))
+
+# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
+ QT_INTERLOCKED_FUNCTION(ExchangeAdd64)( \
+ reinterpret_cast<qint64 QT_INTERLOCKED_VOLATILE *>(value), \
+ (valueToAdd))
+
+#endif // !defined(__i386__) && !defined(_M_IX86)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QT_BEGIN_NAMESPACE
+
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
+#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE
+
+#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE
+
+#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE
+
+#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE
+
+#define Q_ATOMIC_INT32_IS_SUPPORTED
+
+#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_WAIT_FREE
+
+#define Q_ATOMIC_INT32_TEST_AND_SET_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT32_TEST_AND_SET_IS_WAIT_FREE
+
+#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_WAIT_FREE
+
+#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_WAIT_FREE
+
+#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE
+
+#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE
+
+#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE
+#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE
+
+#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
+# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_WAIT_FREE
+
+# define Q_ATOMIC_INT16_TEST_AND_SET_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT16_TEST_AND_SET_IS_WAIT_FREE
+
+# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_WAIT_FREE
+
+# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_WAIT_FREE
+
+template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; };
+#endif
+
+#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
+# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_WAIT_FREE
+
+# define Q_ATOMIC_INT64_TEST_AND_SET_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT64_TEST_AND_SET_IS_WAIT_FREE
+
+# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_WAIT_FREE
+
+# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE
+# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_WAIT_FREE
+
+template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+template <int N> struct QAtomicWindowsType { typedef typename QIntegerForSize<N>::Signed Type; };
+template <> struct QAtomicWindowsType<4> { typedef long Type; };
+
+
+template <int N> struct QAtomicOpsBySize : QGenericAtomicOps<QAtomicOpsBySize<N> >
+{
+ static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return true; }
+ static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return true; }
+ template <typename T> static bool ref(T &_q_value) Q_DECL_NOTHROW;
+ template <typename T> static bool deref(T &_q_value) Q_DECL_NOTHROW;
+
+ static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
+ static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
+ template <typename T> static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW;
+ template <typename T>
+ static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW;
+
+ static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
+ static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
+ template <typename T> static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW;
+
+ static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
+ static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
+ template <typename T> static T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW;
+
+private:
+ typedef typename QAtomicWindowsType<N>::Type Type;
+ template <typename T> static inline Type *atomic(T *t)
+ { Q_STATIC_ASSERT(sizeof(T) == sizeof(Type)); return reinterpret_cast<Type *>(t); }
+ template <typename T> static inline Type value(T t)
+ { Q_STATIC_ASSERT(sizeof(T) == sizeof(Type)); return Type(t); }
+};
+
+template <typename T>
+struct QAtomicOps : QAtomicOpsBySize<sizeof(T)>
+{
+ typedef T Type;
+};
+
+template<> template<typename T>
+inline bool QAtomicOpsBySize<4>::ref(T &_q_value) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Increment)(atomic(&_q_value)) != 0;
+}
+
+template<> template<typename T>
+inline bool QAtomicOpsBySize<4>::deref(T &_q_value) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Decrement)(atomic(&_q_value)) != 0;
+}
+
+template<> template<typename T>
+inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(CompareExchange)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
+}
+
+template<> template <typename T>
+inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
+{
+ *currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange)(atomic(&_q_value), newValue, expectedValue));
+ return *currentValue == expectedValue;
+}
+
+template<> template<typename T>
+inline T QAtomicOpsBySize<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Exchange)(atomic(&_q_value), value(newValue));
+}
+
+template<> template<typename T>
+inline T QAtomicOpsBySize<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(ExchangeAdd)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
+}
+
+#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
+template<> template<typename T>
+inline bool QAtomicOpsBySize<2>::ref(T &_q_value) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Increment16)(atomic(&_q_value)) != 0;
+}
+
+template<> template<typename T>
+inline bool QAtomicOpsBySize<2>::deref(T &_q_value) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Decrement16)(atomic(&_q_value)) != 0;
+}
+
+template<> template<typename T>
+inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(CompareExchange16)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
+}
+
+template<> template <typename T>
+inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
+{
+ *currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange16)(atomic(&_q_value), newValue, expectedValue));
+ return *currentValue == expectedValue;
+}
+
+template<> template<typename T>
+inline T QAtomicOpsBySize<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Exchange16)(atomic(&_q_value), value(newValue));
+}
+
+template<> template<typename T>
+inline T QAtomicOpsBySize<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(ExchangeAdd16)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
+}
+#endif
+
+#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
+template<> template<typename T>
+inline bool QAtomicOpsBySize<8>::ref(T &_q_value) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Increment64)(atomic(&_q_value)) != 0;
+}
+
+template<> template<typename T>
+inline bool QAtomicOpsBySize<8>::deref(T &_q_value) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Decrement64)(atomic(&_q_value)) != 0;
+}
+
+template<> template<typename T>
+inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(CompareExchange64)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
+}
+
+template<> template <typename T>
+inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
+{
+ *currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange64)(atomic(&_q_value), newValue, expectedValue));
+ return *currentValue == expectedValue;
+}
+
+template<> template<typename T>
+inline T QAtomicOpsBySize<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(Exchange64)(atomic(&_q_value), value(newValue));
+}
+
+template<> template<typename T>
+inline T QAtomicOpsBySize<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_FUNCTION(ExchangeAdd64)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
+}
+#endif
+
+// Specialization for pointer types, since we have Interlocked*Pointer() variants in some configurations
+template <typename T>
+struct QAtomicOps<T *> : QGenericAtomicOps<QAtomicOps<T *> >
+{
+ typedef T *Type;
+
+ static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
+ static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
+ static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW;
+ static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) Q_DECL_NOTHROW;
+
+ static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
+ static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
+ static T *fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW;
+
+ static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
+ static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
+ static T *fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW;
+};
+
+template <typename T>
+inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW
+{
+ return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue) == expectedValue;
+}
+
+template <typename T>
+inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) Q_DECL_NOTHROW
+{
+ *currentValue = reinterpret_cast<T *>(QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue));
+ return *currentValue == expectedValue;
+}
+
+template <typename T>
+inline T *QAtomicOps<T *>::fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW
+{
+ return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, newValue));
+}
+
+template <typename T>
+inline T *QAtomicOps<T *>::fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW
+{
+ return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_ADD_POINTER(&_q_value, valueToAdd * sizeof(T)));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Cleanup
+
+#undef QT_INTERLOCKED_CONCAT_I
+#undef QT_INTERLOCKED_CONCAT
+#undef QT_INTERLOCKED_FUNCTION
+#undef QT_INTERLOCKED_PREFIX
+
+#undef QT_INTERLOCKED_VOLATILE
+
+#undef QT_INTERLOCKED_INCREMENT
+#undef QT_INTERLOCKED_DECREMENT
+#undef QT_INTERLOCKED_COMPARE_EXCHANGE
+#undef QT_INTERLOCKED_EXCHANGE
+#undef QT_INTERLOCKED_EXCHANGE_ADD
+#undef QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER
+#undef QT_INTERLOCKED_EXCHANGE_POINTER
+#undef QT_INTERLOCKED_EXCHANGE_ADD_POINTER
+
+QT_END_NAMESPACE
+#endif // QATOMIC_MSVC_H
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index aacd12f220..a0304697b8 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -45,8 +45,20 @@
#if defined(QT_BOOTSTRAPPED)
# include <QtCore/qatomic_bootstrap.h>
-#else
+
+// If C++11 atomics are supported, use them!
+// Note that constexpr support is sometimes disabled in QNX builds but its
+// library has <atomic>.
+#elif defined(Q_COMPILER_ATOMICS) && (defined(Q_COMPILER_CONSTEXPR) || defined(Q_OS_QNX))
# include <QtCore/qatomic_cxx11.h>
+
+// We only support one fallback: MSVC, because even on version 2015, it lacks full constexpr support
+#elif defined(Q_CC_MSVC)
+# include <QtCore/qatomic_msvc.h>
+
+// No fallback
+#else
+# error "Qt requires C++11 support"
#endif
QT_WARNING_PUSH
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 7d908fd4e7..23606411ff 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -219,14 +219,17 @@ QThreadPrivate::~QThreadPrivate()
It is important to remember that a QThread instance \l{QObject#Thread
Affinity}{lives in} the old thread that instantiated it, not in the
new thread that calls run(). This means that all of QThread's queued
- slots will execute in the old thread. Thus, a developer who wishes to
- invoke slots in the new thread must use the worker-object approach; new
- slots should not be implemented directly into a subclassed QThread.
-
- When subclassing QThread, keep in mind that the constructor executes in
- the old thread while run() executes in the new thread. If a member
- variable is accessed from both functions, then the variable is accessed
- from two different threads. Check that it is safe to do so.
+ slots and \l {QMetaObject::invokeMethod()}{invoked methods} will execute
+ in the old thread. Thus, a developer who wishes to invoke slots in the
+ new thread must use the worker-object approach; new slots should not be
+ implemented directly into a subclassed QThread.
+
+ Unlike queued slots or invoked methods, methods called directly on the
+ QThread object will execute in the thread that calls the method. When
+ subclassing QThread, keep in mind that the constructor executes in the
+ old thread while run() executes in the new thread. If a member variable
+ is accessed from both functions, then the variable is accessed from two
+ different threads. Check that it is safe to do so.
\note Care must be taken when interacting with objects across different
threads. See \l{Synchronizing Threads} for details.
diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri
index 47775f3fde..dae72564b4 100644
--- a/src/corelib/thread/thread.pri
+++ b/src/corelib/thread/thread.pri
@@ -53,6 +53,8 @@ qtConfig(future) {
}
win32 {
+ HEADERS += thread/qatomic_msvc.h
+
SOURCES += \
thread/qmutex_win.cpp \
thread/qthread_win.cpp \
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index df78e7d896..bab26f6028 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -549,7 +549,7 @@ void QPlatformCursorImage::createSystemCursor(int id)
void QPlatformCursorImage::set(Qt::CursorShape id)
{
QPlatformCursorImage *cursor = 0;
- if (id >= 0 && id <= Qt::LastCursor) {
+ if (unsigned(id) <= unsigned(Qt::LastCursor)) {
if (!systemCursorTable[id])
createSystemCursor(id);
cursor = systemCursorTable[id];
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index fbadb48f70..b456c1ca31 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -664,18 +664,18 @@ QStringList QFileDialogOptions::history() const
void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text)
{
- if (label >= 0 && label < DialogLabelCount)
+ if (unsigned(label) < unsigned(DialogLabelCount))
d->labels[label] = text;
}
QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const
{
- return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
+ return (unsigned(label) < unsigned(DialogLabelCount)) ? d->labels[label] : QString();
}
bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label)
{
- return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
+ return unsigned(label) < unsigned(DialogLabelCount) && !d->labels[label].isEmpty();
}
QUrl QFileDialogOptions::initialDirectory() const
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 469f019a1c..91c25184b6 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -1424,14 +1424,17 @@ QImage QOpenGLFramebufferObject::toImage(bool flipped, int colorAttachmentIndex)
// qt_gl_read_framebuffer doesn't work on a multisample FBO
if (format().samples() != 0) {
QRect rect(QPoint(0, 0), size());
+ QOpenGLFramebufferObjectFormat fmt;
if (extraFuncs->hasOpenGLFeature(QOpenGLFunctions::MultipleRenderTargets)) {
- QOpenGLFramebufferObject temp(d->colorAttachments[colorAttachmentIndex].size, QOpenGLFramebufferObjectFormat());
+ fmt.setInternalTextureFormat(d->colorAttachments[colorAttachmentIndex].internalFormat);
+ QOpenGLFramebufferObject temp(d->colorAttachments[colorAttachmentIndex].size, fmt);
blitFramebuffer(&temp, rect, const_cast<QOpenGLFramebufferObject *>(this), rect,
GL_COLOR_BUFFER_BIT, GL_NEAREST,
colorAttachmentIndex, 0);
image = temp.toImage(flipped);
} else {
- QOpenGLFramebufferObject temp(size(), QOpenGLFramebufferObjectFormat());
+ fmt.setInternalTextureFormat(d->colorAttachments[0].internalFormat);
+ QOpenGLFramebufferObject temp(size(), fmt);
blitFramebuffer(&temp, rect, const_cast<QOpenGLFramebufferObject *>(this), rect);
image = temp.toImage(flipped);
}
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index 8831d60d48..9cbe6ef911 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -762,7 +762,7 @@ QPageSizePrivate::QPageSizePrivate(QPageSize::PageSizeId pageSizeId)
m_windowsId(0),
m_units(QPageSize::Point)
{
- if (pageSizeId >= QPageSize::PageSizeId(0) && pageSizeId <= QPageSize::LastPageSize)
+ if (unsigned(pageSizeId) <= unsigned(QPageSize::LastPageSize))
init(pageSizeId, QString());
}
@@ -1478,7 +1478,7 @@ QRect QPageSize::rectPixels(int resolution) const
QString QPageSize::key(PageSizeId pageSizeId)
{
- if (pageSizeId < PageSizeId(0) || pageSizeId > LastPageSize)
+ if (unsigned(pageSizeId) > unsigned(LastPageSize))
return QString();
return QString::fromUtf8(qt_pageSizes[pageSizeId].mediaOption);
}
@@ -1497,7 +1497,7 @@ static QString msgImperialPageSizeInch(int width, int height)
QString QPageSize::name(PageSizeId pageSizeId)
{
- if (pageSizeId < PageSizeId(0) || pageSizeId > LastPageSize)
+ if (unsigned(pageSizeId) > unsigned(LastPageSize))
return QString();
switch (pageSizeId) {
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 7a53c44bc4..c5e296b293 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -352,8 +352,6 @@ QTransform QTransform::transposed() const
QTransform t(affine._m11, affine._m21, affine._dx,
affine._m12, affine._m22, affine._dy,
m_13, m_23, m_33, true);
- t.m_type = m_type;
- t.m_dirty = m_dirty;
return t;
}
diff --git a/src/network/access/http2/hpacktable.cpp b/src/network/access/http2/hpacktable.cpp
index db9574e2bc..a90ee72d52 100644
--- a/src/network/access/http2/hpacktable.cpp
+++ b/src/network/access/http2/hpacktable.cpp
@@ -64,8 +64,6 @@ HeaderSize entry_size(const QByteArray &name, const QByteArray &value)
const unsigned sum = unsigned(name.size()) + value.size();
if (std::numeric_limits<unsigned>::max() - 32 < sum)
return HeaderSize();
- if (sum + 32 > std::numeric_limits<quint32>::max())
- return HeaderSize();
return HeaderSize(true, quint32(sum + 32));
}
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index 63056a525b..27b5f570dc 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -260,7 +260,7 @@ bool QNetmask::setAddress(const QHostAddress &address)
int netmask = 0;
quint8 *ptr = ip.v6;
quint8 *end;
- length = -1;
+ length = 255;
if (address.protocol() == QAbstractSocket::IPv4Protocol) {
ip.v4 = qToBigEndian(address.toIPv4Address());
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index 1071662d96..a1697c0125 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -1005,7 +1005,7 @@ QSslConfiguration::NextProtocolNegotiationStatus QSslConfiguration::nextProtocol
\list
\li no local certificate and no private key
- \li protocol SecureProtocols (meaning either TLS 1.0 or SSL 3 will be used)
+ \li protocol \l{QSsl::SecureProtocols}{SecureProtocols}
\li the system's default CA certificate list
\li the cipher list equal to the list of the SSL libraries'
supported SSL ciphers that are 128 bits or more
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index 324b00144e..ffa100f824 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -278,6 +278,8 @@ QFunctionPointer QWindowsNativeInterface::platformFunction(const QByteArray &fun
return QFunctionPointer(QWindowsWindow::setTouchWindowTouchTypeStatic);
else if (function == QWindowsWindowFunctions::setHasBorderInFullScreenIdentifier())
return QFunctionPointer(QWindowsWindow::setHasBorderInFullScreenStatic);
+ else if (function == QWindowsWindowFunctions::setWindowActivationBehaviorIdentifier())
+ return QFunctionPointer(QWindowsNativeInterface::setWindowActivationBehavior);
else if (function == QWindowsWindowFunctions::isTabletModeIdentifier())
return QFunctionPointer(QWindowsNativeInterface::isTabletMode);
return nullptr;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index a2883e2601..3909c64c53 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2201,6 +2201,15 @@ void QWindowsWindow::requestActivateWindow()
foregroundThread = GetWindowThreadProcessId(foregroundWindow, NULL);
if (foregroundThread && foregroundThread != currentThread)
attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE;
+ if (attached) {
+ if (!window()->flags().testFlag(Qt::WindowStaysOnBottomHint)
+ && !window()->flags().testFlag(Qt::WindowStaysOnTopHint)
+ && window()->type() != Qt::ToolTip) {
+ const UINT swpFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER;
+ SetWindowPos(m_data.hwnd, HWND_TOPMOST, 0, 0, 0, 0, swpFlags);
+ SetWindowPos(m_data.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, swpFlags);
+ }
+ }
}
}
SetForegroundWindow(m_data.hwnd);
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index 6fbdef2695..484dad6e1d 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -1845,9 +1845,9 @@ bool QIBaseDriver::subscribeToNotification(const QString &name)
eBuffer->bufferLength,
eBuffer->eventBuffer,
#if defined (FB_API_VER) && FB_API_VER >= 20
- (ISC_EVENT_CALLBACK)qEventCallback,
+ reinterpret_cast<ISC_EVENT_CALLBACK>(qEventCallback),
#else
- (isc_callback)qEventCallback,
+ reinterpret_cast<isc_callback>(qEventCallback),
#endif
eBuffer->resultBuffer);
@@ -1925,9 +1925,9 @@ void QIBaseDriver::qHandleEventNotification(void *updatedResultBuffer)
eBuffer->bufferLength,
eBuffer->eventBuffer,
#if defined (FB_API_VER) && FB_API_VER >= 20
- (ISC_EVENT_CALLBACK)qEventCallback,
+ reinterpret_cast<ISC_EVENT_CALLBACK>(qEventCallback),
#else
- (isc_callback)qEventCallback,
+ reinterpret_cast<isc_callback>(qEventCallback),
#endif
eBuffer->resultBuffer);
if (Q_UNLIKELY(status[0] == 1 && status[1])) {
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 95809906c1..5999163c91 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -1675,13 +1675,13 @@ QRectF QMacStylePrivate::comboboxEditBounds(const QRectF &outerBounds, const Coc
} else if (cw.type == Button_PopupButton) {
switch (cw.size) {
case QStyleHelper::SizeLarge:
- ret.adjust(14, 1, -23, -4);
+ ret.adjust(10, 1, -23, -4);
break;
case QStyleHelper::SizeSmall:
- ret.adjust(13, 4, -20, -3);
+ ret.adjust(10, 4, -20, -3);
break;
case QStyleHelper::SizeMini:
- ret.adjust(12, 0, -19, 0);
+ ret.adjust(9, 0, -19, 0);
ret.setHeight(13);
break;
default:
@@ -2826,7 +2826,8 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
#if QT_CONFIG(toolbutton)
if (const QToolButton *tb = qobject_cast<const QToolButton *>(w)) {
// When stroking the arrow, make sure it fits in the tool button
- if (tb->arrowType() != Qt::NoArrow)
+ if (tb->arrowType() != Qt::NoArrow
+ || tb->popupMode() == QToolButton::MenuButtonPopup)
halfSize -= penWidth;
}
#endif
@@ -5865,11 +5866,11 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
#endif
case CC_ToolButton:
ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
- if (sc == SC_ToolButtonMenu
+ if (sc == SC_ToolButtonMenu) {
#ifndef QT_NO_ACCESSIBILITY
- && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)
+ if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar))
+ ret.adjust(-toolButtonArrowMargin, 0, 0, 0);
#endif
- ) {
ret.adjust(-1, 0, 0, 0);
}
break;
@@ -6107,6 +6108,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_ToolButton:
sz.rwidth() += 10;
sz.rheight() += 10;
+ if (const auto *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt))
+ if (tb->features & QStyleOptionToolButton::Menu)
+ sz.rwidth() += toolButtonArrowMargin;
return sz;
case CT_ComboBox:
if (const auto *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp
index 0f4f915ed3..88f4235d46 100644
--- a/src/testlib/qbenchmarkmetric.cpp
+++ b/src/testlib/qbenchmarkmetric.cpp
@@ -139,7 +139,7 @@ static const int NumEntries = sizeof(entries) / sizeof(entries[0]);
*/
const char * QTest::benchmarkMetricName(QBenchmarkMetric metric)
{
- if (metric >= 0 && metric < QTest::NumEntries)
+ if (unsigned(metric) < unsigned(QTest::NumEntries))
return entries[metric].name;
return "";
@@ -151,7 +151,7 @@ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric)
*/
const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric)
{
- if (metric >= 0 && metric < QTest::NumEntries)
+ if (unsigned(metric) < unsigned(QTest::NumEntries))
return entries[metric].unit;
return "";
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index d444fe6053..599b983748 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -162,6 +162,7 @@
#if QT_CONFIG(lineedit)
#include "QtWidgets/qlineedit.h"
#endif
+#include "QtCore/qdir.h"
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 77423e85e5..f059980c5c 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -619,6 +619,8 @@ void QAbstractSpinBox::stepDown()
function. Note that this function is called even if the resulting
value will be outside the bounds of minimum and maximum. It's this
function's job to handle these situations.
+
+ \sa stepUp(), stepDown(), keyPressEvent()
*/
void QAbstractSpinBox::stepBy(int steps)
@@ -970,6 +972,8 @@ void QAbstractSpinBox::paintEvent(QPaintEvent *)
\row \li Page down
\li This will invoke stepBy(-10)
\endtable
+
+ \sa stepBy()
*/
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 059fb21295..9559b58339 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -1005,7 +1005,7 @@ Qt::DayOfWeek QCalendarModel::dayOfWeekForColumn(int column) const
int QCalendarModel::columnForDayOfWeek(Qt::DayOfWeek day) const
{
- if (day < 1 || day > 7)
+ if (day < 1 || unsigned(day) > unsigned(7))
return -1;
int column = (int)day - (int)m_firstDay;
if (column < 0)