diff options
64 files changed, 589 insertions, 291 deletions
diff --git a/config.tests/qpa/kms/kms.pro b/config.tests/qpa/kms/kms.pro index 1fb73677e7..5147bc82da 100644 --- a/config.tests/qpa/kms/kms.pro +++ b/config.tests/qpa/kms/kms.pro @@ -1,4 +1,4 @@ SOURCES = kms.cpp CONFIG += link_pkgconfig -PKGCONFIG += libdrm libudev +PKGCONFIG += libdrm CONFIG -= qt diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 598e2a2d4d..69d4285321 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -61,9 +61,6 @@ while [ "$#" -gt 0 ]; do shift done -# debuggery -[ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION auto-detection... ($*)" - test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST" cd "$OUTDIR/$TEST" @@ -89,6 +86,7 @@ set -- \ "$SRCDIR/$TEST/$EXE.pro" \ -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then + echo OUTDIR=$OUTDIR "$@" && $MAKE && SUCCESS=yes else OUTDIR=$OUTDIR "$@" >/dev/null 2>&1 && $MAKE >/dev/null 2>&1 && SUCCESS=yes @@ -96,9 +94,9 @@ fi # done if [ "$SUCCESS" != "yes" ]; then - [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION disabled." + [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION disabled." || echo " no." exit 1 else - [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION enabled." + [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION enabled." || echo " yes." exit 0 fi @@ -4280,6 +4280,7 @@ compileTest() if [ "$CFG_SHARED" = "no" ]; then test_config="$QMAKE_CONFIG static" fi + echo $ECHO_N "checking for $name... $ECHO_C" "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" } @@ -5359,6 +5360,7 @@ if [ "$CFG_OPENGL" = "es2" ]; then fi # auto-detect FontConfig support +ORIG_CFG_FREETYPE="$CFG_FREETYPE" if [ "$CFG_FONTCONFIG" != "no" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null` @@ -5553,6 +5555,11 @@ if [ "$CFG_XCB" != "no" ]; then if [ "$CFG_XCB" = "qt" ]; then QT_CONFIG="$QT_CONFIG xcb-qt" + + if compileTest qpa/xcb-glx "xcb-glx" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then + CFG_XCB_GLX=yes + QT_CONFIG="$QT_CONFIG xcb-glx" + fi else CFG_XCB="system" if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then @@ -7404,6 +7411,15 @@ if [ "$CFG_SHARED" = "no" ]; then echo "loaded plugins. Make sure to import all needed static plugins," echo "or compile needed modules into the library." fi +if [ "$CFG_FREETYPE" = "system" ]; then + if [ "$ORIG_CFG_FREETYPE" = "qt" ]; then + echo + echo "WARNING: Bundled FreeType can't be used. FontConfig use requires system FreeType." + elif [ "$ORIG_CFG_FREETYPE" = "no" ]; then + echo + echo "WARNING: FreeType can't be disabled. FontConfig use requires system FreeType." + fi +fi if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then echo echo "NOTE: When linking against OpenSSL, you can override the default" diff --git a/mkspecs/devices/linux-imx6-g++/qmake.conf b/mkspecs/devices/linux-imx6-g++/qmake.conf index 71e37845c3..46d631796d 100644 --- a/mkspecs/devices/linux-imx6-g++/qmake.conf +++ b/mkspecs/devices/linux-imx6-g++/qmake.conf @@ -1,6 +1,23 @@ # # qmake configuration for the Freescale iMX6 boards (single, dual and quad) # +# The configuration below is set up for running with EGL on the framebuffer via +# the eglfs platform plugin and its eglfs_viv backend. + +# Wayland is also fully functional out of the box. However, when writing Wayland +# *compositors* with Qt, the eglfs backend will have to be switched to +# eglfs_viv_wl by setting the QT_QPA_EGLFS_INTEGRATION environment variable. +# +# Below is an example configure line that assumes the SDK is in +# $HOME/imx6/toolchain. On device Qt is expected to be placed under +# /usr/local/qt5 whereas on the host 'make install' will copy the host tools and +# the target libraries to $HOME/imx6/qt5. +# +# ./configure -prefix /usr/local/qt5 -extprefix $HOME/imx6/qt5 -device linux-imx6-g++ \ +# -device-option CROSS_COMPILE=$HOME/imx6/toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi- \ +# -sysroot $HOME/imx6/toolchain/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi \ +# -nomake examples -nomake tests -v +# include(../common/linux_device_pre.conf) diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf index 6b37a04450..2cb2981758 100644 --- a/mkspecs/features/configure.prf +++ b/mkspecs/features/configure.prf @@ -1,9 +1,7 @@ QMAKE_MAKE = $$(MAKE) !isEmpty(QMAKE_MAKE) { # We were called recursively. Use the right make, as MAKEFLAGS may be set as well. -} else:equals(MAKEFILE_GENERATOR, UNIX) { - QMAKE_MAKE = make -} else:equals(MAKEFILE_GENERATOR, MINGW) { +} else:if(equals(MAKEFILE_GENERATOR, UNIX)|equals(MAKEFILE_GENERATOR, MINGW)) { !equals(QMAKE_HOST.os, Windows): \ QMAKE_MAKE = make else: \ diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf index 20b8eb4d53..158bddf60c 100644 --- a/mkspecs/features/qml_plugin.prf +++ b/mkspecs/features/qml_plugin.prf @@ -15,8 +15,7 @@ TEMPLATE = lib CONFIG += plugin if(win32|mac):!macx-xcode { - contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release - contains(QT_CONFIG, build_all):CONFIG += build_all + contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all } CONFIG += relative_qt_rpath # Qt's QML plugins should be relocatable diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf index 823a4c9490..46aca50cc2 100644 --- a/mkspecs/features/qt_app.prf +++ b/mkspecs/features/qt_app.prf @@ -28,7 +28,7 @@ host_build:force_bootstrap { } target.path = $$[QT_HOST_BINS] } else { - !build_pass:contains(QT_CONFIG, debug_and_release):contains(QT_CONFIG, build_all): CONFIG += release + !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release target.path = $$[QT_INSTALL_BINS] CONFIG += relative_qt_rpath # Qt's tools and apps should be relocatable } diff --git a/mkspecs/features/qt_helper_lib.prf b/mkspecs/features/qt_helper_lib.prf index 2bad528aea..3393154436 100644 --- a/mkspecs/features/qt_helper_lib.prf +++ b/mkspecs/features/qt_helper_lib.prf @@ -18,8 +18,7 @@ QT = # In case qt is re-added. CONFIG -= warning_clean # Don't presume 3rd party code to be clean load(qt_common) -contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release -contains(QT_CONFIG, build_all): CONFIG += build_all +contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all DESTDIR = $$MODULE_BASE_OUTDIR/lib DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index aefd3aee1c..5bd5101cdc 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -38,7 +38,7 @@ host_build { QT += bootstrap-private } } else { - !build_pass:contains(QT_CONFIG, build_all): CONFIG += release + !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release } } @@ -89,8 +89,7 @@ INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.inclu # If Qt was configured with -debug-and-release then build the module the same way # - unless this is a host library !host_build:if(win32|mac):!macx-xcode { - contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release - contains(QT_CONFIG, build_all):CONFIG += build_all + contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all } QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index 094c854ef0..66f7470a19 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -187,6 +187,16 @@ headersclean:!internal_module { !contains(QT_ARCH, arm):!contains(QT_ARCH, mips): \ hcleanFLAGS += -Wcast-align + + !clang { + # options accepted only by GCC + + c++11 { + # only enabled for actual c++11 builds due to + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52806 + hcleanFLAGS += -Wzero-as-null-pointer-constant + } + } } # Use strict mode C++11 or C++98, with no GNU extensions (see -pedantic-errors above). diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 220f11bd75..176159eff1 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -24,10 +24,9 @@ win32:CONFIG(shared, static|shared) { } tool_plugin { - !build_pass:contains(QT_CONFIG, build_all): CONFIG += release + !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release } else:if(win32|mac):!macx-xcode { - contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release - contains(QT_CONFIG, build_all):CONFIG += build_all + contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all } CONFIG += relative_qt_rpath # Qt's plugins should be relocatable diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf index 3712c94778..7af1ca828e 100644 --- a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf +++ b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf @@ -7,6 +7,7 @@ include(../common/wince/qmake.conf) CE_SDK = Toradex_CE800 # replace with actual SDK name CE_ARCH = ARMV7 +CE_PLATFORMNAME = Toradex_CE800 QT_CONFIG -= accessibility DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM QT_NO_WINCE_SHELLSDK QT_NO_WINCE_NUIOUSER diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 1d4f722e51..d1fa6efbfb 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -707,6 +707,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString slnConf = _slnSolutionConf; if (!project->isEmpty("VCPROJ_ARCH")) { slnConf.replace(QLatin1String("|Win32"), "|" + project->first("VCPROJ_ARCH")); + } else if (!project->isEmpty("CE_PLATFORMNAME")) { + slnConf.replace(QLatin1String("|Win32"), "|" + project->first("CE_PLATFORMNAME")); } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) { QString slnPlatform = QString("|") + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; slnConf.replace(QLatin1String("|Win32"), slnPlatform); @@ -724,6 +726,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString xplatform = platform; if (!project->isEmpty("VCPROJ_ARCH")) { xplatform = project->first("VCPROJ_ARCH").toQString(); + } else if (!project->isEmpty("CE_PLATFORMNAME")) { + xplatform = project->first("CE_PLATFORMNAME").toQString(); } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) { xplatform = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; } @@ -985,6 +989,8 @@ void VcprojGenerator::initProject() vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString(); if (!project->isEmpty("VCPROJ_ARCH")) { vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString(); + } else if (!project->isEmpty("CE_PLATFORMNAME")) { + vcProject.PlatformName = project->first("CE_PLATFORMNAME").toQString(); } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { vcProject.PlatformName = (is64Bit ? "x64" : "Win32"); } else { @@ -1069,6 +1075,8 @@ void VcprojGenerator::initConfiguration() conf.ConfigurationName = conf.Name; if (!project->isEmpty("VCPROJ_ARCH")) { conf.Name += "|" + project->first("VCPROJ_ARCH"); + } else if (!project->isEmpty("CE_PLATFORMNAME")) { + conf.Name += "|" + project->first("CE_PLATFORMNAME"); } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { conf.Name += (is64Bit ? "|x64" : "|Win32"); } else { diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index e55ab0b544..257bd4a50e 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -879,7 +879,9 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa #if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) if (fname.isDriveRoot()) { // a valid drive ?? + const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); DWORD drivesBitmask = ::GetLogicalDrives(); + ::SetErrorMode(oldErrorMode); int drivebit = 1 << (fname.filePath().at(0).toUpper().unicode() - QLatin1Char('A').unicode()); if (drivesBitmask & drivebit) { fileAttrib = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM; diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 886d526fb1..689251a6c7 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -626,7 +626,9 @@ QFileInfoList QFSFileEngine::drives() QFileInfoList ret; #if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) #if defined(Q_OS_WIN32) + const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff; + ::SetErrorMode(oldErrorMode); #endif char driveName[] = "A:/"; diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 9298093f44..7596699843 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -945,6 +945,26 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } } #endif + if (QMetaType::typeFlags(t) & QMetaType::IsEnumeration) { + qlonglong value = qConvertToNumber(d, ok); + if (*ok) { + switch (QMetaType::sizeOf(t)) { + case 1: + *static_cast<signed char *>(result) = value; + return true; + case 2: + *static_cast<qint16 *>(result) = value; + return true; + case 4: + *static_cast<qint32 *>(result) = value; + return true; + case 8: + *static_cast<qint64 *>(result) = value; + return true; + } + } + return *ok; + } return false; } return true; @@ -2819,7 +2839,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] = /*Int*/ 1 << QVariant::UInt | 1 << QVariant::String | 1 << QVariant::Double | 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong - | 1 << QVariant::Char | 1 << QVariant::ByteArray, + | 1 << QVariant::Char | 1 << QVariant::ByteArray | 1 << QVariant::Int, /*UInt*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double | 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index c3c930b82e..27f07d094c 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -31,9 +31,6 @@ ** ****************************************************************************/ -// ask for the latest POSIX, just in case -#define _POSIX_C_SOURCE 200809L - #include "qelapsedtimer.h" #if defined(Q_OS_VXWORKS) #include "qfunctions_vxworks.h" diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index a5bde40fb8..adb7782efc 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -1040,9 +1040,6 @@ Q_INLINE_TEMPLATE int QMultiHash<Key, T>::count(const Key &key, const T &value) return n; } -Q_CORE_EXPORT int qGlobalQHashSeed(); -Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed); - Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash) Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash) diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index e15fbb07ac..704d45cb6c 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -58,6 +58,9 @@ class QString; class QStringRef; class QLatin1String; +Q_CORE_EXPORT int qGlobalQHashSeed(); +Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed); + Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) Q_DECL_NOTHROW; Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 5ca2ce4c6f..a1ee5b6348 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -666,7 +666,11 @@ void qDetectCpuFeatures() // contains all the features that the code required. Qt 4 ran for years // like that, so it shouldn't be a problem. - qt_cpu_features.store(minFeature | quint32(QSimdInitialized)); + qt_cpu_features[0].store(minFeature | quint32(QSimdInitialized)); +#ifndef Q_ATOMIC_INT64_IS_SUPPORTED + qt_cpu_features[1].store(minFeature >> 32); +#endif + return; # endif #endif diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 95994653e6..92d8779cab 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -193,6 +193,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const { if (d == other.d) return true; + if (!d || !other.d) + return false; return d->user == other.d->user && d->password == other.d->password && d->realm == other.d->realm diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index ecd364b84b..1c63e97ee8 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -459,16 +459,21 @@ void QNativeSocketEngine::close() #if _MSC_VER >= 1900 if (d->socketType == QAbstractSocket::TcpSocket) { - // To close the connection properly (not with a hard reset) all pending read operation have to - // be finished or cancelled. The API isn't available on Windows 8.1 though. - ComPtr<IStreamSocket3> socket3; - hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3)); - Q_ASSERT_SUCCEEDED(hr); + hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + HRESULT hr; + // To close the connection properly (not with a hard reset) all pending read operation have to + // be finished or cancelled. The API isn't available on Windows 8.1 though. + ComPtr<IStreamSocket3> socket3; + hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3)); + Q_ASSERT_SUCCEEDED(hr); - ComPtr<IAsyncAction> action; - hr = socket3->CancelIOAsync(&action); - Q_ASSERT_SUCCEEDED(hr); - hr = QWinRTFunctions::await(action); + ComPtr<IAsyncAction> action; + hr = socket3->CancelIOAsync(&action); + Q_ASSERT_SUCCEEDED(hr); + hr = QWinRTFunctions::await(action); + Q_ASSERT_SUCCEEDED(hr); + return S_OK; + }); Q_ASSERT_SUCCEEDED(hr); } #endif // _MSC_VER >= 1900 @@ -1263,9 +1268,12 @@ void QNativeSocketEnginePrivate::handleConnectionEstablished(IAsyncAction *actio HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status) { - Q_Q(QNativeSocketEngine); - if (wasDeleted || isDeletingChildren) + if (closingDown || wasDeleted || isDeletingChildren + || socketState == QAbstractSocket::UnconnectedState) { return S_OK; + } + + Q_Q(QNativeSocketEngine); // A read in UnconnectedState will close the socket and return -1 and thus tell the caller, // that the connection was closed. The socket cannot be closed here, as the subsequent read diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h index 4a5bc81769..2c1c42ecbc 100644 --- a/src/network/socket/qnativesocketengine_winrt_p.h +++ b/src/network/socket/qnativesocketengine_winrt_p.h @@ -148,7 +148,7 @@ public: qintptr socketDescriptor; bool notifyOnRead, notifyOnWrite, notifyOnException; - bool closingDown; + QAtomicInt closingDown; enum ErrorString { NonBlockingInitFailedErrorString, diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm index dbb7e6f754..317648956c 100644 --- a/src/platformsupport/clipboard/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -748,7 +748,7 @@ bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav) QString QMacPasteboardMimeVCard::flavorFor(const QString &mime) { - if (mime.startsWith(QLatin1String("text/plain"))) + if (mime.startsWith(QLatin1String("text/vcard"))) return QLatin1String("public.vcard"); return QString(); } @@ -756,14 +756,14 @@ QString QMacPasteboardMimeVCard::flavorFor(const QString &mime) QString QMacPasteboardMimeVCard::mimeFor(QString flav) { if (flav == QLatin1String("public.vcard")) - return QLatin1String("text/plain"); + return QLatin1String("text/vcard"); return QString(); } QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByteArray> data, QString) { QByteArray cards; - if (mime == QLatin1String("text/plain")) { + if (mime == QLatin1String("text/vcard")) { for (int i=0; i<data.size(); ++i) cards += data[i]; } @@ -773,7 +773,7 @@ QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByte QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime, QVariant data, QString) { QList<QByteArray> ret; - if (mime == QLatin1String("text/plain")) + if (mime == QLatin1String("text/vcard")) ret.append(data.toString().toUtf8()); return ret; } diff --git a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp index 66a74e7a9a..2a0bb8878e 100644 --- a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp +++ b/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp @@ -59,9 +59,10 @@ const QString MenuBarPath = QLatin1String("/MenuBar"); A D-Bus connection which is used for both menu and tray icon services. Connects to the session bus and registers with the respective watcher services. */ -QDBusMenuConnection::QDBusMenuConnection(QObject *parent) +QDBusMenuConnection::QDBusMenuConnection(QObject *parent, const QString &serviceName) : QObject(parent) - , m_connection(QDBusConnection::sessionBus()) + , m_connection(serviceName.isNull() ? QDBusConnection::sessionBus() + : QDBusConnection::connectToBus(QDBusConnection::SessionBus, serviceName)) , m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this)) , m_statusNotifierHostRegistered(false) { diff --git a/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h b/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h index 9208d38c9b..e168d73791 100644 --- a/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h +++ b/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h @@ -61,7 +61,7 @@ class QDBusMenuConnection : public QObject Q_OBJECT public: - QDBusMenuConnection(QObject *parent = 0); + QDBusMenuConnection(QObject *parent = 0, const QString &serviceName = QString()); QDBusConnection connection() const { return m_connection; } bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; } #ifndef QT_NO_SYSTEMTRAYICON diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/dbustray/qdbustrayicon.cpp index 7dbdb3a35b..4d6e70720d 100644 --- a/src/platformsupport/dbustray/qdbustrayicon.cpp +++ b/src/platformsupport/dbustray/qdbustrayicon.cpp @@ -165,7 +165,7 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon) QDBusMenuConnection * QDBusTrayIcon::dBusConnection() { if (!m_dbusConnection) { - m_dbusConnection = new QDBusMenuConnection(this); + m_dbusConnection = new QDBusMenuConnection(this, m_instanceId); m_notifier = new QXdgNotificationInterface(XdgNotificationService, XdgNotificationPath, m_dbusConnection->connection(), this); connect(m_notifier, SIGNAL(NotificationClosed(uint,uint)), this, SLOT(notificationClosed(uint,uint))); diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h index 81fdab8901..aa79a0a42c 100644 --- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h +++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h @@ -45,9 +45,9 @@ // We mean it. // -#include <EGL/egl.h> #include <qpa/qplatformoffscreensurface.h> #include <QtPlatformSupport/private/qeglplatformcontext_p.h> +#include <EGL/egl.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index 48d79d37ee..62245a118b 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -35,7 +35,6 @@ #include "platformdefs.h" #include <QtCore/qmutex.h> -#include <QtCore/private/qmutexpool_p.h> #include <QtCore/qlibrary.h> #include <QtNetwork/private/qbearerplugin_p.h> @@ -46,42 +45,32 @@ QT_BEGIN_NAMESPACE -static void resolveLibrary() +static bool resolveLibraryInternal() { - static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false); - - if (!triedResolve.loadAcquire()) { -#ifndef QT_NO_THREAD - QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle)); -#endif - - if (!triedResolve.load()) { - QLibrary wlanapiLib(QLatin1String("wlanapi")); - local_WlanOpenHandle = (WlanOpenHandleProto) - wlanapiLib.resolve("WlanOpenHandle"); - local_WlanRegisterNotification = (WlanRegisterNotificationProto) - wlanapiLib.resolve("WlanRegisterNotification"); - local_WlanEnumInterfaces = (WlanEnumInterfacesProto) - wlanapiLib.resolve("WlanEnumInterfaces"); - local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto) - wlanapiLib.resolve("WlanGetAvailableNetworkList"); - local_WlanQueryInterface = (WlanQueryInterfaceProto) - wlanapiLib.resolve("WlanQueryInterface"); - local_WlanConnect = (WlanConnectProto) - wlanapiLib.resolve("WlanConnect"); - local_WlanDisconnect = (WlanDisconnectProto) - wlanapiLib.resolve("WlanDisconnect"); - local_WlanScan = (WlanScanProto) - wlanapiLib.resolve("WlanScan"); - local_WlanFreeMemory = (WlanFreeMemoryProto) - wlanapiLib.resolve("WlanFreeMemory"); - local_WlanCloseHandle = (WlanCloseHandleProto) - wlanapiLib.resolve("WlanCloseHandle"); - - triedResolve.storeRelease(true); - } - } + QLibrary wlanapiLib(QLatin1String("wlanapi")); + local_WlanOpenHandle = (WlanOpenHandleProto) + wlanapiLib.resolve("WlanOpenHandle"); + local_WlanRegisterNotification = (WlanRegisterNotificationProto) + wlanapiLib.resolve("WlanRegisterNotification"); + local_WlanEnumInterfaces = (WlanEnumInterfacesProto) + wlanapiLib.resolve("WlanEnumInterfaces"); + local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto) + wlanapiLib.resolve("WlanGetAvailableNetworkList"); + local_WlanQueryInterface = (WlanQueryInterfaceProto) + wlanapiLib.resolve("WlanQueryInterface"); + local_WlanConnect = (WlanConnectProto) + wlanapiLib.resolve("WlanConnect"); + local_WlanDisconnect = (WlanDisconnectProto) + wlanapiLib.resolve("WlanDisconnect"); + local_WlanScan = (WlanScanProto) + wlanapiLib.resolve("WlanScan"); + local_WlanFreeMemory = (WlanFreeMemoryProto) + wlanapiLib.resolve("WlanFreeMemory"); + local_WlanCloseHandle = (WlanCloseHandleProto) + wlanapiLib.resolve("WlanCloseHandle"); + return true; } +Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal())) class QNativeWifiEnginePlugin : public QBearerEnginePlugin { diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 8843e009a2..ed17ef8fe9 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -52,7 +52,7 @@ static NSButton *macCreateButton(const char *text, NSView *superview) [button setButtonType:NSMomentaryLightButton]; [button setBezelStyle:NSRoundedBezelStyle]; [button setTitle:(NSString*)(CFStringRef)QCFString( - qt_mac_removeMnemonics(QCoreApplication::translate("QDialogButtonBox", text)))]; + qt_mac_removeMnemonics(QCoreApplication::translate("QPlatformTheme", text)))]; [[button cell] setFont:[NSFont systemFontOfSize: [NSFont systemFontSizeForControlSize:NSRegularControlSize]]]; [superview addSubview:button]; diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp index db35338423..bb638091f7 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp @@ -31,6 +31,7 @@ ** ****************************************************************************/ +#include "qeglfsglobal.h" #include <QtGui/QSurface> #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtPlatformSupport/private/qeglpbuffer_p.h> diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/qeglfscontext.h index 906d11b3d1..8da4c731b8 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.h +++ b/src/plugins/platforms/eglfs/qeglfscontext.h @@ -34,9 +34,9 @@ #ifndef QEGLFSCONTEXT_H #define QEGLFSCONTEXT_H +#include "qeglfsglobal.h" #include <QtPlatformSupport/private/qeglplatformcontext_p.h> #include <QtCore/QVariant> -#include "qeglfsglobal.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h index 5ec98b37d1..303810eb6e 100644 --- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h @@ -45,13 +45,12 @@ // We mean it. // +#include "qeglfsglobal.h" #include <qpa/qplatformintegration.h> #include <qpa/qplatformscreen.h> #include <QtCore/QString> #include <QtGui/QSurfaceFormat> #include <QtGui/QImage> -#include <EGL/egl.h> -#include "qeglfsglobal.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsglobal.h b/src/plugins/platforms/eglfs/qeglfsglobal.h index 9109f6be38..e5804aea37 100644 --- a/src/plugins/platforms/eglfs/qeglfsglobal.h +++ b/src/plugins/platforms/eglfs/qeglfsglobal.h @@ -42,4 +42,17 @@ #define Q_EGLFS_EXPORT Q_DECL_IMPORT #endif +#include <EGL/egl.h> +#undef Status +#undef None +#undef Bool +#undef CursorShape +#undef KeyPress +#undef KeyRelease +#undef FocusIn +#undef FocusOut +#undef FontChange +#undef Expose +#undef Unsorted + #endif diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h index 3e4143918e..5f19d492f8 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks.h +++ b/src/plugins/platforms/eglfs/qeglfshooks.h @@ -34,8 +34,8 @@ #ifndef QEGLFSHOOKS_H #define QEGLFSHOOKS_H -#include "qeglfsdeviceintegration.h" #include "qeglfsglobal.h" +#include "qeglfsdeviceintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 35b27cba0b..c226c0134a 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -79,8 +79,6 @@ #include <QtPlatformHeaders/qeglfsfunctions.h> -#include <EGL/egl.h> - static void initResources() { #ifndef QT_NO_CURSOR diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 98c7ee9f78..2edb287b1e 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -34,12 +34,11 @@ #ifndef QEGLFSINTEGRATION_H #define QEGLFSINTEGRATION_H +#include "qeglfsglobal.h" #include <QtCore/QVariant> #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformscreen.h> -#include <EGL/egl.h> -#include "qeglfsglobal.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h index 9b8eaacd51..f20055b4e7 100644 --- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h +++ b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h @@ -34,9 +34,8 @@ #ifndef QEGLFSOFFSCREENWINDOW_H #define QEGLFSOFFSCREENWINDOW_H -#include <EGL/egl.h> -#include <qpa/qplatformoffscreensurface.h> #include "qeglfsglobal.h" +#include <qpa/qplatformoffscreensurface.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index 8f1d87ea25..ea669bd5bc 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -36,7 +36,6 @@ #include "qeglfsglobal.h" #include <QtCore/QPointer> -#include <EGL/egl.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h index 806b21de0a..2c396e8ef4 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -34,13 +34,12 @@ #ifndef QEGLFSWINDOW_H #define QEGLFSWINDOW_H +#include "qeglfsglobal.h" #include "qeglfsintegration.h" #include "qeglfsscreen.h" -#include "qeglfsglobal.h" #include <qpa/qplatformwindow.h> #include <QtPlatformSupport/private/qopenglcompositor_p.h> -#include <EGL/egl.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 6fa5dfa483..f93e420bcf 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -829,7 +829,7 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event) DEBUG("xdndHandleStatus"); waiting_for_status = false; // ignore late status messages - if (event->data.data32[0] && event->data.data32[0] != current_proxy_target) + if (event->data.data32[0] && event->data.data32[0] != current_target) return; const bool dropPossible = event->data.data32[1]; diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index eeac561870..7fea0688cc 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -111,17 +111,18 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa QString atomName = mimeAtomToString(connection, a); if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { *data = QInternalMimeData::renderDataHelper(atomName, mimeData); - if (atomName == QLatin1String("application/x-color")) + // mimeAtomToString() converts "text/x-moz-url" to "text/uri-list", + // so QXcbConnection::atomName() has to be used. + if (atomName == QLatin1String("text/uri-list") + && connection->atomName(a) == "text/x-moz-url") { + const QByteArray uri = data->split('\n').first(); + QString mozUri = QString::fromLatin1(uri, uri.size()); + mozUri += QLatin1Char('\n'); + *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), + mozUri.length() * 2); + } else if (atomName == QLatin1String("application/x-color")) *dataFormat = 16; ret = true; - } else if (atomName == QLatin1String("text/x-moz-url") && - QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { - QByteArray uri = QInternalMimeData::renderDataHelper( - QLatin1String("text/uri-list"), mimeData).split('\n').first(); - QString mozUri = QString::fromLatin1(uri, uri.size()); - mozUri += QLatin1Char('\n'); - *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); - ret = true; } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) { ret = true; } @@ -182,17 +183,37 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, a == connection->atom(QXcbAtom::TEXT)) return QString::fromLatin1(data); } - - // special case for uri types - if (format == QLatin1String("text/uri-list")) { - if (atomName == QLatin1String("text/x-moz-url")) { - // we expect this as utf16 <url><space><title> - // the first part is a url that should only contain ascci char - // so it should be safe to check that the second char is 0 - // to verify that it is utf16 - if (data.size() > 1 && data.at(1) == 0) - return QString::fromRawData((const QChar *)data.constData(), - data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); + // If data contains UTF16 text, convert it to a string. + // Firefox uses UTF16 without BOM for text/x-moz-url, "text/html", + // Google Chrome uses UTF16 without BOM for "text/x-moz-url", + // UTF16 with BOM for "text/html". + if ((format == QLatin1String("text/html") || format == QLatin1String("text/uri-list")) + && data.size() > 1) { + const quint8 byte0 = data.at(0); + const quint8 byte1 = data.at(1); + if ((byte0 == 0xff && byte1 == 0xfe) || (byte0 == 0xfe && byte1 == 0xff) + || (byte0 != 0 && byte1 == 0) || (byte0 == 0 && byte1 != 0)) { + const QString str = QString::fromUtf16( + reinterpret_cast<const ushort *>(data.constData()), data.size() / 2); + if (!str.isNull()) { + if (format == QLatin1String("text/uri-list")) { + const QStringList urls = str.split(QLatin1Char('\n')); + QList<QVariant> list; + foreach (const QString &s, urls) { + const QUrl url(s.trimmed()); + if (url.isValid()) + list.append(url); + } + // We expect "text/x-moz-url" as <url><space><title>. + // The atomName variable is not used because mimeAtomToString() + // converts "text/x-moz-url" to "text/uri-list". + if (!list.isEmpty() && connection->atomName(a) == "text/x-moz-url") + return list.first(); + return list; + } else { + return str; + } + } } } diff --git a/src/src.pro b/src/src.pro index 8c18c8d524..ed752c3276 100644 --- a/src/src.pro +++ b/src/src.pro @@ -145,7 +145,8 @@ TOOLS = src_tools_moc src_tools_rcc src_tools_qlalr win32:SUBDIRS += src_winmain SUBDIRS += src_network src_sql src_xml src_testlib contains(QT_CONFIG, dbus) { - force_bootstrap: SUBDIRS += src_tools_bootstrap_dbus + force_bootstrap|contains(QT_CONFIG, private_tests): \ + SUBDIRS += src_tools_bootstrap_dbus SUBDIRS += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml TOOLS += src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml contains(QT_CONFIG, accessibility-atspi-bridge): \ diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index a2a1a958cf..bfe61d0895 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE static QByteArray cleaned(const QByteArray &input) { QByteArray result; - result.reserve(input.size()); + result.resize(input.size()); const char *data = input.constData(); const char *end = input.constData() + input.size(); char *output = result.data(); @@ -78,13 +78,15 @@ static QByteArray cleaned(const QByteArray &input) if (data != end && (*(data + 1) == '\n' || (*data) == '\r')) { ++newlines; data += 1; - if (*data != '\r') + if (data != end && *data != '\r') data += 1; continue; } } else if (*data == '\r' && *(data + 1) == '\n') { // reduce \r\n to \n ++data; } + if (data == end) + break; char ch = *data; if (ch == '\r') // os9: replace \r with \n diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 9a8bfc552d..6a1135920d 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -168,8 +168,6 @@ private: namespace { -struct QWellArrayData; - class QWellArray : public QWidget { Q_OBJECT @@ -189,8 +187,6 @@ public: QSize sizeHint() const Q_DECL_OVERRIDE; - virtual void setCellBrush(int row, int col, const QBrush &); - inline int cellWidth() const { return cellw; } @@ -257,7 +253,6 @@ private: int curCol; int selRow; int selCol; - QWellArrayData *d; }; void QWellArray::paintEvent(QPaintEvent *e) @@ -307,15 +302,10 @@ void QWellArray::paintEvent(QPaintEvent *e) } } -struct QWellArrayData { - QBrush *brush; -}; - QWellArray::QWellArray(int rows, int cols, QWidget *parent) : QWidget(parent) ,nrows(rows), ncols(cols) { - d = 0; setFocusPolicy(Qt::StrongFocus); cellw = 28; cellh = 24; @@ -364,14 +354,12 @@ void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect) */ void QWellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r) { - if (d) { - p->fillRect(r, d->brush[row*numCols()+col]); - } else { - p->fillRect(r, Qt::white); - p->setPen(Qt::black); - p->drawLine(r.topLeft(), r.bottomRight()); - p->drawLine(r.topRight(), r.bottomLeft()); - } + Q_UNUSED(row); + Q_UNUSED(col); + p->fillRect(r, Qt::white); + p->setPen(Qt::black); + p->drawLine(r.topLeft(), r.bottomRight()); + p->drawLine(r.topRight(), r.bottomLeft()); } void QWellArray::mousePressEvent(QMouseEvent *e) @@ -447,17 +435,6 @@ void QWellArray::focusInEvent(QFocusEvent*) emit currentChanged(curRow, curCol); } -void QWellArray::setCellBrush(int row, int col, const QBrush &b) -{ - if (!d) { - d = new QWellArrayData; - int i = numRows()*numCols(); - d->brush = new QBrush[i]; - } - if (row >= 0 && row < numRows() && col >= 0 && col < numCols()) - d->brush[row*numCols()+col] = b; -} - /*!\reimp */ diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 48334cd169..0376ab88ac 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12346,6 +12346,53 @@ static inline bool canMapPosition(QWindow *window) return window->handle() && !qt_window_private(window)->resizeEventPending; } +#ifndef QT_NO_GRAPHICSVIEW +static inline QGraphicsProxyWidget *graphicsProxyWidget(const QWidget *w) +{ + QGraphicsProxyWidget *result = Q_NULLPTR; + const QWidgetPrivate *d = qt_widget_private(const_cast<QWidget *>(w)); + if (d->extra) + result = d->extra->proxyWidget; + return result; +} +#endif // !QT_NO_GRAPHICSVIEW + +struct MapToGlobalTransformResult { + QTransform transform; + QWindow *window; +}; + +static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w) +{ + MapToGlobalTransformResult result; + result.window = Q_NULLPTR; + for ( ; w ; w = w->parentWidget()) { +#ifndef QT_NO_GRAPHICSVIEW + if (QGraphicsProxyWidget *qgpw = graphicsProxyWidget(w)) { + if (const QGraphicsScene *scene = qgpw->scene()) { + const QList <QGraphicsView *> views = scene->views(); + if (!views.isEmpty()) { + result.transform *= qgpw->sceneTransform(); + result.transform *= views.first()->viewportTransform(); + w = views.first()->viewport(); + } + } + } +#endif // !QT_NO_GRAPHICSVIEW + QWindow *window = w->windowHandle(); + if (window && canMapPosition(window)) { + result.window = window; + break; + } + + const QPoint topLeft = w->geometry().topLeft(); + result.transform.translate(topLeft.x(), topLeft.y()); + if (w->isWindow()) + break; + } + return result; +} + /*! \fn QPoint QWidget::mapToGlobal(const QPoint &pos) const @@ -12357,29 +12404,9 @@ static inline bool canMapPosition(QWindow *window) */ QPoint QWidget::mapToGlobal(const QPoint &pos) const { -#ifndef QT_NO_GRAPHICSVIEW - Q_D(const QWidget); - if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { - const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views(); - if (!views.isEmpty()) { - const QPointF scenePos = d->extra->proxyWidget->mapToScene(pos); - const QPoint viewPortPos = views.first()->mapFromScene(scenePos); - return views.first()->viewport()->mapToGlobal(viewPortPos); - } - } -#endif // !QT_NO_GRAPHICSVIEW - int x = pos.x(), y = pos.y(); - const QWidget *w = this; - while (w) { - QWindow *window = w->windowHandle(); - if (window && canMapPosition(window)) - return window->mapToGlobal(QPoint(x, y)); - - x += w->data->crect.x(); - y += w->data->crect.y(); - w = w->isWindow() ? 0 : w->parentWidget(); - } - return QPoint(x, y); + const MapToGlobalTransformResult t = mapToGlobalTransform(this); + const QPoint g = t.transform.map(pos); + return t.window ? t.window->mapToGlobal(g) : g; } /*! @@ -12392,29 +12419,9 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const */ QPoint QWidget::mapFromGlobal(const QPoint &pos) const { -#ifndef QT_NO_GRAPHICSVIEW - Q_D(const QWidget); - if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { - const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views(); - if (!views.isEmpty()) { - const QPoint viewPortPos = views.first()->viewport()->mapFromGlobal(pos); - const QPointF scenePos = views.first()->mapToScene(viewPortPos); - return d->extra->proxyWidget->mapFromScene(scenePos).toPoint(); - } - } -#endif // !QT_NO_GRAPHICSVIEW - int x = pos.x(), y = pos.y(); - const QWidget *w = this; - while (w) { - QWindow *window = w->windowHandle(); - if (window && canMapPosition(window)) - return window->mapFromGlobal(QPoint(x, y)); - - x -= w->data->crect.x(); - y -= w->data->crect.y(); - w = w->isWindow() ? 0 : w->parentWidget(); - } - return QPoint(x, y); + const MapToGlobalTransformResult t = mapToGlobalTransform(this); + const QPoint windowLocal = t.window ? t.window->mapFromGlobal(pos) : pos; + return t.transform.inverted().map(windowLocal); } QWidget *qt_pressGrab = 0; diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 6b32665065..2cad5d325c 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -2176,7 +2176,6 @@ void QLineEdit::changeEvent(QEvent *ev) d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this)); d->control->setPasswordMaskDelay(style()->styleHint(QStyle::SH_LineEdit_PasswordMaskDelay, &opt, this)); } - d->m_iconSize = QSize(); update(); break; case QEvent::LayoutDirectionChange: diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index ff80c45c9a..b90ddacb7e 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -314,6 +314,12 @@ QLineEditIconButton::QLineEditIconButton(QWidget *parent) setFocusPolicy(Qt::NoFocus); } +QLineEditPrivate *QLineEditIconButton::lineEditPrivate() const +{ + QLineEdit *le = qobject_cast<QLineEdit *>(parentWidget()); + return le ? static_cast<QLineEditPrivate *>(qt_widget_private(le)) : Q_NULLPTR; +} + void QLineEditIconButton::paintEvent(QPaintEvent *) { QPainter painter(this); @@ -325,7 +331,9 @@ void QLineEditIconButton::paintEvent(QPaintEvent *) QIcon::Mode state = QIcon::Disabled; if (isEnabled()) state = isDown() ? QIcon::Selected : QIcon::Normal; - const QSize iconSize(IconButtonSize, IconButtonSize); + const QLineEditPrivate *lep = lineEditPrivate(); + const int iconWidth = lep ? lep->sideWidgetParameters().iconSize : 16; + const QSize iconSize(iconWidth, iconWidth); const QPixmap iconPixmap = icon().pixmap(window, iconSize, state, QIcon::Off); QRect pixmapRect = QRect(QPoint(0, 0), iconSize); pixmapRect.moveCenter(rect().center()); @@ -340,8 +348,8 @@ void QLineEditIconButton::actionEvent(QActionEvent *e) const QAction *action = e->action(); if (isVisibleTo(parentWidget()) != action->isVisible()) { setVisible(action->isVisible()); - if (QLineEdit *le = qobject_cast<QLineEdit *>(parentWidget())) - static_cast<QLineEditPrivate *>(qt_widget_private(le))->positionSideWidgets(); + if (QLineEditPrivate *lep = lineEditPrivate()) + lep->positionSideWidgets(); } } break; @@ -407,11 +415,15 @@ void QLineEditPrivate::_q_clearButtonClicked() } } -QSize QLineEditPrivate::iconSize() const +QLineEditPrivate::SideWidgetParameters QLineEditPrivate::sideWidgetParameters() const { - if (!m_iconSize.isValid()) // This might require style-specific handling (pixel metric). - m_iconSize = QSize(QLineEditIconButton::IconButtonSize + 6, QLineEditIconButton::IconButtonSize + 2); - return m_iconSize; + Q_Q(const QLineEdit); + SideWidgetParameters result; + result.iconSize = q->height() < 34 ? 16 : 32; + result.margin = result.iconSize / 4; + result.widgetWidth = result.iconSize + 6; + result.widgetHeight = result.iconSize + 2; + return result; } QIcon QLineEditPrivate::clearButtonIcon() const @@ -437,15 +449,16 @@ void QLineEditPrivate::positionSideWidgets() Q_Q(QLineEdit); if (hasSideWidgets()) { const QRect contentRect = q->rect(); - const QSize iconSize = QLineEditPrivate::iconSize(); - const int delta = QLineEditIconButton::IconMargin + iconSize.width(); - QRect widgetGeometry(QPoint(QLineEditIconButton::IconMargin, (contentRect.height() - iconSize.height()) / 2), iconSize); + const SideWidgetParameters p = sideWidgetParameters(); + const int delta = p.margin + p.widgetWidth; + QRect widgetGeometry(QPoint(p.margin, (contentRect.height() - p.widgetHeight) / 2), + QSize(p.widgetWidth, p.widgetHeight)); foreach (const SideWidgetEntry &e, leftSideWidgetList()) { e.widget->setGeometry(widgetGeometry); if (e.action->isVisible()) widgetGeometry.moveLeft(widgetGeometry.left() + delta); } - widgetGeometry.moveLeft(contentRect.width() - iconSize.width() - QLineEditIconButton::IconMargin); + widgetGeometry.moveLeft(contentRect.width() - p.widgetWidth - p.margin); foreach (const SideWidgetEntry &e, rightSideWidgetList()) { e.widget->setGeometry(widgetGeometry); if (e.action->isVisible()) diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 60372ab393..1d81090b0f 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -65,6 +65,8 @@ QT_BEGIN_NAMESPACE +class QLineEditPrivate; + // QLineEditIconButton: This is a simple helper class that represents clickable icons that fade in with text class Q_AUTOTEST_EXPORT QLineEditIconButton : public QToolButton @@ -72,8 +74,6 @@ class Q_AUTOTEST_EXPORT QLineEditIconButton : public QToolButton Q_OBJECT Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) public: - enum { IconMargin = 4, IconButtonSize = 16 }; - explicit QLineEditIconButton(QWidget *parent = 0); qreal opacity() const { return m_opacity; } @@ -93,6 +93,7 @@ private: #ifndef QT_NO_ANIMATION void startOpacityAnimation(qreal endValue); #endif + QLineEditPrivate *lineEditPrivate() const; qreal m_opacity; }; @@ -116,6 +117,13 @@ public: }; typedef QVector<SideWidgetEntry> SideWidgetEntryList; + struct SideWidgetParameters { + int iconSize; + int widgetWidth; + int widgetHeight; + int margin; + }; + QLineEditPrivate() : control(0), frame(1), contextMenuEnabled(1), cursorVisible(0), dragEnabled(0), clickCausedFocus(0), hscroll(0), vscroll(0), @@ -206,7 +214,7 @@ public: QWidget *addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition, int flags = 0); void removeAction(QAction *action); - QSize iconSize() const; + SideWidgetParameters sideWidgetParameters() const; QIcon clearButtonIcon() const; void setClearButtonEnabled(bool enabled); void positionSideWidgets(); @@ -227,7 +235,6 @@ private: SideWidgetEntryList leadingSideWidgets; SideWidgetEntryList trailingSideWidgets; int lastTextSize; - mutable QSize m_iconSize; }; Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE); @@ -238,18 +245,29 @@ static bool isSideWidgetVisible(const QLineEditPrivate::SideWidgetEntry &e) inline int QLineEditPrivate::effectiveLeftTextMargin() const { - return leftTextMargin + (QLineEditIconButton::IconMargin + iconSize().width()) - * int(std::count_if(leftSideWidgetList().constBegin(), leftSideWidgetList().constEnd(), - isSideWidgetVisible)); + int result = leftTextMargin; + if (!leftSideWidgetList().isEmpty()) { + const SideWidgetParameters p = sideWidgetParameters(); + result += (p.margin + p.widgetWidth) + * int(std::count_if(leftSideWidgetList().constBegin(), leftSideWidgetList().constEnd(), + isSideWidgetVisible)); + } + return result; } inline int QLineEditPrivate::effectiveRightTextMargin() const { - return rightTextMargin + (QLineEditIconButton::IconMargin + iconSize().width()) - * int(std::count_if(rightSideWidgetList().constBegin(), rightSideWidgetList().constEnd(), - isSideWidgetVisible)); + int result = rightTextMargin; + if (!rightSideWidgetList().isEmpty()) { + const SideWidgetParameters p = sideWidgetParameters(); + result += (p.margin + p.widgetWidth) + * int(std::count_if(rightSideWidgetList().constBegin(), rightSideWidgetList().constEnd(), + isSideWidgetVisible)); + } + return result; } + #endif // QT_NO_LINEEDIT QT_END_NAMESPACE diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index cca0853a8f..3f42a07f39 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -706,7 +706,6 @@ void QMenuBarPrivate::init() } #endif q->setBackgroundRole(QPalette::Button); - oldWindow = oldParent = 0; handleReparent(); q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); @@ -1330,30 +1329,41 @@ void QMenuBarPrivate::handleReparent() { Q_Q(QMenuBar); QWidget *newParent = q->parentWidget(); - //Note: if parent is reparented, then window may change even if parent doesn't - // we need to install an event filter on parent, and remove the old one - - if (oldParent != newParent) { - if (oldParent) - oldParent->removeEventFilter(q); - if (newParent) - newParent->installEventFilter(q); + //Note: if parent is reparented, then window may change even if parent doesn't. + // We need to install an avent filter on each parent up to the parent that is + // also a window (for shortcuts) + QWidget *newWindow = newParent ? newParent->window() : Q_NULLPTR; + + QVector<QPointer<QWidget> > newParents; + // Remove event filters on ex-parents, keep them on still-parents + // The parents are always ordered in the vector + foreach (const QPointer<QWidget> &w, oldParents) { + if (w) { + if (newParent == w) { + newParents.append(w); + if (newParent != newWindow) //stop at the window + newParent = newParent->parentWidget(); + } else { + w->removeEventFilter(q); + } + } } - //we also need event filter on top-level (for shortcuts) - QWidget *newWindow = newParent ? newParent->window() : 0; - - if (oldWindow != newWindow) { - if (oldParent && oldParent != oldWindow) - oldWindow->removeEventFilter(q); - - if (newParent && newParent != newWindow) - newWindow->installEventFilter(q); + // At this point, newParent is the next one to be added to newParents + while (newParent && newParent != newWindow) { + //install event filters all the way up to (excluding) the window + newParents.append(newParent); + newParent->installEventFilter(q); + newParent = newParent->parentWidget(); } - oldParent = newParent; - oldWindow = newWindow; + if (newParent && newWindow) { + // Install the event filter on the window + newParents.append(newParent); + newParent->installEventFilter(q); + } + oldParents = newParents; if (platformMenuBar) { if (newWindow) { @@ -1465,10 +1475,9 @@ bool QMenuBar::event(QEvent *e) bool QMenuBar::eventFilter(QObject *object, QEvent *event) { Q_D(QMenuBar); - if (object == parent() && object) { - if (event->type() == QEvent::ParentChange) //GrandparentChange + if (object && (event->type() == QEvent::ParentChange)) //GrandparentChange d->handleReparent(); - } + if (object == d->leftWidget || object == d->rightWidget) { switch (event->type()) { case QEvent::ShowToParent: diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index ee615e71f3..7ef696f50e 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -128,8 +128,7 @@ public: // reparenting void handleReparent(); - QWidget *oldParent; - QWidget *oldWindow; + QVector<QPointer<QWidget> > oldParents; QList<QAction*> hiddenActions; //default action diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index e8c9ace03b..52728a9149 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -8,7 +8,7 @@ DESTDIR = $$QT.core.libs CONFIG += static QT = core -contains(QT_CONFIG, build_all):CONFIG += build_all +contains(QT_CONFIG, debug_and_release): CONFIG += build_all win32-msvc*:QMAKE_CFLAGS_DEBUG -= -Zi win32-msvc*:QMAKE_CXXFLAGS_DEBUG -= -Zi diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index 1afcf05135..004ace4e2e 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -32,14 +32,18 @@ ****************************************************************************/ #include <QtTest/QtTest> - #include <QStorageInfo> +#include <stdarg.h> + +#include "../../../../manual/qstorageinfo/printvolumes.cpp" + class tst_QStorageInfo : public QObject { Q_OBJECT private slots: void defaultValues(); + void dump(); void operatorEqual(); #ifndef Q_OS_WINRT void operatorNotEqual(); @@ -66,6 +70,33 @@ void tst_QStorageInfo::defaultValues() QVERIFY(storage.bytesAvailable() == -1); } +static int qInfoPrinter(const char *format, ...) +{ + static char buf[1024]; + static size_t bufuse = 0; + + va_list ap; + va_start(ap, format); // use variable arg list + int n = qvsnprintf(buf + bufuse, sizeof(buf) - bufuse, format, ap); + va_end(ap); + + bufuse += n; + if (bufuse >= sizeof(buf) - 1 || format[strlen(format) - 1] == '\n') { + // flush + QtMessageHandler qt_message_print = qInstallMessageHandler(0); + qInstallMessageHandler(qt_message_print); // restore the handler + qt_message_print(QtInfoMsg, QMessageLogContext(), QString::fromLocal8Bit(buf)); + bufuse = 0; + } + + return 1; +} + +void tst_QStorageInfo::dump() +{ + printVolumes(QStorageInfo::mountedVolumes(), qInfoPrinter); +} + void tst_QStorageInfo::operatorEqual() { { diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index f2f3baae6b..76230ccec8 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -4629,6 +4629,16 @@ template<typename Enum> void testVariant(Enum value, bool *ok) QVERIFY(var2.convert(QMetaType::Int)); QCOMPARE(var2.value<int>(), static_cast<int>(value)); + if (static_cast<qint64>(value) <= INT_MAX) { + int intValue = static_cast<int>(value); + QVariant intVar = intValue; + QVERIFY(intVar.canConvert<Enum>()); + QCOMPARE(intVar.value<Enum>(), value); + } + qint64 longValue = static_cast<qint64>(value); + QVERIFY(QVariant(longValue).canConvert<Enum>()); + QCOMPARE(QVariant(longValue).value<Enum>(), value); + *ok = true; } diff --git a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp index 026a2a2722..90a6aa5811 100644 --- a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp +++ b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp @@ -52,6 +52,8 @@ private Q_SLOTS: void ntlmAuth_data(); void ntlmAuth(); + + void equalityOperators(); }; tst_QAuthenticator::tst_QAuthenticator() @@ -152,6 +154,20 @@ void tst_QAuthenticator::ntlmAuth() QVERIFY(priv->calculateResponse("GET", "/").startsWith("NTLM ")); } +void tst_QAuthenticator::equalityOperators() +{ + QAuthenticator s1, s2; + QVERIFY(s2 == s1); + QVERIFY(s1 == s2); + QVERIFY(!(s1 != s2)); + QVERIFY(!(s2 != s1)); + s1.setUser("User"); + QVERIFY(!(s2 == s1)); + QVERIFY(!(s1 == s2)); + QVERIFY(s1 != s2); + QVERIFY(s2 != s1); +} + QTEST_MAIN(tst_QAuthenticator); #include "tst_qauthenticator.moc" diff --git a/tests/auto/network/socket/qudpsocket/BLACKLIST b/tests/auto/network/socket/qudpsocket/BLACKLIST index fb8455e6d3..3e936aebf6 100644 --- a/tests/auto/network/socket/qudpsocket/BLACKLIST +++ b/tests/auto/network/socket/qudpsocket/BLACKLIST @@ -6,15 +6,3 @@ osx osx [multicast:same bind, group ipv4 address] osx -[writeDatagramToNonExistingPeer] -windows -[asyncReadDatagram] -windows -[multicastLeaveAfterClose] -osx -[readyRead] -osx -[readyReadForEmptyDatagram] -osx -[asyncReadDatagram] -osx diff --git a/tests/auto/network/socket/qudpsocket/test/test.pro b/tests/auto/network/socket/qudpsocket/test/test.pro index e4812416dc..8ad16c652d 100644 --- a/tests/auto/network/socket/qudpsocket/test/test.pro +++ b/tests/auto/network/socket/qudpsocket/test/test.pro @@ -22,3 +22,5 @@ wince* { } TARGET = tst_qudpsocket + +CONFIG+=insignificant_test # QTBUG-25367, QTBUG-25368 diff --git a/tests/auto/tools/moc/backslash-newlines.h b/tests/auto/tools/moc/backslash-newlines.h index fea3045eb1..764d8f87da 100644 --- a/tests/auto/tools/moc/backslash-newlines.h +++ b/tests/auto/tools/moc/backslash-newlines.h @@ -57,3 +57,5 @@ public slots: #undef value #endif // BACKSLASH_NEWLINES_H + +// ends with \\\r should not make moc crash (QTBUG-53441) (no new lines on purpose!!) \
\ No newline at end of file diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp index 796b4b9fdb..9aacd3105e 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp @@ -193,11 +193,14 @@ void tst_QFontDialog::task256466_wrongStyle() for (int i = 0; i < familyList->model()->rowCount(); ++i) { QModelIndex currentFamily = familyList->model()->index(i, 0); familyList->setCurrentIndex(currentFamily); + int expectedSize = sizeList->currentIndex().data().toInt(); const QFont current = dialog.currentFont(), expected = fdb.font(currentFamily.data().toString(), - styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt()); + styleList->currentIndex().data().toString(), expectedSize); QCOMPARE(current.family(), expected.family()); QCOMPARE(current.style(), expected.style()); + if (expectedSize == 0 && !QFontDatabase().isScalable(current.family(), current.styleName())) + QEXPECT_FAIL("", "QTBUG-53299: Smooth sizes for unscalable font contains unsupported size", Continue); QCOMPARE(current.pointSizeF(), expected.pointSizeF()); } } diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index d8a8ed6b4b..ea2599fcf9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -3682,16 +3682,19 @@ static QByteArray msgPointMismatch(const QPoint &actual, const QPoint &expected) void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135 { const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); - const QSize size = availableGeometry.size() / 5; + const QSize size = availableGeometry.size() / 4; QGraphicsScene scene; QGraphicsView view(&scene); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view.setTransform(QTransform::fromScale(2, 2)); // QTBUG-50136, use transform. view.setWindowTitle(QTest::currentTestFunction()); view.resize(size); view.move(availableGeometry.bottomRight() - QPoint(size.width(), size.height()) - QPoint(100, 100)); - QWidget *embeddedWidget = new QWidget; - embeddedWidget->setFixedSize(size / 2); - QWidget *childWidget = new QWidget(embeddedWidget); + QWidget *embeddedWidget = new QGroupBox(QLatin1String("Embedded")); + embeddedWidget->setStyleSheet(QLatin1String("background-color: \"yellow\"; ")); + embeddedWidget->setFixedSize((size - QSize(10, 10)) / 2); + QWidget *childWidget = new QGroupBox(QLatin1String("Child"), embeddedWidget); childWidget->setStyleSheet(QLatin1String("background-color: \"red\"; ")); childWidget->resize(embeddedWidget->size() / 2); childWidget->move(embeddedWidget->width() / 4, embeddedWidget->height() / 4); // center in embeddedWidget @@ -3705,18 +3708,16 @@ void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135 // This should be equivalent to the view center give or take rounding // errors due to odd window margins const QPoint viewCenter = view.geometry().center(); - QVERIFY2((viewCenter - embeddedCenterGlobal).manhattanLength() <= 2, + QVERIFY2((viewCenter - embeddedCenterGlobal).manhattanLength() <= 3, msgPointMismatch(embeddedCenterGlobal, viewCenter).constData()); - // Same test with child centered on embeddedWidget. The correct - // mapping is not implemented yet, but at least make sure + // Same test with child centered on embeddedWidget. Also make sure // the roundtrip maptoGlobal()/mapFromGlobal() returns the same // point since that is important for mouse event handling (QTBUG-50030, // QTBUG-50136). const QPoint childCenter = childWidget->rect().center(); const QPoint childCenterGlobal = childWidget->mapToGlobal(childCenter); QCOMPARE(childWidget->mapFromGlobal(childCenterGlobal), childCenter); - QEXPECT_FAIL("", "Not implemented for child widgets of embedded widgets", Continue); QVERIFY2((viewCenter - childCenterGlobal).manhattanLength() <= 4, msgPointMismatch(childCenterGlobal, viewCenter).constData()); } diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index f787d73a02..b2d15fffef 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -132,10 +132,12 @@ private slots: void closeOnSecondClickAndOpenOnThirdClick(); void cornerWidgets_data(); void cornerWidgets(); + void taskQTBUG53205_crashReparentNested(); protected slots: void onSimpleActivated( QAction*); void onComplexActionTriggered(); + void slotForTaskQTBUG53205(); private: TestMenu initSimpleMenuBar(QMenuBar *mb); @@ -148,6 +150,7 @@ private: QAction* m_lastSimpleAcceleratorId; int m_simpleActivatedCount; int m_complexTriggerCount[int('k')]; + QMenuBar* taskQTBUG53205MenuBar; }; // Testing get/set functions @@ -1438,5 +1441,61 @@ void tst_QMenuBar::cornerWidgets() delete cornerLabel; } + +void tst_QMenuBar::taskQTBUG53205_crashReparentNested() +{ + // This test was largely inspired by the test case submitted for the bug + QMainWindow mainWindow; + mainWindow.resize(300, 200); + centerOnScreen(&mainWindow); + const TestMenu testMenus = initWindowWithComplexMenuBar(mainWindow); + QApplication::setActiveWindow(&mainWindow); + + // they can't be windows + QWidget hiddenParent(&mainWindow, 0); + //this one is going to be moved around + QWidget movingParent(&hiddenParent, 0); + + //set up the container widget + QWidget containerWidget(&movingParent,0); + + //set the new parent, a window + QScopedPointer<QWidget> windowedParent; + windowedParent.reset(new QWidget(Q_NULLPTR, Qt::WindowFlags())); + windowedParent->setGeometry(400, 10, 300, 300); + + windowedParent->show(); + QVERIFY(QTest::qWaitForWindowExposed(windowedParent.data())); + + //set the "container", can't be a window + QWidget containedWidget(&containerWidget, 0); + + taskQTBUG53205MenuBar = new QMenuBar(&containedWidget); + + connect(testMenus.actions[0], &QAction::triggered, this, &tst_QMenuBar::slotForTaskQTBUG53205); + //now, move things around + //from : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar + //to windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar + movingParent.setParent(windowedParent.data(),0); + // this resets the parenting and the menu bar's window + taskQTBUG53205MenuBar->setParent(Q_NULLPTR); + taskQTBUG53205MenuBar->setParent(&containedWidget); + //from windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar + //to : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar + movingParent.setParent(&hiddenParent,0); + windowedParent.reset(); //make the old window invalid + // trigger the aciton, reset the menu bar's window, this used to crash here. + testMenus.actions[0]->trigger(); +} + +void tst_QMenuBar::slotForTaskQTBUG53205() +{ + QWidget *parent = taskQTBUG53205MenuBar->parentWidget(); + taskQTBUG53205MenuBar->setParent(Q_NULLPTR); + taskQTBUG53205MenuBar->setParent(parent); +} + + + QTEST_MAIN(tst_QMenuBar) #include "tst_qmenubar.moc" diff --git a/tests/manual/qstorageinfo/main.cpp b/tests/manual/qstorageinfo/main.cpp index 5c106ff45b..61cdd55922 100644 --- a/tests/manual/qstorageinfo/main.cpp +++ b/tests/manual/qstorageinfo/main.cpp @@ -32,10 +32,11 @@ ****************************************************************************/ #include <QtCore/QCoreApplication> -#include <QtCore/QStorageInfo> #include <stdio.h> +#include "printvolumes.cpp" + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -57,26 +58,7 @@ int main(int argc, char *argv[]) if (volumes.isEmpty()) volumes = QStorageInfo::mountedVolumes(); - // Sample output: - // Filesystem (Type) Size Available BSize Label Mounted on - // /dev/sda2 (ext4) RO 388480 171218 1024 /boot - // /dev/mapper/system-root (btrfs) RW - // 214958080 39088272 4096 / - // /dev/disk1s2 (hfs) RW 488050672 419909696 4096 Macintosh HD2 /Volumes/Macintosh HD2 - - printf("Filesystem (Type) Size Available BSize Label Mounted on\n"); - foreach (const QStorageInfo &info, volumes) { - QByteArray fsAndType = info.device(); - if (info.fileSystemType() != fsAndType) - fsAndType += " (" + info.fileSystemType() + ')'; - - printf("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W'); - if (fsAndType.size() > 19) - printf("\n%23s", ""); - - printf("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize()); - printf("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath())); - } + printVolumes(volumes, printf); return 0; } diff --git a/tests/manual/qstorageinfo/printvolumes.cpp b/tests/manual/qstorageinfo/printvolumes.cpp new file mode 100644 index 0000000000..1b1660b433 --- /dev/null +++ b/tests/manual/qstorageinfo/printvolumes.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Intel Corporation +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/QStorageInfo> + +void printVolumes(const QList<QStorageInfo> &volumes, int (*printer)(const char *, ...)) +{ + // Sample output: + // Filesystem (Type) Size Available BSize Label Mounted on + // /dev/sda2 (ext4) RO 388480 171218 1024 /boot + // /dev/mapper/system-root (btrfs) RW + // 214958080 39088272 4096 / + // /dev/disk1s2 (hfs) RW 488050672 419909696 4096 Macintosh HD2 /Volumes/Macintosh HD2 + + printf("Filesystem (Type) Size Available BSize Label Mounted on\n"); + foreach (const QStorageInfo &info, volumes) { + QByteArray fsAndType = info.device(); + if (info.fileSystemType() != fsAndType) + fsAndType += " (" + info.fileSystemType() + ')'; + + printf("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W'); + if (fsAndType.size() > 19) + printf("\n%23s", ""); + + printf("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize()); + printf("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath())); + } +} diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 3be0ea2b7c..a03be4df0a 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -264,6 +264,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "LIBJPEG" ] = "auto"; dictionary[ "LIBPNG" ] = "auto"; dictionary[ "FREETYPE" ] = "yes"; + dictionary[ "FREETYPE_FROM" ] = "default"; dictionary[ "HARFBUZZ" ] = "qt"; dictionary[ "ACCESSIBILITY" ] = "yes"; @@ -634,12 +635,16 @@ void Configure::parseCmdLine() } // Text Rendering -------------------------------------------- - else if (configCmdLine.at(i) == "-no-freetype") + else if (configCmdLine.at(i) == "-no-freetype") { dictionary[ "FREETYPE" ] = "no"; - else if (configCmdLine.at(i) == "-qt-freetype") + dictionary[ "FREETYPE_FROM" ] = "commandline"; + } else if (configCmdLine.at(i) == "-qt-freetype") { dictionary[ "FREETYPE" ] = "yes"; - else if (configCmdLine.at(i) == "-system-freetype") + dictionary[ "FREETYPE_FROM" ] = "commandline"; + } else if (configCmdLine.at(i) == "-system-freetype") { dictionary[ "FREETYPE" ] = "system"; + dictionary[ "FREETYPE_FROM" ] = "commandline"; + } else if (configCmdLine.at(i) == "-no-harfbuzz") dictionary[ "HARFBUZZ" ] = "no"; @@ -2588,6 +2593,9 @@ void Configure::autoDetection() if (dictionary["FONT_CONFIG"] == "auto") dictionary["FONT_CONFIG"] = checkAvailability("FONT_CONFIG") ? "yes" : "no"; + if ((dictionary["FONT_CONFIG"] == "yes") && (dictionary["FREETYPE_FROM"] == "default")) + dictionary["FREETYPE"] = "system"; + if (dictionary["DIRECTWRITE"] == "auto") dictionary["DIRECTWRITE"] = checkAvailability("DIRECTWRITE") ? "yes" : "no"; @@ -2717,6 +2725,22 @@ bool Configure::verifyConfiguration() } } + if ((dictionary["FONT_CONFIG"] == "yes") && (dictionary["FREETYPE_FROM"] == "commandline")) { + if (dictionary["FREETYPE"] == "yes") { + cout << "WARNING: Bundled FreeType can't be used." + " FontConfig use requires system FreeType." << endl; + dictionary["FREETYPE"] = "system"; + dictionary["FREETYPE_FROM"] = "override"; + prompt = true; + } else if (dictionary["FREETYPE"] == "no") { + cout << "WARNING: FreeType can't be disabled." + " FontConfig use requires system FreeType." << endl; + dictionary["FREETYPE"] = "system"; + dictionary["FREETYPE_FROM"] = "override"; + prompt = true; + } + } + if (prompt) promptKeyPress(); |