diff options
Diffstat (limited to 'src')
156 files changed, 1142 insertions, 799 deletions
diff --git a/src/3rdparty/pcre/patches/README b/src/3rdparty/pcre/patches/README new file mode 100644 index 0000000000..1d2bc389dd --- /dev/null +++ b/src/3rdparty/pcre/patches/README @@ -0,0 +1,3 @@ +These patches are landed in upstream PCRE (they're marked with +their SVN revision number). When upgrading PCRE remember check +if the version you're upgrading to already contains them or not. diff --git a/src/3rdparty/pcre/patches/r1340_fix_jit_on_android.patch b/src/3rdparty/pcre/patches/r1340_fix_jit_on_android.patch new file mode 100644 index 0000000000..41699d4882 --- /dev/null +++ b/src/3rdparty/pcre/patches/r1340_fix_jit_on_android.patch @@ -0,0 +1,18 @@ +Index: sljit/sljitConfigInternal.h +=================================================================== +--- sljit/sljitConfigInternal.h (revision 1339) ++++ sljit/sljitConfigInternal.h (working copy) +@@ -221,6 +221,13 @@ + #define SLJIT_CACHE_FLUSH(from, to) \ + sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from)) + ++#elif defined __ANDROID__ ++ ++/* Android lacks __clear_cache; instead, cacheflush should be used. */ ++ ++#define SLJIT_CACHE_FLUSH(from, to) \ ++ cacheflush((long)(from), (long)(to), 0) ++ + #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) + + /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */ diff --git a/src/3rdparty/pcre/sljit/sljitConfigInternal.h b/src/3rdparty/pcre/sljit/sljitConfigInternal.h index 2b6616ef66..bc945fbcab 100644 --- a/src/3rdparty/pcre/sljit/sljitConfigInternal.h +++ b/src/3rdparty/pcre/sljit/sljitConfigInternal.h @@ -217,6 +217,13 @@ #define SLJIT_CACHE_FLUSH(from, to) \ sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from)) +#elif defined __ANDROID__ + +/* Android lacks __clear_cache; instead, cacheflush should be used. */ + +#define SLJIT_CACHE_FLUSH(from, to) \ + cacheflush((long)(from), (long)(to), 0) + #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */ diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index a80427893d..e01b448351 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -83,6 +83,8 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) !!ENDIF +set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) + !!IF contains(QT_CONFIG, reduce_exports) set(QT_VISIBILITY_AVAILABLE \"True\") !!ENDIF diff --git a/src/corelib/arch/qatomic_alpha.h b/src/corelib/arch/qatomic_alpha.h index 71cb112d47..5008a1acda 100644 --- a/src/corelib/arch/qatomic_alpha.h +++ b/src/corelib/arch/qatomic_alpha.h @@ -114,7 +114,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() inline bool QBasicAtomicInt::ref() { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "addl %0,1,%1\n" /* tmp=old+1; */ @@ -131,7 +131,7 @@ inline bool QBasicAtomicInt::ref() inline bool QBasicAtomicInt::deref() { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "subl %0,1,%1\n" /* tmp=old-1; */ @@ -148,7 +148,7 @@ inline bool QBasicAtomicInt::deref() inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int ret; + int ret; asm volatile("1:\n" "ldl_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ @@ -167,7 +167,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int ret; + int ret; asm volatile("1:\n" "ldl_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ @@ -187,7 +187,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int ret; + int ret; asm volatile("mb\n" "1:\n" "ldl_l %0,%1\n" /* ret=*ptr; */ @@ -207,7 +207,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -224,7 +224,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -242,7 +242,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { - register int old, tmp; + int old, tmp; asm volatile("mb\n" "1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ @@ -260,7 +260,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "addl %0,%3,%1\n"/* tmp=old+value; */ @@ -277,7 +277,7 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "addl %0,%3,%1\n"/* tmp=old+value; */ @@ -295,7 +295,7 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { - register int old, tmp; + int old, tmp; asm volatile("mb\n" "1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ @@ -314,7 +314,7 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register void *ret; + void *ret; asm volatile("1:\n" "ldq_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ @@ -334,7 +334,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) { - register void *ret; + void *ret; asm volatile("1:\n" "ldq_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ @@ -355,7 +355,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) { - register void *ret; + void *ret; asm volatile("mb\n" "1:\n" "ldq_l %0,%1\n" /* ret=*ptr; */ @@ -376,7 +376,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -394,7 +394,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -413,7 +413,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { - register T *old, *tmp; + T *old, *tmp; asm volatile("mb\n" "1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ @@ -432,7 +432,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "addq %0,%3,%1\n"/* tmp=old+value; */ @@ -450,7 +450,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "addq %0,%3,%1\n"/* tmp=old+value; */ @@ -469,7 +469,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) { - register T *old, *tmp; + T *old, *tmp; asm volatile("mb\n" "1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ diff --git a/src/corelib/arch/qatomic_armv5.h b/src/corelib/arch/qatomic_armv5.h index e0a50b3c24..b583ec662c 100644 --- a/src/corelib/arch/qatomic_armv5.h +++ b/src/corelib/arch/qatomic_armv5.h @@ -114,8 +114,8 @@ template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)> template<> template<typename T> inline bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; do { originalValue = _q_value; newValue = originalValue + 1; @@ -126,8 +126,8 @@ bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; do { originalValue = _q_value; newValue = originalValue - 1; @@ -138,7 +138,7 @@ bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T originalValue; + T originalValue; do { originalValue = _q_value; if (originalValue != expectedValue) @@ -165,7 +165,7 @@ template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { #if defined(__thumb__) - register T originalValue; + T originalValue; do { originalValue = _q_value; } while (_q_cmpxchg(originalValue, newValue, &_q_value) != 0); @@ -184,8 +184,8 @@ T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; do { originalValue = _q_value; newValue = originalValue + valueToAdd; diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h index 7f5939e391..08b2b02133 100644 --- a/src/corelib/arch/qatomic_armv6.h +++ b/src/corelib/arch/qatomic_armv6.h @@ -117,8 +117,8 @@ template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)> template<> template<typename T> inline bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrex %[newValue], [%[_q_value]]\n" "add %[newValue], %[newValue], #1\n" @@ -136,8 +136,8 @@ bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrex %[newValue], [%[_q_value]]\n" "sub %[newValue], %[newValue], #1\n" @@ -155,7 +155,7 @@ bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register int result; + int result; asm volatile("0:\n" "ldrex %[result], [%[_q_value]]\n" "eors %[result], %[result], %[expectedValue]\n" @@ -175,8 +175,8 @@ bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrex %[originalValue], [%[_q_value]]\n" "strex %[result], %[newValue], [%[_q_value]]\n" @@ -194,9 +194,9 @@ T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrex %[originalValue], [%[_q_value]]\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -256,8 +256,8 @@ template<> struct QAtomicIntegerTraits<char32_t> { enum { IsInteger = 1 }; }; template<> template<typename T> inline bool QBasicAtomicOps<1>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexb %[newValue], [%[_q_value]]\n" "add %[newValue], %[newValue], #1\n" @@ -275,8 +275,8 @@ bool QBasicAtomicOps<1>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<1>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexb %[newValue], [%[_q_value]]\n" "sub %[newValue], %[newValue], #1\n" @@ -294,7 +294,7 @@ bool QBasicAtomicOps<1>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; + T result; asm volatile("0:\n" "ldrexb %[result], [%[_q_value]]\n" "eors %[result], %[result], %[expectedValue]\n" @@ -314,8 +314,8 @@ bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<1>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrexb %[originalValue], [%[_q_value]]\n" "strexb %[result], %[newValue], [%[_q_value]]\n" @@ -333,9 +333,9 @@ T QBasicAtomicOps<1>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrexb %[originalValue], [%[_q_value]]\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -355,8 +355,8 @@ T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy template<> template<typename T> inline bool QBasicAtomicOps<2>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexh %[newValue], [%[_q_value]]\n" "add %[newValue], %[newValue], #1\n" @@ -374,8 +374,8 @@ bool QBasicAtomicOps<2>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<2>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexh %[newValue], [%[_q_value]]\n" "sub %[newValue], %[newValue], #1\n" @@ -393,7 +393,7 @@ bool QBasicAtomicOps<2>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; + T result; asm volatile("0:\n" "ldrexh %[result], [%[_q_value]]\n" "eors %[result], %[result], %[expectedValue]\n" @@ -413,8 +413,8 @@ bool QBasicAtomicOps<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrexh %[originalValue], [%[_q_value]]\n" "strexh %[result], %[newValue], [%[_q_value]]\n" @@ -432,9 +432,9 @@ T QBasicAtomicOps<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrexh %[originalValue], [%[_q_value]]\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -462,8 +462,8 @@ T QBasicAtomicOps<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy template<> template<typename T> inline bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexd %[newValue], %H[newValue], [%[_q_value]]\n" "adds %Q[newValue], %Q[newValue], #1\n" @@ -482,8 +482,8 @@ bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexd %[newValue], %H[newValue], [%[_q_value]]\n" "subs %Q[newValue], %Q[newValue], #1\n" @@ -502,7 +502,7 @@ bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; + T result; asm volatile("0:\n" "ldrexd %[result], %H[result], [%[_q_value]]\n" "eor %[result], %[result], %[expectedValue]\n" @@ -524,8 +524,8 @@ bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrexd %[originalValue], %H[originalValue], [%[_q_value]]\n" "strexd %[result], %[newValue], %H[newValue], [%[_q_value]]\n" @@ -543,9 +543,9 @@ T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrexd %[originalValue], %H[originalValue], [%[_q_value]]\n" "adds %Q[newValue], %Q[originalValue], %Q[valueToAdd]\n" @@ -588,8 +588,8 @@ T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy inline bool QBasicAtomicInt::ref() Q_DECL_NOTHROW { - register int newValue; - register int result; + int newValue; + int result; retry: __asm { ldrex newValue, [&_q_value] @@ -603,8 +603,8 @@ inline bool QBasicAtomicInt::ref() Q_DECL_NOTHROW inline bool QBasicAtomicInt::deref() Q_DECL_NOTHROW { - register int newValue; - register int result; + int newValue; + int result; retry: __asm { ldrex newValue, [&_q_value] @@ -618,7 +618,7 @@ inline bool QBasicAtomicInt::deref() Q_DECL_NOTHROW inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) Q_DECL_NOTHROW { - register int result; + int result; retry: __asm { ldrex result, [&_q_value] @@ -632,8 +632,8 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) Q_DECL_NOTHROW { - register int originalValue; - register int result; + int originalValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] @@ -646,9 +646,9 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) Q_DECL_NOTHROW inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) Q_DECL_NOTHROW { - register int originalValue; - register int newValue; - register int result; + int originalValue; + int newValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] @@ -663,7 +663,7 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) Q_DECL_NOTHROW template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) Q_DECL_NOTHROW { - register T *result; + T *result; retry: __asm { ldrex result, [&_q_value] @@ -678,8 +678,8 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) Q_DECL_NOTHROW { - register T *originalValue; - register int result; + T *originalValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] @@ -693,9 +693,9 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) Q template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) Q_DECL_NOTHROW { - register T *originalValue; - register T *newValue; - register int result; + T *originalValue; + T *newValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h index ed72036076..98937c7551 100644 --- a/src/corelib/arch/qatomic_ia64.h +++ b/src/corelib/arch/qatomic_ia64.h @@ -192,7 +192,7 @@ template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)> typedef T Type; }; -inline bool _q_ia64_fetchadd_immediate(register int value) +inline bool _q_ia64_fetchadd_immediate(int value) { return value == 1 || value == -1 || value == 4 || value == -4 @@ -218,7 +218,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int expectedValueCopy = expectedValue; + int expectedValueCopy = expectedValue; return (static_cast<int>(_InterlockedCompareExchange(&_q_value, newValue, expectedValueCopy)) @@ -227,7 +227,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int expectedValueCopy = expectedValue; + int expectedValueCopy = expectedValue; return (static_cast<int>(_InterlockedCompareExchange_acq(reinterpret_cast<volatile uint *>(&_q_value), newValue, expectedValueCopy)) @@ -236,7 +236,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int expectedValueCopy = expectedValue; + int expectedValueCopy = expectedValue; return (static_cast<int>(_InterlockedCompareExchange_rel(reinterpret_cast<volatile uint *>(&_q_value), newValue, expectedValueCopy)) @@ -285,7 +285,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register T *expectedValueCopy = expectedValue; + T *expectedValueCopy = expectedValue; return (_InterlockedCompareExchangePointer(reinterpret_cast<void * volatile*>(&_q_value), newValue, expectedValueCopy) @@ -300,7 +300,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu volatile unsigned long *p; }; x = &_q_value; - register T *expectedValueCopy = expectedValue; + T *expectedValueCopy = expectedValue; return (_InterlockedCompareExchange64_acq(p, quintptr(newValue), quintptr(expectedValueCopy)) == quintptr(expectedValue)); } @@ -313,7 +313,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu volatile unsigned long *p; }; x = &_q_value; - register T *expectedValueCopy = expectedValue; + T *expectedValueCopy = expectedValue; return (_InterlockedCompareExchange64_rel(p, quintptr(newValue), quintptr(expectedValueCopy)) == quintptr(expectedValue)); } @@ -912,7 +912,7 @@ T QBasicAtomicOps<1>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint8)old, FENCE); @@ -926,7 +926,7 @@ template<> template <typename T> inline T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint8)old, FENCE); @@ -941,7 +941,7 @@ T QBasicAtomicOps<2>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint16)old, FENCE); @@ -955,7 +955,7 @@ template<> template <typename T> inline T QBasicAtomicOps<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint16)old, FENCE); @@ -970,7 +970,7 @@ T QBasicAtomicOps<4>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)old, FENCE); @@ -984,7 +984,7 @@ template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)old, FENCE); @@ -999,7 +999,7 @@ T QBasicAtomicOps<8>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)old, FENCE); @@ -1013,7 +1013,7 @@ template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)old, FENCE); diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h index 7716750332..6eb9613e31 100644 --- a/src/corelib/arch/qatomic_mips.h +++ b/src/corelib/arch/qatomic_mips.h @@ -137,8 +137,8 @@ void QBasicAtomicOps<size>::orderedMemoryFence(const T &) Q_DECL_NOTHROW template<> template<typename T> inline bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[one]\n" @@ -156,8 +156,8 @@ bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW template<> template<typename T> inline bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[minusOne]\n" @@ -175,8 +175,8 @@ bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; - register T tempValue; + T result; + T tempValue; asm volatile("0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -199,8 +199,8 @@ bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register T tempValue; + T originalValue; + T tempValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" @@ -218,8 +218,8 @@ T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" @@ -254,8 +254,8 @@ template<> struct QAtomicIntegerTraits<char32_t> { enum { IsInteger = 1 }; }; template<> template<typename T> inline bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[one]\n" @@ -273,8 +273,8 @@ bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW template<> template<typename T> inline bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[minusOne]\n" @@ -292,8 +292,8 @@ bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; - register T tempValue; + T result; + T tempValue; asm volatile("0:\n" "lld %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -316,8 +316,8 @@ bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register T tempValue; + T originalValue; + T tempValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" @@ -335,8 +335,8 @@ T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" diff --git a/src/corelib/arch/qatomic_power.h b/src/corelib/arch/qatomic_power.h index ad1c619d56..3ddd303795 100644 --- a/src/corelib/arch/qatomic_power.h +++ b/src/corelib/arch/qatomic_power.h @@ -124,8 +124,8 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() inline bool QBasicAtomicInt::ref() { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "addi %[newValue], %[originalValue], %[one]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -141,8 +141,8 @@ inline bool QBasicAtomicInt::ref() inline bool QBasicAtomicInt::deref() { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "addi %[newValue], %[originalValue], %[minusOne]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -158,7 +158,7 @@ inline bool QBasicAtomicInt::deref() inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int result; + int result; asm volatile("lwarx %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+12\n" @@ -175,7 +175,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int result; + int result; asm volatile("lwarx %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+16\n" @@ -193,7 +193,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int result; + int result; asm volatile("eieio\n" "lwarx %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" @@ -211,7 +211,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { - register int originalValue; + int originalValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "stwcx. %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -225,7 +225,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { - register int originalValue; + int originalValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "stwcx. %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -240,7 +240,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { - register int originalValue; + int originalValue; asm volatile("eieio\n" "lwarx %[originalValue]," _Q_VALUE "\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -255,8 +255,8 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -272,8 +272,8 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -290,8 +290,8 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("eieio\n" "lwarx %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -317,7 +317,7 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register void *result; + void *result; asm volatile(LPARX" %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+12\n" @@ -335,7 +335,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) { - register void *result; + void *result; asm volatile(LPARX" %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+16\n" @@ -354,7 +354,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) { - register void *result; + void *result; asm volatile("eieio\n" LPARX" %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" @@ -373,7 +373,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" STPCX" %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -388,7 +388,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" STPCX" %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -404,7 +404,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("eieio\n" LPARX" %[originalValue]," _Q_VALUE "\n" STPCX" %[newValue]," _Q_VALUE "\n" @@ -420,8 +420,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) { - register T *originalValue; - register T *newValue; + T *originalValue; + T *newValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" STPCX" %[newValue]," _Q_VALUE "\n" @@ -438,8 +438,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) { - register T *originalValue; - register T *newValue; + T *originalValue; + T *newValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" STPCX" %[newValue]," _Q_VALUE "\n" @@ -457,8 +457,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) { - register T *originalValue; - register T *newValue; + T *originalValue; + T *newValue; asm volatile("eieio\n" LPARX" %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" diff --git a/src/corelib/arch/qatomic_sh4a.h b/src/corelib/arch/qatomic_sh4a.h index 08f75e44f2..6e59279f3e 100644 --- a/src/corelib/arch/qatomic_sh4a.h +++ b/src/corelib/arch/qatomic_sh4a.h @@ -147,7 +147,7 @@ inline bool QBasicAtomicInt::deref() inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int result; + int result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -169,7 +169,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int result; + int result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -192,7 +192,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int result; + int result; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -220,7 +220,7 @@ inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -237,7 +237,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -255,7 +255,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { - register int originalValue; + int originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -278,7 +278,7 @@ inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -295,7 +295,7 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -313,7 +313,7 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { - register int originalValue; + int originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -337,7 +337,7 @@ inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register T *result; + T *result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -360,7 +360,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) { - register T *result; + T *result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -384,7 +384,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) { - register T *result; + T *result; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -414,7 +414,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -432,7 +432,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -451,7 +451,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -476,7 +476,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -494,7 +494,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -513,7 +513,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) { - register T *originalValue; + T *originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 1cedd3a28d..4ed7b00e53 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -99,9 +99,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutex, textCodecsMutex, (QMutex::Recursive)); QMutex *qTextCodecsMutex() { return textCodecsMutex(); } #if !defined(QT_USE_ICU) -static char qtolower(register char c) +static char qtolower(char c) { if (c >= 'A' && c <= 'Z') return c + 0x20; return c; } -static bool qisalnum(register char c) +static bool qisalnum(char c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); } bool qTextCodecNameMatch(const char *n, const char *h) diff --git a/src/corelib/codecs/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h index 0fec1e80c7..00c067821e 100644 --- a/src/corelib/codecs/qtextcodec_p.h +++ b/src/corelib/codecs/qtextcodec_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTCODEC -#if defined(Q_OS_MAC) || defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) +#if defined(Q_OS_MAC) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) #define QT_LOCALE_IS_UTF8 #endif diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 0a5cc04a17..44a3f06f50 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -58,7 +58,7 @@ QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtCore.dynlist contains(DEFINES,QT_EVAL):include(eval.pri) -HOST_BINS = $$[QT_HOST_BINS/raw] +HOST_BINS = $$[QT_HOST_BINS] host_bins.name = host_bins host_bins.variable = HOST_BINS diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index f2e5dc7633..2cadea59c1 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -311,6 +311,11 @@ #define QT_NO_LOCALSERVER #endif +// QPdf +#if !defined(QT_NO_PDF) && (defined(QT_NO_TEMPORARYFILE)) +#define QT_NO_PDF +#endif + // QMenu #if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION)) #define QT_NO_MENU @@ -386,11 +391,6 @@ #define QT_NO_CONTEXTMENU #endif -// Qt D-Bus module -#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_DOM)) -#define QT_NO_DBUS -#endif - // QPrinter #if !defined(QT_NO_PRINTER) && (defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE)) #define QT_NO_PRINTER @@ -446,6 +446,11 @@ #define QT_NO_BEARERMANAGEMENT #endif +// Qt D-Bus module +#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_XMLSTREAMREADER)) +#define QT_NO_DBUS +#endif + // QGraphicsView #if !defined(QT_NO_GRAPHICSVIEW) && (defined(QT_NO_SCROLLAREA)) #define QT_NO_GRAPHICSVIEW diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 43db585643..814e95c256 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -851,6 +851,13 @@ Requires: Name: Color Names SeeAlso: ??? +Feature: PDF +Description: Supports pdf format +Section: Painting +Requires: TEMPORARYFILE +Name: QPdf +SeeAlso: ??? + Feature: PRINTER Description: Supports printing Section: Painting @@ -1095,7 +1102,7 @@ SeeAlso: ??? Feature: DBUS Description: Provides classes for D-Bus. Section: D-Bus -Requires: PROPERTIES DOM +Requires: PROPERTIES XMLSTREAMREADER Name: Qt D-Bus module SeeAlso: ??? diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 7a00e4eb32..c085dbaa4d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -511,7 +511,7 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); the application is compiled using Forte Developer, or Sun Studio C++. The header file also declares a range of macros (Q_OS_*) that are defined for the specified platforms. For example, - Q_OS_X11 which is defined for the X Window System. + Q_OS_UNIX which is defined for the Unix-based systems. The purpose of these macros is to enable programmers to add compiler or platform specific code to their application. @@ -1696,7 +1696,7 @@ Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) { QSysInfo::MacVersion QSysInfo::macVersion() { -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX SInt32 gestalt_version; if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) { return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2); diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 79e32fe793..4e63e5d0ba 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -45,11 +45,11 @@ #include <stddef.h> -#define QT_VERSION_STR "5.1.0" +#define QT_VERSION_STR "5.1.1" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050100 +#define QT_VERSION 0x050101 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index c8293beb4e..a37fc15b61 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -501,7 +501,7 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info) templatecount = 1; --pos; while (pos && templatecount) { - register char c = info.at(pos); + char c = info.at(pos); if (c == '>') ++templatecount; else if (c == '<') @@ -917,21 +917,19 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const QString &message) { #if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) - wchar_t contextFileL[256]; - // we probably should let the compiler do this for us, by - // declaring QMessageLogContext::file to be const wchar_t * in - // the first place, but the #ifdefery above is very complex - // and we wouldn't be able to change it later on... - convert_to_wchar_t_elided(contextFileL, sizeof contextFileL / sizeof *contextFileL, context.file); + wchar_t contextFileL[256]; + // we probably should let the compiler do this for us, by declaring QMessageLogContext::file to + // be const wchar_t * in the first place, but the #ifdefery above is very complex and we + // wouldn't be able to change it later on... + convert_to_wchar_t_elided(contextFileL, sizeof contextFileL / sizeof *contextFileL, + context.file); // get the current report mode int reportMode = _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); _CrtSetReportMode(_CRT_ERROR, reportMode); - int ret = _CrtDbgReportW(_CRT_ERROR, contextFileL, - context.line, _CRT_WIDE(QT_VERSION_STR), - reinterpret_cast<const wchar_t *> ( - message.utf16())); - if (ret == 0 && reportMode & _CRTDBG_MODE_WNDW) + int ret = _CrtDbgReportW(_CRT_ERROR, contextFileL, context.line, _CRT_WIDE(QT_VERSION_STR), + reinterpret_cast<const wchar_t *>(message.utf16())); + if ((ret == 0) && (reportMode & _CRTDBG_MODE_WNDW)) return; // ignore else if (ret == 1) _CrtDbgBreak(); diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 8e34c9792d..58736ac2b8 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -110,7 +110,7 @@ public: To create a proper QTypeInfo specialization for A struct, we have to check all sub-components; B, C and D, then take the lowest common denominator and call - Q_DECLATE_TYPEINFO with the resulting flags. An easier and less fragile approach is to + Q_DECLARE_TYPEINFO with the resulting flags. An easier and less fragile approach is to use QTypeInfoMerger, which does that automatically. So struct A would have the following QTypeInfo definition: diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 18f3404c5d..024af79c33 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -220,7 +220,7 @@ QT_BEGIN_NAMESPACE QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent) { - register int fd = -1; + int fd = -1; #ifdef IN_CLOEXEC fd = inotify_init1(IN_CLOEXEC); #endif diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index fca1a446ce..2b38019674 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -255,6 +255,7 @@ qint64 QFSFileEnginePrivate::nativeSize() const if (!filled) { thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno)); + return 0; } return metaData.size(); } diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index ed3b399fbf..db81d65565 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -45,6 +45,7 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qfileinfo.h" #include "QtCore/qdebug.h" +#include "QtCore/qdatetime.h" #include "private/qcore_unix_p.h" // qt_safe_open #include "private/qabstractfileengine_p.h" @@ -80,12 +81,13 @@ static qint64 qt_write_loop(int fd, const char *data, qint64 len) int QLockFilePrivate::checkFcntlWorksAfterFlock() { +#ifndef QT_NO_TEMPORARYFILE QTemporaryFile file; if (!file.open()) - return -2; + return 0; const int fd = file.d_func()->engine()->handle(); if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs - return -3; + return 0; struct flock flockData; flockData.l_type = F_WRLCK; flockData.l_whence = SEEK_SET; @@ -95,6 +97,9 @@ int QLockFilePrivate::checkFcntlWorksAfterFlock() if (fcntl(fd, F_SETLK, &flockData) == -1) // for networked filesystems return 0; return 1; +#else + return 0; +#endif } static QBasicAtomicInt fcntlOK = Q_BASIC_ATOMIC_INITIALIZER(-1); diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index f8b5ebcabd..5ed429c464 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -39,8 +39,11 @@ ** ****************************************************************************/ -#include "qplatformdefs.h" #include "qsavefile.h" + +#ifndef QT_NO_TEMPORARYFILE + +#include "qplatformdefs.h" #include "private/qsavefile_p.h" #include "qfileinfo.h" #include "qabstractfileengine_p.h" @@ -381,3 +384,5 @@ bool QSaveFile::directWriteFallback() const } QT_END_NAMESPACE + +#endif // QT_NO_TEMPORARYFILE diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 6d81f58d42..ad18417124 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -42,6 +42,10 @@ #ifndef QSAVEFILE_H #define QSAVEFILE_H +#include <QtCore/qglobal.h> + +#ifndef QT_NO_TEMPORARYFILE + #include <QtCore/qfiledevice.h> #include <QtCore/qstring.h> @@ -51,7 +55,6 @@ QT_BEGIN_NAMESPACE - class QAbstractFileEngine; class QSaveFilePrivate; @@ -90,4 +93,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif // QSAVEFILE_H diff --git a/src/corelib/io/qsavefile_p.h b/src/corelib/io/qsavefile_p.h index 53a8b5eb34..b9efd1ee7c 100644 --- a/src/corelib/io/qsavefile_p.h +++ b/src/corelib/io/qsavefile_p.h @@ -53,6 +53,10 @@ // We mean it. // +#include <QtCore/qglobal.h> + +#ifndef QT_NO_TEMPORARYFILE + #include "private/qfiledevice_p.h" QT_BEGIN_NAMESPACE @@ -75,4 +79,6 @@ protected: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif // QSAVEFILE_P_H diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index d274f60ecc..fe637c8dfd 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -42,6 +42,10 @@ #ifndef QTEMPORARYFILE_P_H #define QTEMPORARYFILE_P_H +#include <QtCore/qglobal.h> + +#ifndef QT_NO_TEMPORARYFILE + #include "private/qfsfileengine_p.h" #include "private/qfilesystemengine_p.h" #include "private/qfile_p.h" @@ -99,5 +103,7 @@ public: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif /* QTEMPORARYFILE_P_H */ diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 02e7b967ea..f2e1f9bbc7 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -882,7 +882,7 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro // schemes are ASCII only, so we don't need the full Unicode toLower QChar *schemeData = scheme.data(); // force detaching here for (int i = needsLowercasing; i >= 0; --i) { - register ushort c = schemeData[i].unicode(); + ushort c = schemeData[i].unicode(); if (c >= 'A' && c <= 'Z') schemeData[i] = c + 0x20; } @@ -1244,7 +1244,7 @@ inline void QUrlPrivate::parse(const QString &url, QUrl::ParsingMode parsingMode const ushort *const data = reinterpret_cast<const ushort *>(begin); for (int i = 0; i < len; ++i) { - register uint uc = data[i]; + uint uc = data[i]; if (uc == '#' && hash == -1) { hash = i; @@ -1472,7 +1472,7 @@ inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, int *p // check for a path of "text:text/" for (int i = 0; i < path.length(); ++i) { - register ushort c = path.at(i).unicode(); + ushort c = path.at(i).unicode(); if (c == '/') { // found the slash before the colon return NoError; @@ -1512,7 +1512,7 @@ bool QUrlPrivate::validateComponent(QUrlPrivate::Section section, const QString const ushort *const data = reinterpret_cast<const ushort *>(input.constData()); for (uint i = uint(begin); i < uint(end); ++i) { - register uint uc = data[i]; + uint uc = data[i]; if (uc >= 0x80) continue; diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index fac1703da8..70db9e09eb 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -1468,11 +1468,12 @@ static void mapToLowerCase(QString *str, int from) int l = 1; while (l < 4 && entry->mapping[l]) ++l; - if (l > 1) { + if (l > 1 || uc > 0xffff) { if (uc <= 0xffff) str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); else - str->replace(i-1, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); + str->replace(--i, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); + i += l - 1; d = 0; } else { if (!d) @@ -1501,18 +1502,20 @@ static bool isMappedToNothing(uint uc) } -static void stripProhibitedOutput(QString *str, int from) +static bool containsProhibitedOuptut(const QString *str, int from) { - ushort *out = (ushort *)str->data() + from; - const ushort *in = out; + const ushort *in = reinterpret_cast<const ushort *>(str->begin() + from); const ushort *end = (ushort *)str->data() + str->size(); - while (in < end) { + for ( ; in < end; ++in) { uint uc = *in; if (QChar(uc).isHighSurrogate() && in < end - 1) { ushort low = *(in + 1); if (QChar(low).isLowSurrogate()) { ++in; uc = QChar::surrogateToUcs4(uc, low); + } else { + // unpaired surrogates are prohibited + return true; } } if (uc <= 0xFFFF) { @@ -1537,7 +1540,7 @@ static void stripProhibitedOutput(QString *str, int from) || (uc >= 0xFDD0 && uc <= 0xFDEF) || uc == 0xFEFF || (uc >= 0xFFF9 && uc <= 0xFFFF))) { - *out++ = *in; + continue; } } else { if (!((uc >= 0x1D173 && uc <= 0x1D17A) @@ -1561,14 +1564,12 @@ static void stripProhibitedOutput(QString *str, int from) || (uc >= 0xFFFFE && uc <= 0xFFFFF) || (uc >= 0x100000 && uc <= 0x10FFFD) || (uc >= 0x10FFFE && uc <= 0x10FFFF))) { - *out++ = QChar::highSurrogate(uc); - *out++ = QChar::lowSurrogate(uc); + continue; } } - ++in; + return true; } - if (in != out) - str->truncate(out - str->utf16()); + return false; } static bool isBidirectionalRorAL(uint uc) @@ -2027,8 +2028,8 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) const QChar *e = src + source->size(); for ( ; out < e; ++out) { - register ushort uc = out->unicode(); - if (uc > 0x80) { + ushort uc = out->unicode(); + if (uc >= 0x80) { break; } else if (uc >= 'A' && uc <= 'Z') { *out = QChar(uc | 0x20); @@ -2065,8 +2066,8 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) if (uc <= 0xFFFF) { *out++ = *in; } else { - *out++ = QChar::highSurrogate(uc); - *out++ = QChar::lowSurrogate(uc); + *out++ = in[-1]; + *out++ = in[0]; } } } @@ -2083,7 +2084,10 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) firstNonAscii > from ? firstNonAscii - 1 : from); // Strip prohibited output - stripProhibitedOutput(source, firstNonAscii); + if (containsProhibitedOuptut(source, firstNonAscii)) { + source->resize(from); + return; + } // Check for valid bidirectional characters bool containsLCat = false; @@ -2117,7 +2121,7 @@ Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len) return false; for (int i = 0; i < len; ++i) { - register ushort c = uc[i].unicode(); + ushort c = uc[i].unicode(); if (c == '-' && (i == 0 || i == len - 1)) return false; @@ -2500,7 +2504,7 @@ QString qt_ACE_do(const QString &domain, AceOperation op) const QChar *in = domain.constData() + lastIdx; const QChar *e = in + labelLength; for (; in < e; ++in, ++out) { - register ushort uc = in->unicode(); + ushort uc = in->unicode(); if (uc > 0x7f) simple = false; if (uc >= 'A' && uc <= 'Z') @@ -2529,7 +2533,7 @@ QString qt_ACE_do(const QString &domain, AceOperation op) // That means we need one or two temporaries qt_nameprep(&result, prevLen); labelLength = result.length() - prevLen; - register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes + int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes aceForm.resize(0); if (toReserve > aceForm.capacity()) aceForm.reserve(toReserve); diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp index 6e01272831..5ff0c40a4f 100644 --- a/src/corelib/io/qurlrecode.cpp +++ b/src/corelib/io/qurlrecode.cpp @@ -464,7 +464,7 @@ static int recode(QString &result, const ushort *begin, const ushort *end, QUrl: ushort *output = 0; for ( ; input != end; ++input) { - register ushort c; + ushort c; EncodingAction action; // try a run where no change is necessary @@ -483,7 +483,7 @@ static int recode(QString &result, const ushort *begin, const ushort *end, QUrl: break; non_trivial: - register uint decoded; + uint decoded; if (c == '%' && retryBadEncoding) { // always write "%25" ensureDetached(result, output, begin, input, end); diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 4211a23e0f..f0899c6dee 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -65,7 +65,7 @@ #include "qglobal.h" -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX #include <CoreServices/CoreServices.h> #endif diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 241658acb1..98e697eb57 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -79,7 +79,7 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, { if (!orig_timeout) { // no timeout -> block forever - register int ret; + int ret; EINTR_LOOP(ret, select(nfds, fdread, fdwrite, fdexcept, 0)); return ret; } diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index b68146cd6c..8c0589fdc6 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -168,7 +168,7 @@ static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 07 #ifdef O_CLOEXEC flags |= O_CLOEXEC; #endif - register int fd; + int fd; EINTR_LOOP(fd, QT_OPEN(pathname, flags, mode)); // unknown flags are ignored, so we have no way of verifying if @@ -191,7 +191,7 @@ static inline int qt_safe_pipe(int pipefd[2], int flags = 0) Q_ASSERT((flags & ~O_NONBLOCK) == 0); #endif - register int ret; + int ret; #if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(O_CLOEXEC) // use pipe2 flags |= O_CLOEXEC; @@ -223,7 +223,7 @@ static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC { Q_ASSERT(flags == FD_CLOEXEC || flags == 0); - register int ret; + int ret; #ifdef F_DUPFD_CLOEXEC // use this fcntl if (flags & FD_CLOEXEC) { @@ -247,7 +247,7 @@ static inline int qt_safe_dup2(int oldfd, int newfd, int flags = FD_CLOEXEC) { Q_ASSERT(flags == FD_CLOEXEC || flags == 0); - register int ret; + int ret; #if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(O_CLOEXEC) // use dup3 if (flags & FD_CLOEXEC) { @@ -291,7 +291,7 @@ static inline qint64 qt_safe_write_nosignal(int fd, const void *data, qint64 len static inline int qt_safe_close(int fd) { - register int ret; + int ret; EINTR_LOOP(ret, QT_CLOSE(fd)); return ret; } @@ -303,28 +303,28 @@ static inline int qt_safe_close(int fd) static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) { - register int ret; + int ret; EINTR_LOOP(ret, ::execve(filename, argv, envp)); return ret; } static inline int qt_safe_execv(const char *path, char *const argv[]) { - register int ret; + int ret; EINTR_LOOP(ret, ::execv(path, argv)); return ret; } static inline int qt_safe_execvp(const char *file, char *const argv[]) { - register int ret; + int ret; EINTR_LOOP(ret, ::execvp(file, argv)); return ret; } static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) { - register int ret; + int ret; EINTR_LOOP(ret, ::waitpid(pid, status, options)); return ret; } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 100e014e99..e49d5f961c 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -938,7 +938,7 @@ bool QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject *receiv if (receiver->d_func()->threadData == this->threadData && extraData) { // application event filters are only called for objects in the GUI thread for (int i = 0; i < extraData->eventFilters.size(); ++i) { - register QObject *obj = extraData->eventFilters.at(i); + QObject *obj = extraData->eventFilters.at(i); if (!obj) continue; if (obj->d_func()->threadData != threadData) { @@ -957,7 +957,7 @@ bool QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *receiver, Q Q_Q(QCoreApplication); if (receiver != q && receiver->d_func()->extraData) { for (int i = 0; i < receiver->d_func()->extraData->eventFilters.size(); ++i) { - register QObject *obj = receiver->d_func()->extraData->eventFilters.at(i); + QObject *obj = receiver->d_func()->extraData->eventFilters.at(i); if (!obj) continue; if (obj->d_func()->threadData != receiver->d_func()->threadData) { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index b9f7462b12..50f3a1814b 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -90,6 +90,7 @@ struct DefinedTypesFilter { /*! \macro Q_DECLARE_OPAQUE_POINTER(PointerType) \relates QMetaType + \since 5.0 This macro enables pointers to forward-declared types (\a PointerType) to be registered with QMetaType using either Q_DECLARE_METATYPE() diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index aed998f2e2..d9b286e691 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -686,7 +686,7 @@ struct QMetaTypeIdQObject<T*, /* isPointerToTypeDerivedFromQObject */ true> template <typename T> inline int qRegisterMetaTypeStreamOperators() { - register int id = qMetaTypeId<T>(); + int id = qMetaTypeId<T>(); QMetaType::registerStreamOperators(id, QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Save, QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Load); return id; @@ -830,8 +830,8 @@ struct QMetaTypeId_ ## SMART_POINTER ## _QObjectStar<T, true> \ return id; \ const char * const cName = T::staticMetaObject.className(); \ QByteArray typeName; \ - typeName.reserve(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1); \ - typeName.append(#SMART_POINTER, sizeof(#SMART_POINTER) - 1) \ + typeName.reserve(int(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1)); \ + typeName.append(#SMART_POINTER, int(sizeof(#SMART_POINTER)) - 1) \ .append('<').append(cName).append('>'); \ const int newId = qRegisterNormalizedMetaType< SMART_POINTER<T> >( \ typeName, \ diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp index 6e2838a8a5..073bd020ba 100644 --- a/src/corelib/kernel/qsystemsemaphore_unix.cpp +++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp @@ -212,7 +212,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) operation.sem_op = count; operation.sem_flg = SEM_UNDO; - register int res; + int res; EINTR_LOOP(res, semop(semaphore, &operation, 1)); if (-1 == res) { // If the semaphore was removed be nice and create it and then modifySemaphore again diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp index 0e33fa697a..f1bbbe5338 100644 --- a/src/corelib/kernel/qtimerinfo_unix.cpp +++ b/src/corelib/kernel/qtimerinfo_unix.cpp @@ -153,7 +153,7 @@ void QTimerInfoList::timerRepair(const timespec &diff) { // repair all timers for (int i = 0; i < size(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); t->timeout = t->timeout + diff; } } @@ -182,7 +182,7 @@ void QTimerInfoList::timerInsert(QTimerInfo *ti) { int index = size(); while (index--) { - register const QTimerInfo * const t = at(index); + const QTimerInfo * const t = at(index); if (!(ti->timeout < t->timeout)) break; } @@ -244,8 +244,8 @@ static void calculateCoarseTimerTimeout(QTimerInfo *t, timespec currentTime) // // The objective is to make most timers wake up at the same time, thereby reducing CPU wakeups. - register uint interval = uint(t->interval); - register uint msec = uint(t->timeout.tv_nsec) / 1000 / 1000; + uint interval = uint(t->interval); + uint msec = uint(t->timeout.tv_nsec) / 1000 / 1000; Q_ASSERT(interval >= 20); // Calculate how much we can round and still keep within 5% error @@ -256,14 +256,14 @@ static void calculateCoarseTimerTimeout(QTimerInfo *t, timespec currentTime) if (interval < 50) { // round to even // round towards multiples of 50 ms - register bool roundUp = (msec % 50) >= 25; + bool roundUp = (msec % 50) >= 25; msec >>= 1; msec |= uint(roundUp); msec <<= 1; } else { // round to multiple of 4 // round towards multiples of 100 ms - register bool roundUp = (msec % 100) >= 50; + bool roundUp = (msec % 100) >= 50; msec >>= 2; msec |= uint(roundUp); msec <<= 2; @@ -423,7 +423,7 @@ int QTimerInfoList::timerRemainingTime(int timerId) timespec tm = {0, 0}; for (int i = 0; i < count(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); if (t->id == timerId) { if (currentTime < t->timeout) { // time to wait @@ -509,7 +509,7 @@ bool QTimerInfoList::unregisterTimer(int timerId) { // set timer inactive for (int i = 0; i < count(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); if (t->id == timerId) { // found it removeAt(i); @@ -530,7 +530,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object) if (isEmpty()) return false; for (int i = 0; i < count(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); if (t->obj == object) { // object found removeAt(i); @@ -550,7 +550,7 @@ QList<QAbstractEventDispatcher::TimerInfo> QTimerInfoList::registeredTimers(QObj { QList<QAbstractEventDispatcher::TimerInfo> list; for (int i = 0; i < count(); ++i) { - register const QTimerInfo * const t = at(i); + const QTimerInfo * const t = at(i); if (t->obj == object) { list << QAbstractEventDispatcher::TimerInfo(t->id, (t->timerType == Qt::VeryCoarseTimer diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 9243d093df..903ab2e2cd 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -1084,8 +1084,6 @@ void QTranslatorPrivate::clear() } /*! - \overload translate() - Returns the translation for the key (\a context, \a sourceText, \a disambiguation). If none is found, also tries (\a context, \a sourceText, ""). If that still fails, returns a null string. diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index bae4a837a0..276257ddcf 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -162,6 +162,10 @@ static qlonglong qMetaTypeNumber(const QVariant::Private *d) return qRound64(d->data.f); case QVariant::Double: return qRound64(d->data.d); +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + return v_cast<QJsonValue>(d)->toDouble(); +#endif } Q_ASSERT(false); return 0; @@ -206,12 +210,14 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok) case QMetaType::Long: case QMetaType::Float: case QMetaType::LongLong: + case QMetaType::QJsonValue: return qMetaTypeNumber(d); case QVariant::ULongLong: case QVariant::UInt: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: + return qlonglong(qMetaTypeUNumber(d)); } @@ -240,6 +246,7 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok) case QMetaType::Long: case QMetaType::Float: case QMetaType::LongLong: + case QMetaType::QJsonValue: return qulonglong(qMetaTypeNumber(d)); case QVariant::ULongLong: case QVariant::UInt: @@ -340,6 +347,9 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QVariant::Url: *str = v_cast<QUrl>(d)->toString(); break; + case QMetaType::QJsonValue: + *str = v_cast<QJsonValue>(d)->toString(); + break; #endif case QVariant::Uuid: *str = v_cast<QUuid>(d)->toString(); @@ -580,6 +590,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::ULong: *b = qMetaTypeUNumber(d) != Q_UINT64_C(0); break; +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + *b = v_cast<QJsonValue>(d)->toBool(); + break; +#endif default: *b = false; return false; @@ -616,6 +631,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::ULong: *f = double(qMetaTypeUNumber(d)); break; +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + *f = v_cast<QJsonValue>(d)->toDouble(); + break; +#endif default: *f = 0.0; return false; @@ -652,6 +672,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::ULong: *f = float(qMetaTypeUNumber(d)); break; +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + *f = v_cast<QJsonValue>(d)->toDouble(); + break; +#endif default: *f = 0.0f; return false; @@ -2731,6 +2756,29 @@ bool QVariant::canConvert(int targetTypeId) const if (targetTypeId >= QMetaType::User) return canConvertMetaObject(currentType, targetTypeId, d.data.o); + if (currentType == QMetaType::QJsonValue) { + switch (targetTypeId) { + case QMetaType::QString: + case QMetaType::Bool: + case QMetaType::Int: + case QMetaType::UInt: + case QMetaType::Double: + case QMetaType::Float: + case QMetaType::ULong: + case QMetaType::Long: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::UShort: + case QMetaType::UChar: + case QMetaType::Char: + case QMetaType::SChar: + case QMetaType::Short: + return true; + default: + return false; + } + } + // FIXME It should be LastCoreType intead of Uuid if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) { switch (uint(targetTypeId)) { diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 1288643e32..c617325e9e 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -120,6 +120,10 @@ void QFactoryLoader::update() d->loadedPaths << pluginDir; QString path = pluginDir + d->suffix; + + if (qt_debug_component()) + qDebug() << "QFactoryLoader::QFactoryLoader() checking directory path" << path << "..."; + if (!QDir(path).exists(QLatin1String("."))) continue; diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h index a0a851eabb..3a213f6a25 100644 --- a/src/corelib/thread/qgenericatomic.h +++ b/src/corelib/thread/qgenericatomic.h @@ -172,7 +172,7 @@ template <typename BaseClass> struct QGenericAtomicOps { // implement fetchAndStore on top of testAndSet Q_FOREVER { - register T tmp = load(_q_value); + T tmp = load(_q_value); if (BaseClass::testAndSetRelaxed(_q_value, tmp, newValue)) return tmp; } @@ -207,7 +207,7 @@ template <typename BaseClass> struct QGenericAtomicOps { // implement fetchAndAdd on top of testAndSet Q_FOREVER { - register T tmp = BaseClass::load(_q_value); + T tmp = BaseClass::load(_q_value); if (BaseClass::testAndSetRelaxed(_q_value, tmp, T(tmp + valueToAdd))) return tmp; } diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 1ed4a77950..378813c889 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE static inline bool isRecursive(QMutexData *d) { - register quintptr u = quintptr(d); + quintptr u = quintptr(d); if (Q_LIKELY(u <= 0x3)) return false; #ifdef QT_LINUX_FUTEX diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index f123e1813b..6a91193785 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -83,9 +83,9 @@ # define old_qDebug qDebug # undef qDebug # endif -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX # include <CoreServices/CoreServices.h> -#endif //Q_OS_IOS +#endif // Q_OS_MACX # ifdef old_qDebug # undef qDebug @@ -172,6 +172,12 @@ static void destroy_current_thread_data_key() { pthread_once(¤t_thread_data_once, create_current_thread_data_key); pthread_key_delete(current_thread_data_key); + + // Reset current_thread_data_once in case we end up recreating + // the thread-data in the rare case of QObject construction + // after destroying the QThreadData. + pthread_once_t pthread_once_init = PTHREAD_ONCE_INIT; + current_thread_data_once = pthread_once_init; } Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key) diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index cc544af868..ad6c3d913c 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -33,7 +33,7 @@ \brief The <QtAlgorithms> header includes the generic, template-based algorithms. Qt provides a number of global template functions in \c - <QtAlgorithms> that work on containers and perform well-know + <QtAlgorithms> that work on containers and perform well-known algorithms. You can use these algorithms with any \l {container class} that provides STL-style iterators, including Qt's QList, QLinkedList, QVector, QMap, and QHash classes. diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 3cd8c51c07..c8a0825480 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -62,7 +62,7 @@ struct QPodArrayOps Q_ASSERT(newSize <= this->alloc); ::memset(this->end(), 0, (newSize - this->size) * sizeof(T)); - this->size = newSize; + this->size = int(newSize); } void copyAppend(const T *b, const T *e) @@ -84,7 +84,7 @@ struct QPodArrayOps const T *const end = iter + n; for (; iter != end; ++iter) ::memcpy(iter, &t, sizeof(T)); - this->size += n; + this->size += int(n); } void truncate(size_t newSize) @@ -92,7 +92,7 @@ struct QPodArrayOps Q_ASSERT(!this->ref.isShared()); Q_ASSERT(newSize < size_t(this->size)); - this->size = newSize; + this->size = int(newSize); } void destroyAll() // Call from destructors, ONLY! diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 2b459b2b1b..b04c4f9c3d 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -122,7 +122,8 @@ QT_BEGIN_NAMESPACE */ QBitArray::QBitArray(int size, bool value) { - if (!size) { + Q_ASSERT_X(size >= 0, "QBitArray::QBitArray", "Size must be greater than or equal to 0."); + if (size <= 0) { d.resize(0); return; } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index dc3f5f3be9..75900e9775 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -261,8 +261,8 @@ int qstrcmp(const char *str1, const char *str2) int qstricmp(const char *str1, const char *str2) { - register const uchar *s1 = reinterpret_cast<const uchar *>(str1); - register const uchar *s2 = reinterpret_cast<const uchar *>(str2); + const uchar *s1 = reinterpret_cast<const uchar *>(str1); + const uchar *s2 = reinterpret_cast<const uchar *>(str2); int res; uchar c; if (!s1 || !s2) @@ -295,8 +295,8 @@ int qstricmp(const char *str1, const char *str2) int qstrnicmp(const char *str1, const char *str2, uint len) { - register const uchar *s1 = reinterpret_cast<const uchar *>(str1); - register const uchar *s2 = reinterpret_cast<const uchar *>(str2); + const uchar *s1 = reinterpret_cast<const uchar *>(str1); + const uchar *s2 = reinterpret_cast<const uchar *>(str2); int res; uchar c; if (!s1 || !s2) @@ -321,7 +321,7 @@ int qstrcmp(const QByteArray &str1, const char *str2) const char *str1data = str1.constData(); const char *str1end = str1data + str1.length(); for ( ; str1data < str1end && *str2; ++str1data, ++str2) { - register int diff = int(uchar(*str1data)) - uchar(*str2); + int diff = int(uchar(*str1data)) - uchar(*str2); if (diff) // found a difference return diff; @@ -357,8 +357,8 @@ int qstrcmp(const QByteArray &str1, const QByteArray &str2) #if 0 static void createCRC16Table() // build CRC16 lookup table { - register unsigned int i; - register unsigned int j; + unsigned int i; + unsigned int j; unsigned short crc_tbl[16]; unsigned int v0, v1, v2, v3; for (i = 0; i < 16; i++) { @@ -410,7 +410,7 @@ static const quint16 crc_tbl[16] = { quint16 qChecksum(const char *data, uint len) { - register quint16 crc = 0xffff; + quint16 crc = 0xffff; uchar c; const uchar *p = reinterpret_cast<const uchar *>(data); while (len--) { @@ -2671,7 +2671,7 @@ QByteArray QByteArray::mid(int pos, int len) const QByteArray QByteArray::toLower() const { QByteArray s(*this); - register uchar *p = reinterpret_cast<uchar *>(s.data()); + uchar *p = reinterpret_cast<uchar *>(s.data()); if (p) { while (*p) { *p = QChar::toLower((ushort)*p); @@ -2694,7 +2694,7 @@ QByteArray QByteArray::toLower() const QByteArray QByteArray::toUpper() const { QByteArray s(*this); - register uchar *p = reinterpret_cast<uchar *>(s.data()); + uchar *p = reinterpret_cast<uchar *>(s.data()); if (p) { while (*p) { *p = QChar::toUpper((ushort)*p); diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index bcd6a56aad..d030192117 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -61,7 +61,7 @@ static inline int bm_find(const uchar *cc, int l, int index, const uchar *puc, u return index > l ? -1 : index; const uint pl_minus_one = pl - 1; - register const uchar *current = cc + index + pl_minus_one; + const uchar *current = cc + index + pl_minus_one; const uchar *end = cc + l; while (current < end) { uint skip = skiptable[*current]; diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 8545276dac..9ab7155c2d 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -1739,10 +1739,10 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) if (from < 0 || s.length() - from < 2) return; - int starter = 0; // starter position uint stcode = 0; // starter code point - int next = -1; - int lastCombining = 0; + int starter = -1; // starter position + int next = -1; // to prevent i == next + int lastCombining = 255; // to prevent combining > lastCombining int pos = from; while (pos < s.length()) { @@ -1766,8 +1766,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) } int combining = p->combiningClass; - if (i == next || combining > lastCombining) { - Q_ASSERT(starter >= from); + if ((i == next || combining > lastCombining) && starter >= from) { // allowed to form ligature with S uint ligature = ligatureHelper(stcode, uc); if (ligature) { diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index 6d60a97062..e2dfa6c801 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -289,9 +289,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const case DateToStringShort: return lc_region.toString(in.toDate(), QLocale::ShortFormat); case TimeToStringLong: - return lc_region.toString(in.toTime(), QLocale::LongFormat); + return lc_region.toString(in.toTime(), d->timeFormat(QLocale::LongFormat).toString()); case TimeToStringShort: - return lc_region.toString(in.toTime(), QLocale::ShortFormat); + return lc_region.toString(in.toTime(), d->timeFormat(QLocale::ShortFormat).toString()); case DateTimeToStringShort: return lc_region.toString(in.toDateTime(), d->dateTimeFormat(QLocale::ShortFormat).toString()); case DateTimeToStringLong: diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp index 24ca628b5a..6b716b356f 100644 --- a/src/corelib/tools/qlocale_tools.cpp +++ b/src/corelib/tools/qlocale_tools.cpp @@ -300,13 +300,13 @@ bool removeGroupSeparators(QLocalePrivate::CharBuff *num) * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -qulonglong qstrtoull(const char *nptr, const char **endptr, register int base, bool *ok) +qulonglong qstrtoull(const char *nptr, const char **endptr, int base, bool *ok) { - register const char *s = nptr; - register qulonglong acc; - register unsigned char c; - register qulonglong qbase, cutoff; - register int any, cutlim; + const char *s = nptr; + qulonglong acc; + unsigned char c; + qulonglong qbase, cutoff; + int any, cutlim; if (ok != 0) *ok = true; @@ -381,13 +381,13 @@ qulonglong qstrtoull(const char *nptr, const char **endptr, register int base, b * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -qlonglong qstrtoll(const char *nptr, const char **endptr, register int base, bool *ok) +qlonglong qstrtoll(const char *nptr, const char **endptr, int base, bool *ok) { - register const char *s; - register qulonglong acc; - register unsigned char c; - register qulonglong qbase, cutoff; - register int neg, any, cutlim; + const char *s; + qulonglong acc; + unsigned char c; + qulonglong qbase, cutoff; + int neg, any, cutlim; /* * Skip white space and pick up leading +/- sign if any. diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h index 3c4e9b5bd5..cb47bfcb5e 100644 --- a/src/corelib/tools/qlocale_tools_p.h +++ b/src/corelib/tools/qlocale_tools_p.h @@ -110,8 +110,8 @@ bool removeGroupSeparators(QLocalePrivate::CharBuff *num); Q_CORE_EXPORT char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **digits_str); Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok); -qlonglong qstrtoll(const char *nptr, const char **endptr, register int base, bool *ok); -qulonglong qstrtoull(const char *nptr, const char **endptr, register int base, bool *ok); +qlonglong qstrtoll(const char *nptr, const char **endptr, int base, bool *ok); +qulonglong qstrtoull(const char *nptr, const char **endptr, int base, bool *ok); QT_END_NAMESPACE diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index e197fd9178..41b2b266ee 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -201,6 +201,12 @@ QT_BEGIN_NAMESPACE function to manipulate the rectangle's coordinates and dimensions in one go. + \section1 Constraints + + QRect is limited to the minimum and maximum values for the \c int type. + Operations on a QRect that could potentially result in values outside this + range will result in undefined behavior. + \sa QRectF, QRegion */ diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index a50c7da6cc..a2a58f8926 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1031,7 +1031,7 @@ void QRegularExpressionPrivate::getPatternInfo() */ class QPcreJitStackPointer { - Q_DISABLE_COPY(QPcreJitStackPointer); + Q_DISABLE_COPY(QPcreJitStackPointer) public: /*! diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 5e30cf3ecb..1423449a69 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -506,7 +506,7 @@ public: if (o) { // increase the strongref, but never up from zero // or less (-1 is used by QWeakPointer on untracked QObject) - register int tmp = o->strongref.load(); + int tmp = o->strongref.load(); while (tmp > 0) { // try to increment from "tmp" to "tmp + 1" if (o->strongref.testAndSetRelaxed(tmp, tmp + 1)) @@ -801,7 +801,7 @@ namespace QtSharedPointer { template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &src) { - register X *ptr = static_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + X *ptr = static_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid return QtSharedPointer::copyAndSetPointer(ptr, src); } template <class X, class T> @@ -813,7 +813,7 @@ Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &sr template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src) { - register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid if (!ptr) return QSharedPointer<X>(); return QtSharedPointer::copyAndSetPointer(ptr, src); @@ -827,7 +827,7 @@ Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &src) { - register X *ptr = const_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + X *ptr = const_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid return QtSharedPointer::copyAndSetPointer(ptr, src); } template <class X, class T> @@ -847,7 +847,7 @@ QWeakPointer<X> qWeakPointerCast(const QSharedPointer<T> &src) template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src) { - register X *ptr = qobject_cast<X *>(src.data()); + X *ptr = qobject_cast<X *>(src.data()); return QtSharedPointer::copyAndSetPointer(ptr, src); } template <class X, class T> diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 97a64eb5bb..c81df7a6f2 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -240,14 +240,14 @@ inline quint64 _xgetbv(__int64) { return 0; } #endif static void xgetbv(uint in, uint &eax, uint &edx) { -#ifdef Q_OS_WIN - quint64 result = _xgetbv(in); - eax = result; - edx = result >> 32; -#elif defined(Q_CC_GNU) +#if defined(Q_CC_GNU) asm (".byte 0x0F, 0x01, 0xD0" // xgetbv instruction : "=a" (eax), "=d" (edx) : "c" (in)); +#elif defined(Q_OS_WIN) + quint64 result = _xgetbv(in); + eax = result; + edx = result >> 32; #endif } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 54b1a084b2..de09e5bbe0 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -266,7 +266,7 @@ static bool qMemEquals(const quint16 *a, const quint16 *b, int length) if (a == b || !length) return true; - register union { + union { const quint16 *w; const quint32 *d; quintptr value; @@ -291,7 +291,7 @@ static bool qMemEquals(const quint16 *a, const quint16 *b, int length) // both addresses are 4-bytes aligned // do a fast 32-bit comparison - register const quint32 *e = sa.d + (length >> 1); + const quint32 *e = sa.d + (length >> 1); for ( ; sa.d != e; ++sa.d, ++sb.d) { if (*sa.d != *sb.d) return false; @@ -301,7 +301,7 @@ static bool qMemEquals(const quint16 *a, const quint16 *b, int length) return (length & 1) ? *sa.w == *sb.w : true; } else { // one of the addresses isn't 4-byte aligned but the other is - register const quint16 *e = sa.w + length; + const quint16 *e = sa.w + length; for ( ; sa.w != e; ++sa.w, ++sb.w) { if (*sa.w != *sb.w) return false; @@ -4908,8 +4908,8 @@ int QString::compare_helper(const QChar *data1, int length1, const QChar *data2, { if (cs == Qt::CaseSensitive) return ucstrcmp(data1, length1, data2, length2); - register const ushort *s1 = reinterpret_cast<const ushort *>(data1); - register const ushort *s2 = reinterpret_cast<const ushort *>(data2); + const ushort *s1 = reinterpret_cast<const ushort *>(data1); + const ushort *s2 = reinterpret_cast<const ushort *>(data2); return ucstricmp(s1, s1 + length1, s2, s2 + length2); } diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp index d54e9c7ba7..1b8a40ef2f 100644 --- a/src/corelib/tools/qstringmatcher.cpp +++ b/src/corelib/tools/qstringmatcher.cpp @@ -69,7 +69,7 @@ static inline int bm_find(const ushort *uc, uint l, int index, const ushort *puc return index > (int)l ? -1 : index; const uint pl_minus_one = pl - 1; - register const ushort *current = uc + index + pl_minus_one; + const ushort *current = uc + index + pl_minus_one; const ushort *end = uc + l; if (cs == Qt::CaseSensitive) { while (current < end) { diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 3a2028057d..825e05ae1b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -197,6 +197,8 @@ private: template <class T, int Prealloc> Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(int asize) : s(asize) { + Q_STATIC_ASSERT_X(Prealloc > 0, "QVarLengthArray Prealloc must be greater than 0."); + Q_ASSERT_X(s >= 0, "QVarLengthArray::QVarLengthArray()", "Size must be greater than or equal to 0."); if (s > Prealloc) { ptr = reinterpret_cast<T *>(malloc(s * sizeof(T))); Q_CHECK_PTR(ptr); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 816e1f15f6..489ee821b9 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -398,7 +398,8 @@ QVector<T> &QVector<T>::operator=(const QVector<T> &v) template <typename T> QVector<T>::QVector(int asize) { - if (Q_LIKELY(asize)) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (Q_LIKELY(asize > 0)) { d = Data::allocate(asize); d->size = asize; defaultConstruct(d->begin(), d->end()); @@ -410,7 +411,8 @@ QVector<T>::QVector(int asize) template <typename T> QVector<T>::QVector(int asize, const T &t) { - if (asize) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (asize > 0) { d = Data::allocate(asize); d->size = asize; T* i = d->end(); diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index df5e272a1e..c90490df7f 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE static inline bool isValidCharacterNoDash(QChar c) { - register ushort u = c.unicode(); + ushort u = c.unicode(); return (u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9') @@ -63,7 +63,7 @@ static inline bool isValidCharacterNoDash(QChar c) static inline bool isValidCharacter(QChar c) { - register ushort u = c.unicode(); + ushort u = c.unicode(); return (u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9') @@ -72,7 +72,7 @@ static inline bool isValidCharacter(QChar c) static inline bool isValidNumber(QChar c) { - register ushort u = c.unicode(); + ushort u = c.unicode(); return (u >= '0' && u <= '9'); } @@ -259,7 +259,7 @@ static bool isFixedType(int c) // returns NULL if it isn't valid. static const char *validateSingleType(const char *signature) { - register char c = *signature; + char c = *signature; if (c == DBUS_TYPE_INVALID) return 0; diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 6abde5e420..cb4e45f1d0 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -53,7 +53,7 @@ static void swapPixel01(QImage *image) // 1-bpp: swap 0 and 1 pixels { int i; if (image->depth() == 1 && image->colorCount() == 2) { - register uint *p = (uint *)image->bits(); + uint *p = (uint *)image->bits(); int nbytes = image->byteCount(); for (i=0; i<nbytes/4; i++) { *p = ~*p; @@ -368,7 +368,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int if (comp == BMP_RLE4) { // run length compression int x=0, y=0, c, i; quint8 b; - register uchar *p = data + (h-1)*bpl; + uchar *p = data + (h-1)*bpl; const uchar *endp = p + w; while (y < h) { if (!d->getChar((char *)&b)) @@ -440,7 +440,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int while (--h >= 0) { if (d->read((char*)buf,buflen) != buflen) break; - register uchar *p = data + h*bpl; + uchar *p = data + h*bpl; uchar *b = buf; for (int i=0; i<w/2; i++) { // convert nibbles to bytes *p++ = *b >> 4; @@ -457,7 +457,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int if (comp == BMP_RLE8) { // run length compression int x=0, y=0; quint8 b; - register uchar *p = data + (h-1)*bpl; + uchar *p = data + (h-1)*bpl; const uchar *endp = p + w; while (y < h) { if (!d->getChar((char *)&b)) @@ -520,7 +520,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int } else if (nbits == 16 || nbits == 24 || nbits == 32) { // 16,24,32 bit BMP image - register QRgb *p; + QRgb *p; QRgb *end; uchar *buf24 = new uchar[bpl]; int bpl24 = ((w*nbits+31)/32)*4; @@ -632,7 +632,7 @@ bool qt_write_dib(QDataStream &s, QImage image) uchar *buf = new uchar[bpl_bmp]; uchar *b, *end; - register const uchar *p; + const uchar *p; memset(buf, 0, bpl_bmp); for (y=image.height()-1; y>=0; y--) { // write the image bits diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 0efb9c2646..98f3aeeeb9 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2270,7 +2270,7 @@ static void dither_to_Mono(QImageData *dst, const QImageData *src, int *b1, *b2; int wbytes = w * (d/8); - register const uchar *p = src->data; + const uchar *p = src->data; const uchar *end = p + wbytes; b2 = line2; if (use_gray) { // 8 bit image @@ -2830,7 +2830,7 @@ static void convert_Mono_to_X32(QImageData *dest, const QImageData *src, Qt::Ima uchar *dest_data = dest->data; if (src->format == QImage::Format_Mono) { for (int y = 0; y < dest->height; y++) { - register uint *p = (uint *)dest_data; + uint *p = (uint *)dest_data; for (int x = 0; x < dest->width; x++) *p++ = colorTable.at((src_data[x>>3] >> (7 - (x & 7))) & 1); @@ -2839,7 +2839,7 @@ static void convert_Mono_to_X32(QImageData *dest, const QImageData *src, Qt::Ima } } else { for (int y = 0; y < dest->height; y++) { - register uint *p = (uint *)dest_data; + uint *p = (uint *)dest_data; for (int x = 0; x < dest->width; x++) *p++ = colorTable.at((src_data[x>>3] >> (x & 7)) & 1); @@ -2873,7 +2873,7 @@ static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt uchar *dest_data = dest->data; if (src->format == QImage::Format_Mono) { for (int y = 0; y < dest->height; y++) { - register uchar *p = dest_data; + uchar *p = dest_data; for (int x = 0; x < dest->width; x++) *p++ = (src_data[x>>3] >> (7 - (x & 7))) & 1; src_data += src->bytes_per_line; @@ -2881,7 +2881,7 @@ static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt } } else { for (int y = 0; y < dest->height; y++) { - register uchar *p = dest_data; + uchar *p = dest_data; for (int x = 0; x < dest->width; x++) *p++ = (src_data[x>>3] >> (x & 7)) & 1; src_data += src->bytes_per_line; diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index e425eca521..6fc41df77c 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -188,7 +188,7 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q } } } else { // read ascii data - register uchar *p; + uchar *p; int n; for (y=0; y<h; y++) { p = outImage->scanLine(y); diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index 498f6ce767..aceb6623ea 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE X bitmap image read/write functions *****************************************************************************/ -static inline int hex2byte(register char *p) +static inline int hex2byte(char *p) { return ((isdigit((uchar) *p) ? *p - '0' : toupper((uchar) *p) - 'A' + 10) << 4) | (isdigit((uchar) *(p+1)) ? *(p+1) - '0' : toupper((uchar) *(p+1)) - 'A' + 10); @@ -215,7 +215,7 @@ static bool write_xbm_image(const QImage &sourceImage, QIODevice *device, const } } int bcnt = 0; - register char *p = buf; + char *p = buf; int bpl = (w+7)/8; for (int y = 0; y < h; ++y) { uchar *b = image.scanLine(y); diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 79dcc6d250..82276c5342 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -860,7 +860,14 @@ public: void setContentPos(const QPointF &pos); private: - QObject* m_target; +#ifdef Q_CC_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-private-field" +#endif // Q_CC_CLANG + QObject* m_target; // Qt 6 remove. +#ifdef Q_CC_CLANG +# pragma clang diagnostic pop +#endif // Q_CC_CLANG QPointF m_startPos; QSizeF m_viewportSize; QRectF m_contentPosRange; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 29a7e87d46..89664447c4 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -94,9 +94,12 @@ #include <QtGui/QClipboard> #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#endif +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# include <QtCore/qt_windows.h> +# include <QtCore/QLibraryInfo> +#endif // Q_OS_WIN && !Q_OS_WINCE QT_BEGIN_NAMESPACE @@ -782,12 +785,20 @@ static void init_platform(const QString &pluginArgument, const QString &platform QGuiApplicationPrivate::platform_name = new QString(name); } else { QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); - QString fatalMessage = - QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); - foreach(const QString &key, keys) { - fatalMessage.append(key + QLatin1Char('\n')); - } - qFatal("%s", fatalMessage.toLocal8Bit().constData()); + + QString fatalMessage + = QStringLiteral("Failed to find or load platform plugin \"%1\".\n").arg(name); + if (!keys.isEmpty()) + fatalMessage += QStringLiteral("Available platforms are: %1\n").arg( + keys.join(QStringLiteral(", "))); + fatalMessage += QStringLiteral("GUI applications require a platform plugin. Terminating."); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + // Windows: Display message box unless it is a console application + // or debug build showing an assert box. + if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) + MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); +#endif // Q_OS_WIN && !Q_OS_WINCE + qFatal("%s", qPrintable(fatalMessage)); return; } @@ -2477,10 +2488,18 @@ void QGuiApplicationPrivate::emitLastWindowClosed() bool QGuiApplicationPrivate::shouldQuit() { + const QWindowList processedWindows; + return shouldQuitInternal(processedWindows); +} + +bool QGuiApplicationPrivate::shouldQuitInternal(const QWindowList &processedWindows) +{ /* if there is no visible top-level window left, we allow the quit */ QWindowList list = QGuiApplication::topLevelWindows(); for (int i = 0; i < list.size(); ++i) { QWindow *w = list.at(i); + if (processedWindows.contains(w)) + continue; if (w->isVisible() && !w->transientParent()) return false; } diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index cd8dfff103..3a4b692b69 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -91,6 +91,8 @@ public: virtual bool shouldQuit(); + bool shouldQuitInternal(const QWindowList &processedWindows); + static Qt::KeyboardModifiers modifier_buttons; static Qt::MouseButtons mouse_buttons; diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 8a36df3e7c..3cbcd1c06d 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -96,7 +96,7 @@ private: friend class QOpenGLContextGroupPrivate; friend class QOpenGLMultiGroupSharedResource; - Q_DISABLE_COPY(QOpenGLSharedResource); + Q_DISABLE_COPY(QOpenGLSharedResource) }; class Q_GUI_EXPORT QOpenGLSharedResourceGuard : public QOpenGLSharedResource diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 25b603bb9c..9b8ed4a289 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -119,7 +119,7 @@ public: the size of the alpha buffer; the size of the depth and stencil buffers; and number of samples per pixel for multisampling. In addition, the format contains surface configuration parameters such as OpenGL profile and - version for rendering, whether or not enable stereo buffers, and swap + version for rendering, whether or not to enable stereo buffers, and swap behaviour. */ @@ -361,7 +361,7 @@ int QSurfaceFormat::depthBufferSize() const Set the swap \a behavior of the surface. The swap behavior specifies whether single, double, or triple - buffering is desired. The default, SwapBehavior::DefaultSwapBehavior, + buffering is desired. The default, DefaultSwapBehavior, gives the default swap behavior of the platform. */ void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior) diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index c4968f8ca6..398df0a96f 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -441,7 +441,7 @@ public: } } private: - Q_DISABLE_COPY(WindowSystemEventList); + Q_DISABLE_COPY(WindowSystemEventList) }; static WindowSystemEventList windowSystemEventQueue; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 8d6b05d0b4..90416db72b 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -1064,7 +1064,6 @@ QImage QOpenGLFramebufferObject::toImage() const /*! \fn bool QOpenGLFramebufferObject::bindDefault() - \internal Switches rendering back to the default, windowing system provided framebuffer. diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 83f407575e..7d49c03f5b 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -147,6 +147,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) return; } + GLint oldFbo; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo); + int oldWidth = m_textureResource->m_width; int oldHeight = m_textureResource->m_height; @@ -265,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) glDeleteTextures(1, &tmp_texture); glDeleteTextures(1, &oldTexture); - funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); + funcs.glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo); if (pex != 0) { glViewport(0, 0, pex->width, pex->height); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 2ebba967ed..de0ab53c1b 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1121,13 +1121,13 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c fx &= fixed_scale - 1; Q_ASSERT((fx >> 16) == 0); while (b < end) { - register int x1 = (fx >> 16); - register int x2 = x1 + 1; + int x1 = (fx >> 16); + int x2 = x1 + 1; Q_ASSERT(x1 >= 0); Q_ASSERT(x2 < count); - register int distx = (fx & 0x0000ffff) >> 8; - register int idistx = 256 - distx; + int distx = (fx & 0x0000ffff) >> 8; + int idistx = 256 - distx; int rb = ((intermediate_buffer[0][x1] * idistx + intermediate_buffer[0][x2] * distx) >> 8) & 0xff00ff; int ag = (intermediate_buffer[1][x1] * idistx + intermediate_buffer[1][x2] * distx) & 0xff00ff00; *b = rb | ag; @@ -1533,13 +1533,13 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper fx &= fixed_scale - 1; Q_ASSERT((fx >> 16) == 0); for (int i = 0; i < length; ++i) { - register int x1 = (fx >> 16); - register int x2 = x1 + 1; + int x1 = (fx >> 16); + int x2 = x1 + 1; Q_ASSERT(x1 >= 0); Q_ASSERT(x2 < count); - register int distx = (fx & 0x0000ffff) >> 8; - register int idistx = 256 - distx; + int distx = (fx & 0x0000ffff) >> 8; + int idistx = 256 - distx; int rb = ((buf1[x1] * idistx + buf1[x2] * distx) >> 8) & 0xff00ff; int ag = (buf2[x1] * idistx + buf2[x2] * distx) & 0xff00ff00; buffer[i] = rb | ag; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 5d9867012f..0b8a41c904 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -759,7 +759,7 @@ do { \ /* Duff's device */ \ uint *_d = (uint*)(dest) + length; \ const uint *_s = (uint*)(src) + length; \ - register int n = ((length) + 7) / 8; \ + int n = ((length) + 7) / 8; \ switch ((length) & 0x07) \ { \ case 0: do { *--_d = *--_s; \ @@ -779,7 +779,7 @@ do { \ /* Duff's device */ \ ushort *_d = (ushort*)(dest); \ const ushort *_s = (ushort*)(src); \ - register int n = ((length) + 7) / 8; \ + int n = ((length) + 7) / 8; \ switch ((length) & 0x07) \ { \ case 0: do { *_d++ = *_s++; \ diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 5d9a743dac..345ebefea7 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -38,9 +38,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#include "qpdf_p.h" + +#ifndef QT_NO_PDF + #include "qplatformdefs.h" #include <qdebug.h> -#include "qpdf_p.h" #include <qfile.h> #include <qtemporaryfile.h> #include <private/qmath_p.h> @@ -2624,5 +2628,6 @@ void QPdfEnginePrivate::newPage() << "q q\n"; } - QT_END_NAMESPACE + +#endif // QT_NO_PDF diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 44e1446fff..560621775b 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -52,6 +52,11 @@ // // We mean it. // + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_PDF + #include "QtGui/qmatrix.h" #include "QtCore/qstring.h" #include "QtCore/qvector.h" @@ -328,5 +333,7 @@ void QPdfEngine::setResolution(int resolution) QT_END_NAMESPACE +#endif // QT_NO_PDF + #endif // QPDF_P_H diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index ad6b66ae09..136654cb5d 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include <qpdfwriter.h> + +#ifndef QT_NO_PDF + #include <QtCore/private/qobject_p.h> #include "private/qpdf_p.h" #include <QtCore/qfile.h> @@ -214,3 +217,5 @@ void QPdfWriter::setMargins(const Margins &m) } QT_END_NAMESPACE + +#endif // QT_NO_PDF diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h index 45bb5ad4b4..f5c25de5e9 100644 --- a/src/gui/painting/qpdfwriter.h +++ b/src/gui/painting/qpdfwriter.h @@ -42,12 +42,15 @@ #ifndef QPDFWRITER_H #define QPDFWRITER_H +#include <QtCore/qglobal.h> + +#ifndef QT_NO_PDF + #include <QtCore/qobject.h> #include <QtGui/qpagedpaintdevice.h> QT_BEGIN_NAMESPACE - class QIODevice; class QPdfWriterPrivate; @@ -83,4 +86,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_PDF + #endif diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 5398387bcf..34215b53b0 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -218,8 +218,8 @@ void QPolygon::translate(int dx, int dy) if (dx == 0 && dy == 0) return; - register QPoint *p = data(); - register int i = size(); + QPoint *p = data(); + int i = size(); QPoint pt(dx, dy); while (i--) { *p += pt; @@ -447,7 +447,7 @@ QRect QPolygon::boundingRect() const { if (isEmpty()) return QRect(0, 0, 0, 0); - register const QPoint *pd = constData(); + const QPoint *pd = constData(); int minx, maxx, miny, maxy; minx = maxx = pd->x(); miny = maxy = pd->y(); @@ -599,8 +599,8 @@ void QPolygonF::translate(const QPointF &offset) if (offset.isNull()) return; - register QPointF *p = data(); - register int i = size(); + QPointF *p = data(); + int i = size(); while (i--) { *p += offset; ++p; @@ -660,7 +660,7 @@ QRectF QPolygonF::boundingRect() const { if (isEmpty()) return QRectF(0, 0, 0, 0); - register const QPointF *pd = constData(); + const QPointF *pd = constData(); qreal minx, maxx, miny, maxy; minx = maxx = pd->x(); miny = maxy = pd->y(); diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index ce5abdbbd9..47668c62b6 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1585,14 +1585,14 @@ void QRegionPrivate::selfTest() const static QRegionPrivate qrp; QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp}; -typedef void (*OverlapFunc)(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2); -typedef void (*NonOverlapFunc)(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, - register int y1, register int y2); +typedef void (*OverlapFunc)(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2); +typedef void (*NonOverlapFunc)(QRegionPrivate &dest, const QRect *r, const QRect *rEnd, + int y1, int y2); static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2); static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest); -static void miRegionOp(register QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, +static void miRegionOp(QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, NonOverlapFunc nonOverlap2Func); @@ -1789,7 +1789,7 @@ SOFTWARE. */ /* $XFree86: xc/lib/X11/Region.c,v 1.1.1.2.2.2 1998/10/04 15:22:50 hohndel Exp $ */ -static void UnionRectWithRegion(register const QRect *rect, const QRegionPrivate *source, +static void UnionRectWithRegion(const QRect *rect, const QRegionPrivate *source, QRegionPrivate &dest) { if (rect->isEmpty()) @@ -1824,9 +1824,9 @@ static void UnionRectWithRegion(register const QRect *rect, const QRegionPrivate */ static void miSetExtents(QRegionPrivate &dest) { - register const QRect *pBox, + const QRect *pBox, *pBoxEnd; - register QRect *pExtents; + QRect *pExtents; dest.innerRect.setCoords(0, 0, -1, -1); dest.innerArea = -1; @@ -1871,11 +1871,11 @@ static void miSetExtents(QRegionPrivate &dest) added by raymond */ -static void OffsetRegion(register QRegionPrivate ®ion, register int x, register int y) +static void OffsetRegion(QRegionPrivate ®ion, int x, int y) { if (region.rects.size()) { - register QRect *pbox = region.rects.data(); - register int nbox = region.numRects; + QRect *pbox = region.rects.data(); + int nbox = region.numRects; while (nbox--) { pbox->translate(x, y); @@ -1902,12 +1902,12 @@ static void OffsetRegion(register QRegionPrivate ®ion, register int x, regist * *----------------------------------------------------------------------- */ -static void miIntersectO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, int y1, int y2) +static void miIntersectO(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2) { - register int x1; - register int x2; - register QRect *pNextRect; + int x1; + int x2; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -1967,11 +1967,11 @@ static void miIntersectO(register QRegionPrivate &dest, register const QRect *r1 * *----------------------------------------------------------------------- */ -static int miCoalesce(register QRegionPrivate &dest, int prevStart, int curStart) +static int miCoalesce(QRegionPrivate &dest, int prevStart, int curStart) { - register QRect *pPrevBox; /* Current box in previous band */ - register QRect *pCurBox; /* Current box in current band */ - register QRect *pRegEnd; /* End of region */ + QRect *pPrevBox; /* Current box in previous band */ + QRect *pCurBox; /* Current box in current band */ + QRect *pRegEnd; /* End of region */ int curNumRects; /* Number of rectangles in current band */ int prevNumRects; /* Number of rectangles in previous band */ int bandY1; /* Y1 coordinate for current band */ @@ -2096,21 +2096,21 @@ static int miCoalesce(register QRegionPrivate &dest, int prevStart, int curStart * *----------------------------------------------------------------------- */ -static void miRegionOp(register QRegionPrivate &dest, +static void miRegionOp(QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, NonOverlapFunc nonOverlap2Func) { - register const QRect *r1; // Pointer into first region - register const QRect *r2; // Pointer into 2d region + const QRect *r1; // Pointer into first region + const QRect *r2; // Pointer into 2d region const QRect *r1End; // End of 1st region const QRect *r2End; // End of 2d region - register int ybot; // Bottom of intersection - register int ytop; // Top of intersection + int ybot; // Bottom of intersection + int ytop; // Top of intersection int prevBand; // Index of start of previous band in dest int curBand; // Index of start of current band in dest - register const QRect *r1BandEnd; // End of current band in r1 - register const QRect *r2BandEnd; // End of current band in r2 + const QRect *r1BandEnd; // End of current band in r1 + const QRect *r2BandEnd; // End of current band in r2 int top; // Top of non-overlapping band int bot; // Bottom of non-overlapping band @@ -2312,10 +2312,10 @@ static void miRegionOp(register QRegionPrivate &dest, *----------------------------------------------------------------------- */ -static void miUnionNonO(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, - register int y1, register int y2) +static void miUnionNonO(QRegionPrivate &dest, const QRect *r, const QRect *rEnd, + int y1, int y2) { - register QRect *pNextRect; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -2348,10 +2348,10 @@ static void miUnionNonO(register QRegionPrivate &dest, register const QRect *r, *----------------------------------------------------------------------- */ -static void miUnionO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2) +static void miUnionO(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2) { - register QRect *pNextRect; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -2437,10 +2437,10 @@ static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, *----------------------------------------------------------------------- */ -static void miSubtractNonO1(register QRegionPrivate &dest, register const QRect *r, - const QRect *rEnd, register int y1, register int y2) +static void miSubtractNonO1(QRegionPrivate &dest, const QRect *r, + const QRect *rEnd, int y1, int y2) { - register QRect *pNextRect; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -2471,11 +2471,11 @@ static void miSubtractNonO1(register QRegionPrivate &dest, register const QRect *----------------------------------------------------------------------- */ -static void miSubtractO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2) +static void miSubtractO(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2) { - register QRect *pNextRect; - register int x1; + QRect *pNextRect; + int x1; x1 = r1->left(); @@ -2573,7 +2573,7 @@ static void miSubtractO(register QRegionPrivate &dest, register const QRect *r1, */ static void SubtractRegion(QRegionPrivate *regM, QRegionPrivate *regS, - register QRegionPrivate &dest) + QRegionPrivate &dest) { Q_ASSERT(!isEmptyHelper(regM)); Q_ASSERT(!isEmptyHelper(regS)); @@ -2668,12 +2668,12 @@ static bool PointInRegion(QRegionPrivate *pRegion, int x, int y) return false; } -static bool RectInRegion(register QRegionPrivate *region, int rx, int ry, uint rwidth, uint rheight) +static bool RectInRegion(QRegionPrivate *region, int rx, int ry, uint rwidth, uint rheight) { - register const QRect *pbox; - register const QRect *pboxEnd; + const QRect *pbox; + const QRect *pboxEnd; QRect rect(rx, ry, rwidth, rheight); - register QRect *prect = ▭ + QRect *prect = ▭ int partIn, partOut; if (!region || region->numRects == 0 || !EXTENTCHECK(®ion->extents, prect)) @@ -3094,8 +3094,8 @@ SOFTWARE. static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, ScanLineListBlock **SLLBlock, int *iSLLBlock) { - register EdgeTableEntry *start, *prev; - register ScanLineList *pSLL, *pPrevSLL; + EdgeTableEntry *start, *prev; + ScanLineList *pSLL, *pPrevSLL; ScanLineListBlock *tmpSLLBlock; /* @@ -3172,11 +3172,11 @@ static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, * */ -static void CreateETandAET(register int count, register const QPoint *pts, - EdgeTable *ET, EdgeTableEntry *AET, register EdgeTableEntry *pETEs, +static void CreateETandAET(int count, const QPoint *pts, + EdgeTable *ET, EdgeTableEntry *AET, EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock) { - register const QPoint *top, + const QPoint *top, *bottom, *PrevPt, *CurrPt; @@ -3259,10 +3259,10 @@ static void CreateETandAET(register int count, register const QPoint *pts, * */ -static void loadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs) +static void loadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs) { - register EdgeTableEntry *pPrevAET; - register EdgeTableEntry *tmp; + EdgeTableEntry *pPrevAET; + EdgeTableEntry *tmp; pPrevAET = AET; AET = AET->next; @@ -3303,11 +3303,11 @@ static void loadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs) * V-------------------> V---> ... * */ -static void computeWAET(register EdgeTableEntry *AET) +static void computeWAET(EdgeTableEntry *AET) { - register EdgeTableEntry *pWETE; - register int inside = 1; - register int isInside = 0; + EdgeTableEntry *pWETE; + int inside = 1; + int isInside = 0; AET->nextWETE = 0; pWETE = AET; @@ -3337,12 +3337,12 @@ static void computeWAET(register EdgeTableEntry *AET) * */ -static int InsertionSort(register EdgeTableEntry *AET) +static int InsertionSort(EdgeTableEntry *AET) { - register EdgeTableEntry *pETEchase; - register EdgeTableEntry *pETEinsert; - register EdgeTableEntry *pETEchaseBackTMP; - register int changed = 0; + EdgeTableEntry *pETEchase; + EdgeTableEntry *pETEinsert; + EdgeTableEntry *pETEchaseBackTMP; + int changed = 0; AET = AET->next; while (AET) { @@ -3370,9 +3370,9 @@ static int InsertionSort(register EdgeTableEntry *AET) /* * Clean up our act. */ -static void FreeStorage(register ScanLineListBlock *pSLLBlock) +static void FreeStorage(ScanLineListBlock *pSLLBlock) { - register ScanLineListBlock *tmpSLLBlock; + ScanLineListBlock *tmpSLLBlock; while (pSLLBlock) { tmpSLLBlock = pSLLBlock->next; @@ -3436,7 +3436,7 @@ static inline void flushRow(const QRegionSpan *spans, int y, int numSpans, QRegi * stack by the calling procedure. * */ -static void PtsToRegion(register int numFullPtBlocks, register int iCurPtBlock, +static void PtsToRegion(int numFullPtBlocks, int iCurPtBlock, POINTBLOCK *FirstPtBlock, QRegionPrivate *reg) { int lastRow = 0; @@ -3512,12 +3512,12 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) //int rule; /* winding rule */ { QRegionPrivate *region; - register EdgeTableEntry *pAET; /* Active Edge Table */ - register int y; /* current scanline */ - register int iPts = 0; /* number of pts in buffer */ - register EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ - register ScanLineList *pSLL; /* current scanLineList */ - register QPoint *pts; /* output buffer */ + EdgeTableEntry *pAET; /* Active Edge Table */ + int y; /* current scanline */ + int iPts = 0; /* number of pts in buffer */ + EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ + ScanLineList *pSLL; /* current scanLineList */ + QPoint *pts; /* output buffer */ EdgeTableEntry *pPrevAET; /* ptr to previous AET */ EdgeTable ET; /* header node for ET */ EdgeTableEntry AET; /* header node for AET */ diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index 649c6ec36d..3c39272d11 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -91,6 +91,8 @@ static const unsigned short symbol_map[0x100] = { // ---------------------------- PS/PDF helper methods ----------------------------------- +#ifndef QT_NO_PDF + QByteArray QFontSubset::glyphName(unsigned short unicode, bool symbol) { if (symbol && unicode < 0x100) @@ -311,6 +313,7 @@ int QFontSubset::addGlyph(int index) return idx; } +#endif // QT_NO_PDF // ------------------------------ Truetype generation ---------------------------------------------- diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h index 00054dfe39..df5e72ab7d 100644 --- a/src/gui/text/qfontsubset_p.h +++ b/src/gui/text/qfontsubset_p.h @@ -62,13 +62,19 @@ class QFontSubset public: explicit QFontSubset(QFontEngine *fe, int obj_id = 0) : object_id(obj_id), noEmbed(false), fontEngine(fe), downloaded_glyphs(0), standard_font(false) - { fontEngine->ref.ref(); addGlyph(0); } + { + fontEngine->ref.ref(); +#ifndef QT_NO_PDF + addGlyph(0); +#endif + } ~QFontSubset() { if (!fontEngine->ref.deref()) delete fontEngine; } QByteArray toTruetype() const; +#ifndef QT_NO_PDF QByteArray widthArray() const; QByteArray createToUnicodeMap() const; QVector<int> getReverseMap() const; @@ -77,6 +83,7 @@ public: static QByteArray glyphName(unsigned short unicode, bool symbol); int addGlyph(int index); +#endif const int object_id; bool noEmbed; QFontEngine *fontEngine; diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h index 2c099ac922..6bf8a059a4 100644 --- a/src/network/access/qnetworkcookie_p.h +++ b/src/network/access/qnetworkcookie_p.h @@ -73,7 +73,7 @@ public: bool httpOnly; }; -static inline bool isLWS(register char c) +static inline bool isLWS(char c) { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; } diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index c04421e5c7..c7d3846465 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE class QNetworkProxy; -static inline bool isSeparator(register char c) +static inline bool isSeparator(char c) { static const char separators[] = "()<>@,;:\\\"/[]?={}"; return isLWS(c) || strchr(separators, c) != 0; @@ -123,7 +123,7 @@ static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &hea // quoted-pair = "\" CHAR ++pos; while (pos < header.length()) { - register char c = header.at(pos); + char c = header.at(pos); if (c == '"') { // end of quoted text break; @@ -141,7 +141,7 @@ static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &hea } else { // case: token while (pos < header.length()) { - register char c = header.at(pos); + char c = header.at(pos); if (isSeparator(c)) break; value += c; diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 4f74936ac7..933bebe2ad 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -62,6 +62,7 @@ static void connManager_cleanup() // this is not atomic or thread-safe! int shutdown = appShutdown.fetchAndStoreAcquire(1); Q_ASSERT(shutdown == 0); + Q_UNUSED(shutdown); QNetworkConfigurationManagerPrivate *cmp = connManager_ptr.fetchAndStoreAcquire(0); if (cmp) cmp->cleanup(); diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 5e6a1cac54..80e23075d3 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -84,7 +84,7 @@ static inline int qt_safe_socket(int domain, int type, int protocol, int flags = { Q_ASSERT((flags & ~O_NONBLOCK) == 0); - register int fd; + int fd; #if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK) int newtype = type | SOCK_CLOEXEC; if (flags & O_NONBLOCK) @@ -112,7 +112,7 @@ static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *add { Q_ASSERT((flags & ~O_NONBLOCK) == 0); - register int fd; + int fd; #if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK) // use accept4 int sockflags = SOCK_CLOEXEC; @@ -144,7 +144,7 @@ static inline int qt_safe_listen(int s, int backlog) static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SOCKLEN_T addrlen) { - register int ret; + int ret; // Solaris e.g. expects a non-const 2nd parameter EINTR_LOOP(ret, QT_SOCKET_CONNECT(sockfd, const_cast<struct sockaddr *>(addr), addrlen)); return ret; @@ -192,7 +192,7 @@ static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int fl qt_ignore_sigpipe(); #endif - register int ret; + int ret; #ifdef Q_OS_VXWORKS EINTR_LOOP(ret, ::sendto(sockfd, (char *) buf, len, flags, (struct sockaddr *) to, tolen)); #else diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index fbd836f763..1e15a9e62c 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -41,7 +41,7 @@ #include "qglobal.h" -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX #import <Cocoa/Cocoa.h> #import <IOKit/graphics/IOGraphicsLib.h> #endif @@ -107,7 +107,7 @@ static NSInteger languageMapSort(id obj1, id obj2, void *context) QCoreTextFontDatabase::QCoreTextFontDatabase() { -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QSettings appleSettings(QLatin1String("apple.com")); QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold")); if (appleValue.isValid()) @@ -408,7 +408,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo static bool didPopulateStyleFallbacks = false; if (!didPopulateStyleFallbacks) { -#if !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) // Ensure we have the psNameToFamily mapping set up const_cast<QCoreTextFontDatabase*>(this)->populateFontDatabase(); @@ -457,7 +457,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo return fallbackLists[styleLookupKey.arg(styleHint)]; } -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 5b9b8e2329..8536ad9123 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -55,7 +55,7 @@ public: QFontEngine *fontEngine(const QFontDef &fontDef, QChar::Script script, void *handle); QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); #endif void releaseHandle(void *handle); diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 2c93da147e..5e493ac68c 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -125,6 +125,7 @@ public: bool m_forceToActiveWindow; QTouchDevice *m_device; bool m_typeB; + QTransform m_rotate; }; QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args) @@ -177,10 +178,24 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QStringList args = spec.split(QLatin1Char(':')); + int rotationAngle = 0; for (int i = 0; i < args.count(); ++i) { - if (args.at(i).startsWith(QLatin1String("/dev/"))) { + if (args.at(i).startsWith(QLatin1String("/dev/")) && dev.isEmpty()) { dev = args.at(i); - break; + } else if (args.at(i).startsWith(QLatin1String("rotate"))) { + QString rotateArg = args.at(i).section(QLatin1Char('='), 1, 1); + bool ok; + uint argValue = rotateArg.toUInt(&ok); + if (ok) { + switch (argValue) { + case 90: + case 180: + case 270: + rotationAngle = argValue; + default: + break; + } + } } } @@ -265,6 +280,9 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, #endif qDebug("Protocol type %c %s", d->m_typeB ? 'B' : 'A', mtdevStr); + if (rotationAngle) + d->m_rotate = QTransform::fromTranslate(0.5, 0.5).rotate(rotationAngle).translate(-0.5, -0.5); + d->registerDevice(); } @@ -421,6 +439,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) tp.normalPosition = QPointF((contact.x - hw_range_x_min) / qreal(hw_range_x_max - hw_range_x_min), (contact.y - hw_range_y_min) / qreal(hw_range_y_max - hw_range_y_min)); + if (!m_rotate.isIdentity()) + tp.normalPosition = m_rotate.map(tp.normalPosition); + + tp.rawPositions.append(QPointF(contact.x, contact.y)); + m_touchPoints.append(tp); if (contact.state == Qt::TouchPointReleased) @@ -513,9 +536,10 @@ void QEvdevTouchScreenData::reportPoints() QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]); // Generate a screen position that is always inside the active window - // or the primary screen. - const qreal wx = winRect.left() + tp.normalPosition.x() * winRect.width(); - const qreal wy = winRect.top() + tp.normalPosition.y() * winRect.height(); + // or the primary screen. Even though we report this as a QRectF, internally + // Qt uses QRect/QPoint so we need to bound the size to winRect.size() - QSize(1, 1) + const qreal wx = winRect.left() + tp.normalPosition.x() * (winRect.width() - 1); + const qreal wy = winRect.top() + tp.normalPosition.y() * (winRect.height() - 1); const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h); if (tp.area.width() == -1) // touch major was not provided tp.area = QRectF(0, 0, 8, 8); diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index cabddcc815..fdd45a49c5 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -164,6 +164,7 @@ public: , kdeVersion(kdeVersion) , toolButtonStyle(Qt::ToolButtonTextBesideIcon) , toolBarIconSize(0) + , singleClick(true) { } QString globalSettingsFile() const @@ -186,6 +187,7 @@ public: QStringList styleNames; int toolButtonStyle; int toolBarIconSize; + bool singleClick; }; void QKdeThemePrivate::refresh() @@ -217,6 +219,8 @@ void QKdeThemePrivate::refresh() styleNames.push_front(style); } + singleClick = kdeSettings.value(QStringLiteral("KDE/SingleClick"), true).toBool(); + const QVariant themeValue = kdeSettings.value(QStringLiteral("Icons/Theme")); if (themeValue.isValid()) iconThemeName = themeValue.toString(); @@ -261,6 +265,14 @@ static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal) { + if (!kdeSettings.contains(QStringLiteral("Colors:Button/BackgroundNormal"))) { + // kcolorscheme.cpp: SetDefaultColors + const QColor defaultWindowBackground(214, 210, 208); + const QColor defaultButtonBackground(223, 220, 217); + *pal = QPalette(defaultButtonBackground, defaultWindowBackground); + return; + } + kdeColor(pal, QPalette::Button, kdeSettings, QStringLiteral("Colors:Button/BackgroundNormal")); kdeColor(pal, QPalette::Window, kdeSettings, QStringLiteral("Colors:Window/BackgroundNormal")); kdeColor(pal, QPalette::Text, kdeSettings, QStringLiteral("Colors:View/ForegroundNormal")); @@ -272,6 +284,34 @@ void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalet kdeColor(pal, QPalette::ButtonText, kdeSettings, QStringLiteral("Colors:Button/ForegroundNormal")); kdeColor(pal, QPalette::Link, kdeSettings, QStringLiteral("Colors:View/ForegroundLink")); kdeColor(pal, QPalette::LinkVisited, kdeSettings, QStringLiteral("Colors:View/ForegroundVisited")); + kdeColor(pal, QPalette::ToolTipBase, kdeSettings, QStringLiteral("Colors:Tooltip/BackgroundNormal")); + kdeColor(pal, QPalette::ToolTipText, kdeSettings, QStringLiteral("Colors:Tooltip/ForegroundNormal")); + + // The above code sets _all_ color roles to "normal" colors. In KDE, the disabled + // color roles are calculated by applying various effects described in kdeglobals. + // We use a bit simpler approach here, similar logic than in qt_palette_from_color(). + const QColor button = pal->color(QPalette::Button); + int h, s, v; + button.getHsv(&h, &s, &v); + + const QBrush whiteBrush = QBrush(Qt::white); + const QBrush buttonBrush = QBrush(button); + const QBrush buttonBrushDark = QBrush(button.darker(v > 128 ? 200 : 50)); + const QBrush buttonBrushDark150 = QBrush(button.darker(v > 128 ? 150 : 75)); + const QBrush buttonBrushLight150 = QBrush(button.lighter(v > 128 ? 150 : 75)); + + pal->setBrush(QPalette::Disabled, QPalette::WindowText, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::ButtonText, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::Button, buttonBrush); + pal->setBrush(QPalette::Disabled, QPalette::Light, buttonBrushLight150); + pal->setBrush(QPalette::Disabled, QPalette::Dark, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::Mid, buttonBrushDark150); + pal->setBrush(QPalette::Disabled, QPalette::Text, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::BrightText, whiteBrush); + pal->setBrush(QPalette::Disabled, QPalette::Base, buttonBrush); + pal->setBrush(QPalette::Disabled, QPalette::Window, buttonBrush); + pal->setBrush(QPalette::Disabled, QPalette::Highlight, buttonBrushDark150); + pal->setBrush(QPalette::Disabled, QPalette::HighlightedText, buttonBrushLight150); } /*! @@ -360,6 +400,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const return QVariant(d->styleNames); case QPlatformTheme::KeyboardScheme: return QVariant(int(KdeKeyboardScheme)); + case QPlatformTheme::ItemViewActivateItemOnSingleClick: + return QVariant(d->singleClick); default: break; } diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 59dc03666b..cbb3092b1d 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -430,8 +430,9 @@ QAccessible::State QAccessibleMdiSubWindow::state() const state.focused = true; if (!mdiSubWindow()->isVisible()) state.invisible = true; - if (!mdiSubWindow()->parentWidget()->contentsRect().contains(mdiSubWindow()->geometry())) - state.offscreen = true; + if (const QWidget *parent = mdiSubWindow()->parentWidget()) + if (!parent->contentsRect().contains(mdiSubWindow()->geometry())) + state.offscreen = true; if (!mdiSubWindow()->isEnabled()) state.disabled = true; return state; diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 4efecc5464..380cf92a24 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -74,7 +74,6 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &map) return argument; } -static QDBusConnection dbusConnection = QDBusConnection::systemBus(); QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), @@ -98,7 +97,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), this,SIGNAL(propertyChanged(QString,QDBusVariant)))) { - qWarning() << "PropertyCHanged not connected"; + qWarning() << "PropertyChanged not connected"; } } @@ -118,7 +117,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -379,7 +378,7 @@ void QConnmanProfileInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanProfileInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_PROFILE_INTERFACE), QLatin1String("PropertyChanged"), @@ -449,7 +448,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -460,7 +459,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -514,9 +513,6 @@ void QConnmanServiceInterface::remove() QDBusReply<QVariantMap> reply = this->call(QLatin1String("Remove")); } -// void moveBefore(QDBusObjectPath &service); -// void moveAfter(QDBusObjectPath &service); - // properties QString QConnmanServiceInterface::getState() { @@ -779,7 +775,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -790,7 +786,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -861,23 +857,11 @@ QConnmanAgentInterface::~QConnmanAgentInterface() void QConnmanAgentInterface::connectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { -// dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), -// this->path(), -// QLatin1String(CONNMAN_NETWORK_INTERFACE), -// QLatin1String("PropertyChanged"), -// this,SIGNAL(propertyChanged(QString,QVariant&))); -// } } void QConnmanAgentInterface::disconnectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { - -// } } @@ -889,10 +873,6 @@ void QConnmanAgentInterface::reportError(QDBusObjectPath &/*path*/, const QStrin { } -//dict QConnmanAgentInterface::requestInput(QDBusObjectPath &path, dict fields) -//{ -//} - void QConnmanAgentInterface::cancel() { } diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index a45c3875bc..b1a674365d 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -448,7 +448,7 @@ void ICOReader::read4BitBMP(QImage & image) image = QImage(); break; } - register uchar *p = image.scanLine(h); + uchar *p = image.scanLine(h); uchar *b = buf; for (int i=0; i<icoAttrib.w/2; i++) { // convert nibbles to bytes *p++ = *b >> 4; @@ -487,7 +487,7 @@ void ICOReader::read16_24_32BMP(QImage & image) { if (iod) { int h = icoAttrib.h; - register QRgb *p; + QRgb *p; QRgb *end; uchar *buf = new uchar[image.bytesPerLine()]; int bpl = ((icoAttrib.w*icoAttrib.nbits+31)/32)*4; diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.h b/src/plugins/platforms/cocoa/qcocoaaccessibility.h index 3f0367d36a..86bb5323a7 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.h +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.h @@ -46,11 +46,11 @@ #include <QtGui> #include <qpa/qplatformaccessibility.h> -class QCococaAccessibility : public QPlatformAccessibility +class QCocoaAccessibility : public QPlatformAccessibility { public: - QCococaAccessibility(); - ~QCococaAccessibility(); + QCocoaAccessibility(); + ~QCocoaAccessibility(); void notifyAccessibilityUpdate(QAccessibleEvent *event); void setRootObject(QObject *o); void initialize(); @@ -79,6 +79,7 @@ namespace QCocoaAccessible { NSString *macRole(QAccessibleInterface *interface); bool shouldBeIgnored(QAccessibleInterface *interface); +NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface); NSString *getTranslatedAction(const QString &qtAction); NSMutableArray *createTranslatedActionsList(const QStringList &qtActions); QString translateAction(NSString *nsAction); diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 9c38a874e5..5649f3ad73 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -44,17 +44,17 @@ #include <QtGui/private/qaccessible2_p.h> #include <private/qcore_mac_p.h> -QCococaAccessibility::QCococaAccessibility() +QCocoaAccessibility::QCocoaAccessibility() { } -QCococaAccessibility::~QCococaAccessibility() +QCocoaAccessibility::~QCocoaAccessibility() { } -void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) +void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) { QObject *object = event->object(); if (!object) @@ -78,17 +78,17 @@ void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) } } -void QCococaAccessibility::setRootObject(QObject *o) +void QCocoaAccessibility::setRootObject(QObject *o) { Q_UNUSED(o) } -void QCococaAccessibility::initialize() +void QCocoaAccessibility::initialize() { } -void QCococaAccessibility::cleanup() +void QCocoaAccessibility::cleanup() { } @@ -223,6 +223,26 @@ bool shouldBeIgnored(QAccessibleInterface *interface) return false; } +NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface) +{ + int numKids = interface->childCount(); + // qDebug() << "Children for: " << axid << iface << " are: " << numKids; + + NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; + for (int i = 0; i < numKids; ++i) { + QAccessibleInterface *child = interface->child(i); + Q_ASSERT(child); + if (child->state().invalid || child->state().invisible) + continue; + + QAccessible::Id childId = QAccessible::uniqueId(child); + //qDebug() << " kid: " << childId << child; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:parentObject]; + [kids addObject: element]; + [element release]; + } + return NSAccessibilityUnignoredChildren(kids); +} /* Translates a predefined QAccessibleActionInterface action to a Mac action constant. Returns 0 if the Qt Action has no mac equivalent. Ownership of the NSString is diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index f7c945c50d..7eae22f720 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -137,23 +137,7 @@ } else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) { return NSAccessibilityRoleDescription(role, nil); } else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { - - int numKids = iface->childCount(); - // qDebug() << "Children for: " << axid << iface << " are: " << numKids; - - NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; - for (int i = 0; i < numKids; ++i) { - QAccessibleInterface *child = iface->child(i); - Q_ASSERT(child); - QAccessible::Id childId = QAccessible::uniqueId(child); - //qDebug() << " kid: " << childId << child; - QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:self]; - [kids addObject: element]; - [element release]; - } - // ### maybe we should use NSAccessibilityUnignoredChildren(kids); this needs more profiling - return kids; - + return QCocoaAccessible::unignoredChildren(self, iface); } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { // Just check if the app thinks we're focused. id focusedElement = [NSApp accessibilityAttributeValue:NSAccessibilityFocusedUIElementAttribute]; @@ -272,8 +256,7 @@ // No child found, meaning we hit this element. if (!childInterface) { // qDebug() << "Hit test returns: " << id << iface; - return self; - //return NSAccessibilityUnignoredAncestor(self); + return NSAccessibilityUnignoredAncestor(self); } QAccessible::Id childId = QAccessible::uniqueId(childInterface); diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 7dad4271b5..a37552d844 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -123,7 +123,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) if (pm.isNull()) pm = defaultPixmap(); - NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pm)); + NSImage *nsimage = qt_mac_create_nsimage(pm); QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND); m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); @@ -145,6 +145,8 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) source:m_lastView slideBack:YES]; + [nsimage release]; + m_drag = 0; return m_executed_drop_action; } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 071edb5b60..76cd235514 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -168,7 +168,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions; mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]); QFileInfo sel(selectFile); - if (sel.isDir()){ + if (sel.isDir() && !sel.isBundle()){ mCurrentDir = [QCFString::toNSString(sel.absoluteFilePath()) retain]; mCurrentSelection = new QString; } else { @@ -244,15 +244,15 @@ static QString strippedText(QString s) - (void)showModelessPanel { if (mOpenPanel){ - QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); + QFileInfo info(*mCurrentSelection); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; [self updateProperties]; [mOpenPanel setAllowedFileTypes:nil]; - [mOpenPanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] - : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""]; + [mOpenPanel beginWithCompletionHandler:^(NSInteger result){ mReturnCode = result; if (mHelper) @@ -263,13 +263,12 @@ static QString strippedText(QString s) - (BOOL)runApplicationModalPanel { - QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); + QFileInfo info(*mCurrentSelection); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; - [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] - : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]]; [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""]; // Call processEvents in case the event dispatcher has been interrupted, and needs to do @@ -289,14 +288,14 @@ static QString strippedText(QString s) - (void)showWindowModalSheet:(QWindow *)parent { - QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); + QFileInfo info(*mCurrentSelection); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; [self updateProperties]; - [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] - : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""]; NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent)); diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 45038ee578..fad743439e 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -219,7 +219,7 @@ QCocoaIntegration::QCocoaIntegration() , mEventDispatcher(new QCocoaEventDispatcher()) , mInputContext(new QCocoaInputContext) #ifndef QT_NO_ACCESSIBILITY - , mAccessibility(new QCococaAccessibility) + , mAccessibility(new QCocoaAccessibility) #endif , mCocoaClipboard(new QCocoaClipboard) , mCocoaDrag(new QCocoaDrag) diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 73331db40d..8d1ca88b8e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -203,6 +203,11 @@ void QCocoaMenuBar::updateMenuBarImmediately() QCocoaAutoReleasePool pool; QCocoaMenuBar *mb = findGlobalMenubar(); QCocoaWindow *cw = findWindowForMenubar(); + + QWindow *win = cw ? cw->window() : 0; + if (win && (win->flags() & Qt::Popup) == Qt::Popup) + return; // context menus, comboboxes, etc. don't need to update the menubar + if (cw && cw->menubar()) mb = cw->menubar(); diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 36d7a49746..9c10bc26dd 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -281,7 +281,7 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const sizes << 16 << 32 << 64 << 128; return QVariant::fromValue(sizes); } - case QPlatformTheme::PasswordMaskDelay: + case QPlatformTheme::PasswordMaskCharacter: return QVariant(QChar(kBulletUnicode)); default: break; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 19c4faf369..057eb7e144 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -235,6 +235,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) setGeometry(tlw->geometry()); recreateWindow(parent()); tlw->setGeometry(geometry()); + if (tlw->isTopLevel()) + setWindowIcon(tlw->icon()); m_inConstructor = false; } diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 92215b9e67..3ee994427b 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -115,6 +115,7 @@ QT_END_NAMESPACE - (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType; - (void)keyDown:(NSEvent *)theEvent; - (void)keyUp:(NSEvent *)theEvent; +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; - (void)registerDragTypes; - (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 94b414a882..66a1b95ad8 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -113,6 +113,8 @@ static QTouchDevice *touchDevice = 0; name:NSViewGlobalFrameDidChangeNotification object:self]; } + delete currentCustomDragTypes; + [super dealloc]; } @@ -984,6 +986,23 @@ static QTouchDevice *touchDevice = 0; [self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)]; } +- (BOOL)performKeyEquivalent:(NSEvent *)nsevent +{ + NSString *chars = [nsevent charactersIgnoringModifiers]; + + if ([nsevent type] == NSKeyDown && [chars length] > 0) { + QChar ch = [chars characterAtIndex:0]; + Qt::Key qtKey = qt_mac_cocoaKey2QtKey(ch); + // check for Command + Key_Period + if ([nsevent modifierFlags] & NSCommandKeyMask + && qtKey == Qt::Key_Period) { + [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; + return YES; + } + } + return [super performKeyEquivalent:nsevent]; +} + - (void)flagsChanged:(NSEvent *)nsevent { ulong timestamp = [nsevent timestamp] * 1000; @@ -1276,7 +1295,7 @@ static QTouchDevice *touchDevice = 0; NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, - NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType, + NSRTFDPboardType, NSHTMLPboardType, NSURLPboardType, NSPDFPboardType, NSVCardPboardType, NSFilesPromisePboardType, NSInkTextPboardType, NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil]; diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 6ebb1f6ba8..86e5066fbb 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -74,21 +74,7 @@ } else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { if (!m_window->accessibleRoot()) return [super accessibilityAttributeValue:attribute]; - - // Create QCocoaAccessibleElements for each child if the - // root accessible interface. - int numKids = m_window->accessibleRoot()->childCount(); - NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; - for (int i = 0; i < numKids; ++i) { - QAccessibleInterface *child = m_window->accessibleRoot()->child(i); - Q_ASSERT(child); - QAccessible::Id childAxid = QAccessible::uniqueId(child); - QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childAxid parent:self]; - [kids addObject: element]; - [element release]; - } - - return kids; + return QCocoaAccessible::unignoredChildren(self, m_window->accessibleRoot()); } else { return [super accessibilityAttributeValue:attribute]; } diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp index 5d58890c51..ff5866d1b7 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrootwindow.cpp @@ -162,6 +162,16 @@ QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) if (result != 0) qFatal("QQnxRootWindow: failed to set window source position, errno=%d", errno); + // Optionally disable the screen power save + bool ok = false; + const int disablePowerSave = qgetenv("QQNX_DISABLE_POWER_SAVE").toInt(&ok); + if (ok && disablePowerSave) { + const int mode = SCREEN_IDLE_MODE_KEEP_AWAKE; + result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_IDLE_MODE, &mode); + if (result != 0) + qWarning("QQnxRootWindow: failed to disable power saving mode"); + } + createWindowGroup(); // Don't post yet. This will be lazily done from QQnxScreen upon first posting of diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 7daab24d3c..87e59dac61 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -77,7 +77,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) #endif m_screen(0), m_parentWindow(0), - m_visible(true), + m_visible(false), m_windowState(Qt::WindowNoState), m_requestedBufferSize(window->geometry().size()) { @@ -153,7 +153,6 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) if (window->parent() && window->parent()->handle()) setParent(window->parent()->handle()); setGeometryHelper(window->geometry()); - setVisible(window->isVisible()); } QQnxWindow::~QQnxWindow() @@ -273,6 +272,9 @@ void QQnxWindow::setVisible(bool visible) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; + if (m_visible == visible) + return; + m_visible = visible; QQnxWindow *root = this; @@ -283,13 +285,13 @@ void QQnxWindow::setVisible(bool visible) window()->requestActivate(); - if (window()->isTopLevel()) { - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); - if (!visible) { - // Flush the context, otherwise it won't disappear immediately - screen_flush_context(m_screenContext, 0); - } + if (visible) { + applyWindowState(); + } else { + // Flush the context, otherwise it won't disappear immediately + screen_flush_context(m_screenContext, 0); } } @@ -626,35 +628,10 @@ void QQnxWindow::setWindowState(Qt::WindowState state) if (m_windowState == state) return; - switch (state) { - - // WindowActive is not an accepted parameter according to the docs - case Qt::WindowActive: - return; - - case Qt::WindowMinimized: - minimize(); - - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - else - setGeometry(m_screen->geometry()); - - break; - - case Qt::WindowMaximized: - case Qt::WindowFullScreen: - m_unmaximizedGeometry = geometry(); - setGeometry(state == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); - break; - - case Qt::WindowNoState: - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - break; - } - m_windowState = state; + + if (m_visible) + applyWindowState(); } void QQnxWindow::gainedFocus() @@ -735,6 +712,37 @@ void QQnxWindow::updateZorder(int &topZorder) childWindow->updateZorder(topZorder); } +void QQnxWindow::applyWindowState() +{ + switch (m_windowState) { + + // WindowActive is not an accepted parameter according to the docs + case Qt::WindowActive: + return; + + case Qt::WindowMinimized: + minimize(); + + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + else + setGeometry(m_screen->geometry()); + + break; + + case Qt::WindowMaximized: + case Qt::WindowFullScreen: + m_unmaximizedGeometry = geometry(); + setGeometry(m_windowState == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); + break; + + case Qt::WindowNoState: + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + break; + } +} + void QQnxWindow::blitHelper(QQnxBuffer &source, QQnxBuffer &target, const QPoint &sourceOffset, const QPoint &targetOffset, const QRegion ®ion, bool flush) { diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 4a327fd54b..63d5dc0979 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -124,6 +124,7 @@ private: void setOffset(const QPoint &setOffset); void updateVisibility(bool parentVisible); void updateZorder(int &topZorder); + void applyWindowState(); void fetchBuffers(); diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h index 3190e39ec5..30fc66563e 100644 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ b/src/plugins/platforms/windows/qplatformfunctions_wince.h @@ -74,6 +74,7 @@ #ifndef CWP_SKIPINVISIBLE #define CWP_SKIPINVISIBLE 0x0001 +#define CWP_SKIPTRANSPARENT 0x0004 #define findPlatformWindowAt(a, b, c) findPlatformWindowAt(a, b) #endif diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index f7ccb00233..12dd00f104 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1720,7 +1720,9 @@ int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM { switch (uMsg) { case BFFM_INITIALIZED: { - const QString initialFile = m_data.selectedFile(); + if (!m_title.isEmpty()) + SetWindowText(hwnd, (wchar_t *)m_title.utf16()); + const QString initialFile = QDir::toNativeSeparators(m_data.directory()); if (!initialFile.isEmpty()) SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initialFile.utf16())); } @@ -1743,8 +1745,7 @@ QStringList QWindowsXpNativeFileDialog::execExistingDir(HWND owner) initPath[0] = 0; bi.hwndOwner = owner; bi.pidlRoot = NULL; - //### This does not seem to be respected? - the dialog always displays "Browse for folder" - bi.lpszTitle = (wchar_t*)m_title.utf16(); + bi.lpszTitle = 0; bi.pszDisplayName = initPath; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; bi.lpfn = xpFileDialogGetExistingDirCallbackProc; diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 924d604641..47c136991a 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -664,7 +664,7 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 bool QWindowsKeyMapper::isADeadKey(unsigned int vk_key, unsigned int modifiers) { if ((vk_key < NumKeyboardLayoutItems) && keyLayout[vk_key].exists) { - for (register size_t i = 0; i < NumMods; ++i) { + for (size_t i = 0; i < NumMods; ++i) { if (uint(ModsTbl[i]) == modifiers) return bool(keyLayout[vk_key].deadkeys & 1<<i); } @@ -793,7 +793,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms // A multi-character key or a Input method character // not found by our look-ahead if (msgType == WM_CHAR || msgType == WM_IME_CHAR) { - sendExtendedPressRelease(receiver, 0, Qt::KeyboardModifier(state), scancode, vk_key, nModifiers, messageKeyText(msg), false, 0); + sendExtendedPressRelease(receiver, 0, Qt::KeyboardModifier(state), scancode, vk_key, nModifiers, messageKeyText(msg), false); return true; } @@ -822,13 +822,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (dirStatus == VK_LSHIFT && ((msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL)) || (msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT)))) { - sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false); result = true; dirStatus = 0; } else if (dirStatus == VK_RSHIFT && ( (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL)) || (msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT)))) { - sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false); result = true; dirStatus = 0; } else { @@ -1020,9 +1020,9 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (rec) { if (code < Qt::Key_Shift || code > Qt::Key_ScrollLock) { QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true); QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true); result = true; } } @@ -1033,7 +1033,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms const char a = uch.row() ? 0 : uch.cell(); key_recorder.storeKey(msg.wParam, a, state, text); QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, text, false, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, text, false); result =true; bool store = true; #ifndef Q_OS_WINCE @@ -1077,7 +1077,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms code = Qt::Key_Backtab; QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, - (rec ? rec->text : QString()), false, 0); + (rec ? rec->text : QString()), false); result = true; #ifndef Q_OS_WINCE // don't pass Alt to Windows unless we are embedded in a non-Qt window diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 629da4fd0d..c1d75c2ad0 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -277,7 +277,7 @@ static bool qt_read_dibv5(QDataStream &s, QImage &image) int bpl = image.bytesPerLine(); uchar *data = image.bits(); - register QRgb *p; + QRgb *p; QRgb *end; uchar *buf24 = new uchar[bpl]; int bpl24 = ((w*nbits+31)/32)*4; diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 5c096b7eca..c6cfa4dbbc 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -232,8 +232,10 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, } const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); + // In this context, neither an invisible nor a transparent window (transparent regarding mouse + // events, "click-through") can be considered as the window under mouse. QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ? - QWindowsScreen::windowAt(globalPosition) : window; + QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window; compressMouseMove(&msg); // Qt expects the platform plugin to capture the mouse on diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9d817c2043..08ff7123eb 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -837,6 +837,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : const qreal opacity = qt_window_private(aWindow)->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + if (aWindow->isTopLevel()) + setWindowIcon(aWindow->icon()); clearFlag(WithinCreate); } diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index db53e7471e..6e5a9ccbb4 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -885,13 +885,19 @@ int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const int QXcbKeyboard::keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const { int code = 0; +#ifndef QT_NO_TEXTCODEC QTextCodec *systemCodec = QTextCodec::codecForLocale(); +#endif // Commentary in X11/keysymdef says that X codes match ASCII, so it // is safe to use the locale functions to process X codes in ISO8859-1. // This is mainly for compatibility - applications should not use the // Qt keycodes between 128 and 255 (extended ACSII codes), but should // rather use the QKeyEvent::text(). - if (keysym < 128 || (keysym < 256 && systemCodec->mibEnum() == 4)) { + if (keysym < 128 || (keysym < 256 +#ifndef QT_NO_TEXTCODEC + && systemCodec->mibEnum() == 4 +#endif + )) { // upper-case key, if known code = isprint((int)keysym) ? toupper((int)keysym) : 0; } else if (keysym >= XK_F1 && keysym <= XK_F35) { diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index bc8c559c6e..b205a63267 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -170,11 +170,13 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, if (!encoding.isEmpty() && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { +#ifndef QT_NO_TEXTCODEC if (requestedType == QVariant::String) { QTextCodec *codec = QTextCodec::codecForName(encoding); if (codec) return codec->toUnicode(data); } +#endif return data; } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e1bc7d36eb..3a19788316 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -239,7 +239,7 @@ void QXcbWindow::create() // XCB_CW_BACK_PIXMAP XCB_NONE, // XCB_CW_OVERRIDE_REDIRECT - type == Qt::Popup || type == Qt::ToolTip, + type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint), // XCB_CW_SAVE_UNDER type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer, // XCB_CW_EVENT_MASK @@ -458,6 +458,8 @@ void QXcbWindow::create() const qreal opacity = qt_window_private(window())->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + if (window()->isTopLevel()) + setWindowIcon(window()->icon()); } QXcbWindow::~QXcbWindow() diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 7ffd3e105f..c106bd00f8 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -214,23 +214,37 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen) QByteArray settings_atom_for_screen("_XSETTINGS_S"); settings_atom_for_screen.append(QByteArray::number(screen->screenNumber())); xcb_intern_atom_cookie_t atom_cookie = xcb_intern_atom(screen->xcb_connection(), - false, + true, settings_atom_for_screen.length(), settings_atom_for_screen.constData()); - xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,NULL); + xcb_generic_error_t *error = 0; + xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,&error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to find XSETTINGS_S atom"; + return; + } xcb_atom_t selection_owner_atom = atom_reply->atom; free(atom_reply); xcb_get_selection_owner_cookie_t selection_cookie = xcb_get_selection_owner(screen->xcb_connection(), selection_owner_atom); + xcb_get_selection_owner_reply_t *selection_result = - xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, NULL); + xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, &error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to get selection owner for XSETTINGS_S atom"; + return; + } d_ptr->x_settings_window = selection_result->owner; + if (!d_ptr->x_settings_window) { + return; + } free(selection_result); + const uint32_t event = XCB_CW_EVENT_MASK; const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE }; - xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,XCB_CW_EVENT_MASK,event_mask); + xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask); d_ptr->populateSettings(d_ptr->getSettings()); } diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp index a05099fa08..6fa901fc45 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog.cpp @@ -104,11 +104,6 @@ QT_BEGIN_NAMESPACE QPageSetupDialogPrivate::QPageSetupDialogPrivate(QPrinter *prntr) : printer(0), ownsPrinter(false) { setPrinter(prntr); - init(); -} - -void QPageSetupDialogPrivate::init() -{ } void QPageSetupDialogPrivate::setPrinter(QPrinter *newPrinter) diff --git a/src/printsupport/dialogs/qpagesetupdialog_p.h b/src/printsupport/dialogs/qpagesetupdialog_p.h index eb672cc752..ba2f0da06a 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_p.h +++ b/src/printsupport/dialogs/qpagesetupdialog_p.h @@ -73,7 +73,6 @@ class QPageSetupDialogPrivate : public QDialogPrivate public: QPageSetupDialogPrivate(QPrinter *printer); - virtual void init(); void setPrinter(QPrinter *newPrinter); QPrinter *printer; diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 1e0251c6d2..1add522cb8 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -574,14 +574,18 @@ void QPageSetupWidget::setRightMargin(double newValue) QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent) : QDialog(*(new QUnixPageSetupDialogPrivate(printer)), parent) { + Q_D(QPageSetupDialog); setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); + static_cast<QUnixPageSetupDialogPrivate *>(d)->init(); } QPageSetupDialog::QPageSetupDialog(QWidget *parent) : QDialog(*(new QUnixPageSetupDialogPrivate(0)), parent) { + Q_D(QPageSetupDialog); setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); + static_cast<QUnixPageSetupDialogPrivate *>(d)->init(); } int QPageSetupDialog::exec() diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 273cb60d7d..a475ccbfb6 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -877,7 +877,9 @@ void Config::load(Location location, const QString& fileName) } QTextStream stream(&fin); +#ifndef QT_NO_TEXTCODEC stream.setCodec("UTF-8"); +#endif QString text = stream.readAll(); text += QLatin1String("\n\n"); text += QLatin1Char('\0'); diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index 41fe2f775c..5c25eeedc4 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -207,10 +207,10 @@ void CppCodeParser::parseSourceFile(const Location& location, const QString& fil readToken(); /* - The set of active namespaces is cleared before parsing + The set of open namespaces is cleared before parsing each source file. The word "source" here means cpp file. */ - activeNamespaces_.clear(); + qdb_->clearOpenNamespaces(); matchDocsAndStuff(); in.close(); @@ -323,21 +323,18 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN)); } else { - if (!activeNamespaces_.isEmpty()) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + parentPath; - func = qdb_->findFunctionNode(newPath, clone); - if (func) - break; - } - } - // Search the root namespace if no match was found. - if (func == 0) + func = qdb_->findNodeInOpenNamespace(parentPath, clone); + /* + Search the root namespace if no match was found. + */ + if (func == 0) { func = qdb_->findFunctionNode(parentPath, clone); + } if (func == 0) { - if (parentPath.isEmpty() && !lastPath_.isEmpty()) + if (parentPath.isEmpty() && !lastPath_.isEmpty()) { func = qdb_->findFunctionNode(lastPath_, clone); + } if (func == 0) { doc.location().warning(tr("Cannot find '%1' in '\\%2' %3") .arg(clone->name() + "(...)") @@ -426,16 +423,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, C++ namespace, search for it first in all the known C++ namespaces. */ - if (!activeNamespaces_.isEmpty()) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + path; - node = qdb_->findNodeByNameAndType(newPath, type, subtype); - if (node) { - path = newPath; - break; - } - } - } + node = qdb_->findNodeInOpenNamespace(path, type, subtype); /* If the node was not found in a C++ namespace, search @@ -458,7 +446,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, if (path.size() > 1) { path.pop_back(); QString ns = path.join("::"); - activeNamespaces_.insert(ns); + qdb_->insertOpenNamespace(ns); } } return node; @@ -1718,7 +1706,7 @@ bool CppCodeParser::matchUsingDecl() /* So far, so good. We have 'using namespace Foo;'. */ - activeNamespaces_.insert(name); + qdb_->insertOpenNamespace(name); return true; } @@ -2125,13 +2113,7 @@ bool CppCodeParser::matchDocsAndStuff() FunctionNode *func = 0; if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + parentPath; - func = qdb_->findFunctionNode(newPath, clone); - if (func) { - break; - } - } + func = qdb_->findNodeInOpenNamespace(parentPath, clone); if (func == 0) func = qdb_->findFunctionNode(parentPath, clone); @@ -2256,9 +2238,8 @@ bool CppCodeParser::makeFunctionNode(const QString& signature, Tokenizer* outerTokenizer = tokenizer; int outerTok = tok; - Location loc; QByteArray latin1 = signature.toLatin1(); - Tokenizer stringTokenizer(loc, latin1); + Tokenizer stringTokenizer(location(), latin1); stringTokenizer.setParsingFnOrMacro(true); tokenizer = &stringTokenizer; readToken(); diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h index eae5d1e97d..957142712b 100644 --- a/src/tools/qdoc/cppcodeparser.h +++ b/src/tools/qdoc/cppcodeparser.h @@ -166,7 +166,6 @@ protected: QStringList lastPath_; QRegExp varComment; QRegExp sep; - QSet<QString> activeNamespaces_; private: QString sequentialIteratorDefinition; diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index dd87e889bf..af8ac505f8 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -532,10 +532,12 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) projectUrl = config.getString(CONFIG_URL); tagFile_ = config.getString(CONFIG_TAGFILE); +#ifndef QT_NO_TEXTCODEC outputEncoding = config.getString(CONFIG_OUTPUTENCODING); if (outputEncoding.isEmpty()) outputEncoding = QLatin1String("ISO-8859-1"); outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit()); +#endif naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE); if (naturalLanguage.isEmpty()) @@ -3586,7 +3588,11 @@ QString DitaXmlGenerator::registerRef(const QString& ref) */ QString DitaXmlGenerator::protectEnc(const QString& string) { +#ifndef QT_NO_TEXTCODEC return protect(string, outputEncoding); +#else + return protect(string); +#endif } QString DitaXmlGenerator::protect(const QString& string, const QString& ) //outputEncoding) diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 81be63abe1..187253df50 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -273,8 +273,10 @@ void Generator::beginSubPage(const InnerNode* node, const QString& fileName) node->location().fatal(tr("Cannot open output file '%1'").arg(outFile->fileName())); QTextStream* out = new QTextStream(outFile); +#ifndef QT_NO_TEXTCODEC if (outputCodec) out->setCodec(outputCodec); +#endif outStreamStack.push(out); const_cast<InnerNode*>(node)->setOutputFileName(fileName); } diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index 28a9ae5ce8..2fb3117765 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -178,8 +178,10 @@ protected: QMap<QString, QStringList> editionGroupMap; QMap<QString, QStringList> editionModuleMap; QString naturalLanguage; +#ifndef QT_NO_TEXTCODEC QTextCodec* outputCodec; QString outputEncoding; +#endif QString tagFile_; QStack<QTextStream*> outStreamStack; diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 3d6f04decf..73788edb4a 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -179,10 +179,12 @@ void HtmlGenerator::initializeGenerator(const Config &config) projectUrl = config.getString(CONFIG_URL); tagFile_ = config.getString(CONFIG_TAGFILE); +#ifndef QT_NO_TEXTCODEC outputEncoding = config.getString(CONFIG_OUTPUTENCODING); if (outputEncoding.isEmpty()) outputEncoding = QLatin1String("UTF-8"); outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit()); +#endif naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE); if (naturalLanguage.isEmpty()) @@ -1743,7 +1745,11 @@ void HtmlGenerator::generateHeader(const QString& title, const Node *node, CodeMarker *marker) { +#ifndef QT_NO_TEXTCODEC out() << QString("<?xml version=\"1.0\" encoding=\"%1\"?>\n").arg(outputEncoding); +#else + out() << QString("<?xml version=\"1.0\"?>\n"); +#endif out() << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage); out() << "<head>\n"; @@ -3185,7 +3191,11 @@ QString HtmlGenerator::registerRef(const QString& ref) QString HtmlGenerator::protectEnc(const QString &string) { +#ifndef QT_NO_TEXTCODEC return protect(string, outputEncoding); +#else + return protect(string); +#endif } QString HtmlGenerator::protect(const QString &string, const QString &outputEncoding) @@ -4172,11 +4182,12 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) if (match) { tags += manifestMetaContent[idx].tags; foreach (const QString &attr, manifestMetaContent[idx].attributes) { - QStringList attrList = attr.split(QLatin1Char(':'), QString::SkipEmptyParts); + QLatin1Char div(':'); + QStringList attrList = attr.split(div); if (attrList.count() == 1) attrList.append(QStringLiteral("true")); - if (attrList.count() == 2) - writer.writeAttribute(attrList[0], attrList[1]); + QString attrName = attrList.takeFirst(); + writer.writeAttribute(attrName, attrList.join(div)); } } } diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h index 33472810d3..0c113bcbeb 100644 --- a/src/tools/qdoc/location.h +++ b/src/tools/qdoc/location.h @@ -47,8 +47,7 @@ #define LOCATION_H #include <qstack.h> - -#include "tr.h" +#include <qcoreapplication.h> QT_BEGIN_NAMESPACE diff --git a/src/tools/qdoc/openedlist.h b/src/tools/qdoc/openedlist.h index cf7624b8e3..2aad1f6dcb 100644 --- a/src/tools/qdoc/openedlist.h +++ b/src/tools/qdoc/openedlist.h @@ -49,7 +49,6 @@ #include <qstring.h> #include "location.h" -#include "tr.h" QT_BEGIN_NAMESPACE diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp index aba17d79b1..d11ef3a3c7 100644 --- a/src/tools/qdoc/puredocparser.cpp +++ b/src/tools/qdoc/puredocparser.cpp @@ -101,10 +101,10 @@ void PureDocParser::parseSourceFile(const Location& location, const QString& fil readToken(); /* - The set of active namespaces is cleared before parsing + The set of open namespaces is cleared before parsing each source file. The word "source" here means cpp file. */ - activeNamespaces_.clear(); + qdb_->clearOpenNamespaces(); processQdocComments(); in.close(); diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro index 3bd11bcd5b..55e32dd4a3 100644 --- a/src/tools/qdoc/qdoc.pro +++ b/src/tools/qdoc/qdoc.pro @@ -38,7 +38,6 @@ HEADERS += atom.h \ separator.h \ text.h \ tokenizer.h \ - tr.h \ tree.h SOURCES += atom.cpp \ codechunk.cpp \ diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 674917f6dc..7a3df4e4f2 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -1126,4 +1126,56 @@ QString QDocDatabase::refForAtom(const Atom* atom) return QString(); } +/*! + If there are open namespaces, search for the function node + having the same function name as the \a clone node in each + open namespace. The \a parentPath is a portion of the path + name provided with the function name at the point of + reference. \a parentPath is usually a class name. Return + the pointer to the function node if one is found in an + open namespace. Otherwise return 0. + + This open namespace concept is of dubious value and might + be removed. + */ +FunctionNode* QDocDatabase::findNodeInOpenNamespace(const QStringList& parentPath, + const FunctionNode* clone) +{ + FunctionNode* fn = 0; + if (!openNamespaces_.isEmpty()) { + foreach (const QString& t, openNamespaces_) { + QStringList path = t.split("::") + parentPath; + fn = findFunctionNode(path, clone); + if (fn) + break; + } + } + return fn; +} + +/*! + Find a node of the specified \a type and \a subtype that is + reached with the specified \a path. If such a node is found + in an open namespace, prefix \a path with the name of the + open namespace and "::" and return a pointer to the node. + Othewrwise return 0. + */ +Node* QDocDatabase::findNodeInOpenNamespace(QStringList& path, + Node::Type type, + Node::SubType subtype) +{ + Node* n = 0; + if (!openNamespaces_.isEmpty()) { + foreach (const QString& t, openNamespaces_) { + QStringList p = t.split("::") + path; + n = findNodeByNameAndType(p, type, subtype); + if (n) { + path = p; + break; + } + } + } + return n; +} + QT_END_NAMESPACE diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index d97fb3809a..d88160ee56 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -196,6 +196,11 @@ class QDocDatabase Generator* g, bool generateInternalNodes = false); + void clearOpenNamespaces() { openNamespaces_.clear(); } + void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); } + FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone); + Node* findNodeInOpenNamespace(QStringList& path, Node::Type type, Node::SubType subtype); + /* debugging functions */ void printModules() const; void printQmlModules() const; @@ -240,6 +245,7 @@ class QDocDatabase TextToNodeMap legaleseTexts_; DocNodeMultiMap docNodesByTitle_; TargetRecMultiMap targetRecMultiMap_; + QSet<QString> openNamespaces_; }; QT_END_NAMESPACE diff --git a/src/tools/qdoc/separator.cpp b/src/tools/qdoc/separator.cpp index 2403fb15c8..af10ba364c 100644 --- a/src/tools/qdoc/separator.cpp +++ b/src/tools/qdoc/separator.cpp @@ -44,7 +44,7 @@ */ #include "separator.h" -#include "tr.h" +#include <qcoreapplication.h> QT_BEGIN_NAMESPACE diff --git a/src/tools/qdoc/tokenizer.cpp b/src/tools/qdoc/tokenizer.cpp index 3968cdb828..224d451f4c 100644 --- a/src/tools/qdoc/tokenizer.cpp +++ b/src/tools/qdoc/tokenizer.cpp @@ -101,7 +101,9 @@ static QRegExp *definedX = 0; static QRegExp *defines = 0; static QRegExp *falsehoods = 0; +#ifndef QT_NO_TEXTCODEC static QTextCodec *sourceCodec = 0; +#endif /* This function is a perfect hash function for the 37 keywords of C99 @@ -496,7 +498,9 @@ void Tokenizer::initialize(const Config &config) QString sourceEncoding = config.getString(CONFIG_SOURCEENCODING); if (sourceEncoding.isEmpty()) sourceEncoding = QLatin1String("ISO-8859-1"); +#ifndef QT_NO_TEXTCODEC sourceCodec = QTextCodec::codecForName(sourceEncoding.toLocal8Bit()); +#endif comment = new QRegExp("/(?:\\*.*\\*/|/.*\n|/[^\n]*$)"); comment->setMinimal(true); @@ -770,12 +774,20 @@ bool Tokenizer::isTrue(const QString &condition) QString Tokenizer::lexeme() const { +#ifndef QT_NO_TEXTCODEC return sourceCodec->toUnicode(yyLex); +#else + return QString::fromUtf8(yyLex); +#endif } QString Tokenizer::previousLexeme() const { +#ifndef QT_NO_TEXTCODEC return sourceCodec->toUnicode(yyPrevLex); +#else + return QString::fromUtf8(yyPrevLex); +#endif } QT_END_NAMESPACE diff --git a/src/tools/qdoc/tr.h b/src/tools/qdoc/tr.h deleted file mode 100644 index 36b0c47fef..0000000000 --- a/src/tools/qdoc/tr.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the tools applications 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - tr.h -*/ - -#ifndef TR_H -#define TR_H - -#include <qglobal.h> - -#if !defined(QT_BOOTSTRAPPED) && !defined(QT_NO_TRANSLATION) -# define TRANSLATE_QDOC -#endif - -#include <qstring.h> -#ifdef TRANSLATE_QDOC -# include <qcoreapplication.h> -#endif - -QT_BEGIN_NAMESPACE - -#ifndef TRANSLATE_QDOC - -#define Q_DECLARE_TR_FUNCTIONS(context) - -inline QString tr(const char *sourceText, const char *comment = 0) -{ - Q_UNUSED(comment); - return QString( QLatin1String(sourceText) ); -} - -struct QCoreApplication -{ - static inline QString translate(const char * /* context */ , const char *sourceText, const char * /* disambiguation */ = 0) - { return QLatin1String(sourceText); } -}; - -#endif // !TRANSLATE_QDOC - -QT_END_NAMESPACE - -#endif diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index 1efab11a92..553c569ae9 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -367,7 +367,11 @@ const FunctionNode* Tree::findFunctionNode(const QStringList& parentPath, const Node* relative, int findFlags) const { - const Node* parent = findNode(parentPath, relative, findFlags); + const Node* parent = findNamespaceNode(parentPath); + if (parent == 0) + parent = findClassNode(parentPath, 0); + if (parent == 0) + parent = findNode(parentPath, relative, findFlags); if (parent == 0 || !parent->isInnerNode()) return 0; return ((InnerNode*)parent)->findFunctionNode(clone); @@ -658,7 +662,7 @@ Node* Tree::findNodeRecursive(const QStringList& path, Node* start, Node::Type type, Node::SubType subtype, - bool acceptCollision) + bool acceptCollision) const { if (!start || path.isEmpty()) return 0; // no place to start, or nothing to search for. @@ -736,7 +740,7 @@ EnumNode* Tree::findEnumNode(const QStringList& path, Node* start) at the root of the tree. Only a C++ class node named \a path is acceptible. If one is not found, 0 is returned. */ -ClassNode* Tree::findClassNode(const QStringList& path, Node* start) +ClassNode* Tree::findClassNode(const QStringList& path, Node* start) const { if (!start) start = const_cast<NamespaceNode*>(root()); @@ -748,7 +752,7 @@ ClassNode* Tree::findClassNode(const QStringList& path, Node* start) the root of the tree. Only a Namespace node named \a path is acceptible. If one is not found, 0 is returned. */ -NamespaceNode* Tree::findNamespaceNode(const QStringList& path) +NamespaceNode* Tree::findNamespaceNode(const QStringList& path) const { Node* start = const_cast<NamespaceNode*>(root()); return static_cast<NamespaceNode*>(findNodeRecursive(path, 0, start, Node::Namespace, Node::NoSubType)); diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h index 67cd3a9752..e44b8d7d12 100644 --- a/src/tools/qdoc/tree.h +++ b/src/tools/qdoc/tree.h @@ -82,9 +82,9 @@ class Tree ~Tree(); EnumNode* findEnumNode(const QStringList& path, Node* start = 0); - ClassNode* findClassNode(const QStringList& path, Node* start = 0); + ClassNode* findClassNode(const QStringList& path, Node* start = 0) const; QmlClassNode* findQmlTypeNode(const QStringList& path); - NamespaceNode* findNamespaceNode(const QStringList& path); + NamespaceNode* findNamespaceNode(const QStringList& path) const; DocNode* findQmlModuleNode(const QStringList& path, Node* start = 0); Node* findNodeByNameAndType(const QStringList& path, @@ -98,7 +98,7 @@ class Tree Node* start, Node::Type type, Node::SubType subtype, - bool acceptCollision = false); + bool acceptCollision = false) const; const Node* findNode(const QStringList &path, const Node* relative = 0, diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 653a9170b2..f72abd20ab 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1677,8 +1677,8 @@ void QTreeWidgetItemPrivate::propagateDisabled(QTreeWidgetItem *item) the item can be checked, edited, and selected. The default value for flags is - Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled. - If the item was constructed with a parent, flags will in addition contain Qt::ItemIsDropEnabled. + Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | + Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled. \sa setFlags() */ diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 0da9460794..61f3b6b8eb 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -707,7 +707,7 @@ QApplication::~QApplication() QWidgetSet *mySet = QWidgetPrivate::allWidgets; QWidgetPrivate::allWidgets = 0; for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (!w->parent()) // window w->destroy(true, true); } @@ -1044,7 +1044,7 @@ void QApplication::setStyle(QStyle *style) if (QApplicationPrivate::app_style) { if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (!(w->windowType() == Qt::Desktop) && // except desktop w->testAttribute(Qt::WA_WState_Polished)) { // has been polished QApplicationPrivate::app_style->unpolish(w); @@ -1086,7 +1086,7 @@ void QApplication::setStyle(QStyle *style) // re-polish existing widgets if necessary if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { for (QWidgetList::ConstIterator it1 = all.constBegin(); it1 != all.constEnd(); ++it1) { - register QWidget *w = *it1; + QWidget *w = *it1; if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)) { if (w->style() == QApplicationPrivate::app_style) QApplicationPrivate::app_style->polish(w); // repolish @@ -1098,7 +1098,7 @@ void QApplication::setStyle(QStyle *style) } for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) { - register QWidget *w = *it2; + QWidget *w = *it2; if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) { QEvent e(QEvent::StyleChange); QApplication::sendEvent(w, &e); @@ -1328,7 +1328,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* QWidgetList wids = QApplication::allWidgets(); for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class QApplication::sendEvent(w, &e); } @@ -1510,7 +1510,7 @@ void QApplication::setFont(const QFont &font, const char *className) QWidgetList wids = QApplication::allWidgets(); for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class sendEvent(w, &e); } @@ -1580,7 +1580,7 @@ void QApplication::setWindowIcon(const QIcon &icon) QEvent e(QEvent::ApplicationWindowIconChange); QWidgetList all = QApplication::allWidgets(); for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (w->isWindow()) sendEvent(w, &e); } @@ -2695,12 +2695,14 @@ bool QApplicationPrivate::shouldQuit() the ones without QuitOnClose), we emit the lastWindowClosed signal */ QWidgetList list = QApplication::topLevelWidgets(); + QWindowList processedWindows; for (int i = 0; i < list.size(); ++i) { QWidget *w = list.at(i); + processedWindows.push_back(w->windowHandle()); if (w->isVisible() && !w->parentWidget() && w->testAttribute(Qt::WA_QuitOnClose)) return false; } - return QGuiApplicationPrivate::shouldQuit(); + return QGuiApplicationPrivate::shouldQuitInternal(processedWindows); } static inline void closeAllPopups() @@ -2975,7 +2977,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { // but still send them through all application event filters (normally done by notify_helper) for (int i = 0; d->extraData && i < d->extraData->eventFilters.size(); ++i) { - register QObject *obj = d->extraData->eventFilters.at(i); + QObject *obj = d->extraData->eventFilters.at(i); if (!obj) continue; if (obj->d_func()->threadData != w->d_func()->threadData) { diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index b96bd024cb..661317d21a 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -380,7 +380,7 @@ void QWhatsThisPrivate::notifyToplevels(QEvent *e) { QWidgetList toplevels = QApplication::topLevelWidgets(); for (int i = 0; i < toplevels.count(); ++i) { - register QWidget *w = toplevels.at(i); + QWidget *w = toplevels.at(i); QApplication::sendEvent(w, e); } } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index f67a93c7b5..c6bd387a90 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -104,6 +104,8 @@ #include "qtabwidget.h" // Needed in inTabWidget() #endif // QT_KEYPAD_NAVIGATION +#include "qwindowcontainer_p.h" + // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG @@ -6250,6 +6252,17 @@ bool QWidget::isActiveWindow() const } } + // Check for an active window container + if (QWindow *ww = QGuiApplication::focusWindow()) { + while (ww) { + QWidgetWindow *qww = qobject_cast<QWidgetWindow *>(ww); + QWindowContainer *qwc = qww ? qobject_cast<QWindowContainer *>(qww->widget()) : 0; + if (qwc && qwc->topLevelWidget() == tlw) + return true; + ww = ww->parent(); + } + } + // Check if platform adaptation thinks the window is active. This is necessary for // example in case of ActiveQt servers that are embedded into another application. // Those are separate processes that are not part of the parent application Qt window/widget diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index c6edbee67d..936eb76dad 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5004,7 +5004,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_ItemView_ActivateItemOnSingleClick: ret = 0; if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) - ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toBool() ? 1 : 0; + ret = theme->themeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick).toBool() ? 1 : 0; break; case SH_TitleBar_ModifyNotification: ret = true; diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index a8fba4fb68..dad4e57d13 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -119,9 +119,12 @@ QMacStylePrivate *mPrivate; { Q_UNUSED(notification); QEvent event(QEvent::StyleChange); - foreach (QWidget *widget, QApplication::allWidgets()) { - if (QScrollBar *scrollBar = qobject_cast<QScrollBar *>(widget)) - QCoreApplication::sendEvent(scrollBar, &event); + QMutableSetIterator<QPointer<QObject> > it(QMacStylePrivate::scrollBars); + while (it.hasNext()) { + if (!it.next()) + it.remove(); + else + QCoreApplication::sendEvent(it.value(), &event); } } @end @@ -142,6 +145,13 @@ const int QMacStylePrivate::PushButtonContentPadding = 6; const qreal QMacStylePrivate::ScrollBarFadeOutDuration = 200.0; const qreal QMacStylePrivate::ScrollBarFadeOutDelay = 450.0; +QSet<QPointer<QObject> > QMacStylePrivate::scrollBars; + +static uint qHash(const QPointer<QObject> &ptr) +{ + return qHash(ptr.data()); +} + // These colors specify the titlebar gradient colors on // Leopard. Ideally we should get them from the system. static const QColor titlebarGradientActiveBegin(220, 220, 220); @@ -1620,6 +1630,19 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti } } +void QMacStylePrivate::setAutoDefaultButton(QObject *button) const +{ + if (autoDefaultButton != button) { + if (QStyleAnimation *anim = animation(autoDefaultButton)) { + anim->updateTarget(); + stopAnimation(autoDefaultButton); + } + autoDefaultButton = button; + } + if (autoDefaultButton && !animation(autoDefaultButton)) + startAnimation(new QStyleAnimation(autoDefaultButton)); +} + QMacStylePrivate::QMacStylePrivate() : mouseDown(false) { @@ -3487,15 +3510,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // takes precedence over a normal default button if (btn->features & QStyleOptionButton::AutoDefaultButton && opt->state & State_Active && opt->state & State_HasFocus) { - d->autoDefaultButton = opt->styleObject; - if (!d->animation(opt->styleObject)) - d->startAnimation(new QStyleAnimation(opt->styleObject)); + d->setAutoDefaultButton(opt->styleObject); } else if (d->autoDefaultButton == opt->styleObject) { - if (QStyleAnimation *animation = d->animation(opt->styleObject)) { - animation->updateTarget(); - d->stopAnimation(opt->styleObject); - } - d->autoDefaultButton = 0; + d->setAutoDefaultButton(0); } if (!d->autoDefaultButton) { @@ -4934,6 +4951,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex // no longer possible to move it, second the up/down buttons are removed when // there is not enough space for them. if (cc == CC_ScrollBar) { + if (opt && opt->styleObject && !QMacStylePrivate::scrollBars.contains(opt->styleObject)) + QMacStylePrivate::scrollBars.insert(QPointer<QObject>(opt->styleObject)); const int scrollBarLength = (slider->orientation == Qt::Horizontal) ? slider->rect.width() : slider->rect.height(); const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget, opt); @@ -6021,10 +6040,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, bool useAquaGuideline = true; switch (ct) { - case QStyle::CT_SpinBox: - // hack to work around horrible sizeHint() code in QAbstractSpinBox - sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); - sz.setHeight(sz.height() - 3); + + case CT_SpinBox: + if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { + // Add button + frame widths + int buttonWidth = 20; + int fw = proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget); + sz += QSize(buttonWidth + 2*fw, 2*fw - 3); + } break; case QStyle::CT_TabWidget: // the size between the pane and the "contentsRect" (+4,+4) diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index c424ff0c3c..efeaa66e39 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -93,6 +93,7 @@ #include <qlibrary.h> #include <qdatetimeedit.h> #include <qmath.h> +#include <qset.h> #include <QtWidgets/qgraphicsproxywidget.h> #include <QtWidgets/qgraphicsview.h> @@ -193,10 +194,13 @@ public: HIThemeButtonDrawInfo *bdi) const; QPixmap generateBackgroundPattern() const; + void setAutoDefaultButton(QObject *button) const; + public: mutable QPointer<QObject> pressedButton; mutable QPointer<QObject> defaultButton; mutable QPointer<QObject> autoDefaultButton; + static QSet<QPointer<QObject> > scrollBars; struct ButtonState { int frame; diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 603d0e50a5..dccc9ff3ce 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -351,7 +351,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C \section1 Styles in Item Views The painting of items in views is performed by a delegate. Qt's - default delegate, QStyledItemDelegate, is also used for for calculating bounding + default delegate, QStyledItemDelegate, is also used for calculating bounding rectangles of items, and their sub-elements for the various kind of item \l{Qt::ItemDataRole}{data roles} QStyledItemDelegate supports. See the QStyledItemDelegate class diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 31cf329262..3b3c27f6cb 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -582,7 +582,7 @@ bool QWindowsXPStylePrivate::hasAlphaChannel(const QRect &rect) int firstAlpha = -1; for (int y = startY; y < h/2; ++y) { - register DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); + DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); for (int x = startX; x < w; ++x, ++buffer) { int alpha = (*buffer) >> 24; if (firstAlpha == -1) @@ -611,8 +611,8 @@ bool QWindowsXPStylePrivate::fixAlphaChannel(const QRect &rect) bool hasFixedAlphaValue = false; for (int y = startY; y < h; ++y) { - register DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); - for (register int x = startX; x < w; ++x, ++buffer) { + DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); + for (int x = startX; x < w; ++x, ++buffer) { uint pixel = *buffer; int alpha = qAlpha(pixel); if (qRed(pixel) > alpha || qGreen(pixel) > alpha || qBlue(pixel) > alpha) { @@ -643,13 +643,13 @@ bool QWindowsXPStylePrivate::swapAlphaChannel(const QRect &rect, bool allPixels) // Flip the alphas, so that 255-alpha pixels are 0, and 0-alpha are 255. for (int y = startY; y < h; ++y) { - register DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); - for (register int x = startX; x < w; ++x, ++buffer) { + DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); + for (int x = startX; x < w; ++x, ++buffer) { if (allPixels) { *buffer |= 0xFF000000; continue; } - register unsigned int alphaValue = (*buffer) & 0xFF000000; + unsigned int alphaValue = (*buffer) & 0xFF000000; if (alphaValue == 0xFF000000) { *buffer = 0; valueChange = true; diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index b39b17fd86..3707090c4c 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -54,25 +54,10 @@ contains( styles, mac ) { styles/qmacstyle_mac_p.h \ styles/qmacstyle_mac_p_p.h OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm - - !contains( styles, windows ) { - message( mac requires windows ) - styles += windows - DEFINES+= QT_STYLE_WINDOWS - } } else { DEFINES += QT_NO_STYLE_MAC } -contains( styles, windows ) { - HEADERS += styles/qwindowsstyle_p.h - HEADERS += styles/qwindowsstyle_p_p.h - SOURCES += styles/qwindowsstyle.cpp - DEFINES += QT_STYLE_WINDOWS -} else { - DEFINES += QT_NO_STYLE_WINDOWS -} - contains( styles, windowsvista ) { HEADERS += styles/qwindowsvistastyle_p.h HEADERS += styles/qwindowsvistastyle_p_p.h @@ -80,7 +65,6 @@ contains( styles, windowsvista ) { !contains( styles, windowsxp ) { message( windowsvista requires windowsxp ) styles += windowsxp - DEFINES += QT_STYLE_WINDOWSXP } } else { DEFINES += QT_NO_STYLE_WINDOWSVISTA @@ -93,12 +77,19 @@ contains( styles, windowsxp ) { !contains( styles, windows ) { message( windowsxp requires windows ) styles += windows - DEFINES += QT_STYLE_WINDOWS } } else { DEFINES += QT_NO_STYLE_WINDOWSXP } +contains( styles, windows ) { + HEADERS += styles/qwindowsstyle_p.h + HEADERS += styles/qwindowsstyle_p_p.h + SOURCES += styles/qwindowsstyle.cpp +} else { + DEFINES += QT_NO_STYLE_WINDOWS +} + contains( styles, gtk ) { HEADERS += styles/qgtkglobal_p.h HEADERS += styles/qgtkstyle_p.h diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index e04656974d..5204b85a9a 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -153,16 +153,17 @@ private: QSystemTrayIcon *q; }; -QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) : - q(qIn) +QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) + : QWidget(0, Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint) + , q(qIn) { + setObjectName(QStringLiteral("QSystemTrayIconSys")); setToolTip(q->toolTip()); QX11SystemTrayContext *context = qX11SystemTrayContext(); Q_ASSERT(context->isValid()); setAttribute(Qt::WA_AlwaysShowToolTips, true); setAttribute(Qt::WA_TranslucentBackground, true); setAttribute(Qt::WA_QuitOnClose, false); - setWindowFlags(Qt::Window | Qt::FramelessWindowHint); const QSize size(22, 22); // Gnome, standard size setGeometry(QRect(QPoint(0, 0), size)); setMinimumSize(size); @@ -182,7 +183,6 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) : ev.xclient.format = 32; memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l)); XSendEvent(display, ev.xclient.window, False, 0, &ev); - XSync(display, False); show(); } diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 5217e57333..7cd7172ef5 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1259,6 +1259,9 @@ void QDockWidget::setFloating(bool floating) d->endDrag(true); QRect r = d->undockedGeometry; + // Keep position when undocking for the first time. + if (floating && isVisible() && !r.isValid()) + r = QRect(mapToGlobal(QPoint(0, 0)), size()); d->setWindowState(floating, false, floating ? r : QRect()); diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 3ba9ad9ba3..5104171fb1 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -429,7 +429,7 @@ void QLCDNumber::setDigitCount(int numDigits) bool doDisplay = d->ndigits == 0; if (numDigits == d->ndigits) // no change return; - register int i; + int i; int dif; if (numDigits > d->ndigits) { // expand dif = numDigits - d->ndigits; diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index abef6e8832..d44e9ad02f 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -132,7 +132,8 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, - including undo and redo, cut and paste, and drag and drop. + including undo and redo, cut and paste, and drag and drop (see + \l setDragEnabled()). By changing the echoMode() of a line edit, it can also be used as a "write-only" field, for inputs such as passwords. @@ -1801,7 +1802,7 @@ void QLineEdit::paintEvent(QPaintEvent *) int minLB = qMax(0, -fm.minLeftBearing()); int minRB = qMax(0, -fm.minRightBearing()); - if (d->control->text().isEmpty()) { + if (d->control->text().isEmpty() && d->control->preeditAreaText().isEmpty()) { if (!d->placeholderText.isEmpty()) { QColor col = pal.text().color(); col.setAlpha(128); diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 7c72c5c456..4df89a5ede 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2854,9 +2854,9 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) d->hasHadMouse = d->hasHadMouse || rect().contains(e->pos()); QAction *action = d->actionAt(e->pos()); - if (!action) { + if (!action || action->isSeparator()) { if (d->hasHadMouse - && (!d->currentAction + && (!d->currentAction || (action && action->isSeparator()) || !(d->currentAction->menu() && d->currentAction->menu()->isVisible()))) d->setCurrentAction(0); return; |