diff options
36 files changed, 608 insertions, 191 deletions
@@ -112,13 +112,6 @@ shellEscape() echo "$@" | sed 's/ /\ /g' } -shellQuoteLines() -{ - # The call of the outer echo makes the shell word-split the output of - # the nested pipe, thus effectively converting newlines to spaces. - echo `echo "$1" | sed 's,^[^ ]* .*$,"&",'` -} - makeabs() { local FILE="$1" @@ -6080,8 +6073,6 @@ host_build { QT_TARGET_ARCH = $CFG_ARCH } else { QT_ARCH = $CFG_ARCH - QMAKE_DEFAULT_LIBDIRS = `shellQuoteLines "$DEFAULT_LIBDIRS"` - QMAKE_DEFAULT_INCDIRS = `shellQuoteLines "$DEFAULT_INCDIRS"` } QT_CONFIG += $QT_CONFIG diff --git a/dist/changes-5.7.0 b/dist/changes-5.7.0 new file mode 100644 index 0000000000..acdf243f53 --- /dev/null +++ b/dist/changes-5.7.0 @@ -0,0 +1,395 @@ +Qt 5.7 introduces many new features and improvements along with bug fixes +over the 5.6.x series. Also, there is a change in the licensing terms. +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://doc.qt.io/qt-5.7 + +The Qt version 5.7 series is binary compatible with the 5.6.x series. +Applications compiled for 5.6 will continue to run with 5.7. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +This release contains all fixes included in the Qt 5.6.1 release. + +**************************************************************************** +* Important License Changes * +**************************************************************************** + + - Qt is no longer available under LGPLv2.1. The libraries in this package + are now available under the following licenses: + * Commercial License + * GNU General Public License v2.0 (LICENSE.GPL2) and later + * GNU Lesser General Public License v3.0 (LICENSE.LGPL3) + + Note that a few Qt Libraries (currently Qt Charts and Qt Data + Visualization) are available only under the Commercial License and GPL + version 3. + + - Qt Tools are now available under the following licenses: + * Commercial License + * GNU General Public License 3.0 (LICENSE.GPL3) with exceptions + described in the Qt Company GPL Exception 1.0 (LICENSE.GPL3-EXCEPT) + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - Starting with Qt 5.7, Qt requires a C++11 compiler with support for + C++11 atomics. This affects user code too: Qt headers no longer compile + with a C++98 compiler. The minimum compiler versions for this release + are: + * GCC 4.7 + * Clang 3.4 (found in XCode 5.1) + * Microsoft Visual Studio 2013 + - Support for the following platforms was removed in this version: + * Apple OS X 10.7 (Lion) + * Microsoft Windows XP + * Microsoft Windows Vista + * Microsoft Windows Embedded Compact 7 + * Microsoft Windows Embedded Compact 2013 + - Support for DirectFB is no longer enabled by default, due to lack of + development in upstream. To re-enable the platform plugin, pass the + -directfb option to configure. If there is no renewed interest in this + platform, the support will be removed in Qt 5.8. + - Qt no longer ships any fonts. + + - QtGui: + * [QTBUG-51962] When line height is specified in pixels, this is now + interpreted as the minimum line height rather than an absolute line + height to avoid overlaps. To get the old behavior, use the + -qt-line-height-type property in CSS and set it to "fixed". + * [QTBUG-46054] QFont::exactMatch() now returns false when the provided + typeface is an alias. + + - QtWidgets: + * [QTBUG-21217] QLineEdit will now accept certain shortcut override + events even if it is read-only. + + - configure & build system: + * Except on OS X, -system-harfbuzz is now the default. + * A few obsolete options with no effect are not recognized any more. + +**************************************************************************** +* Deprecation Notice * +**************************************************************************** + + - The following platforms or toolchains are deprecated and will be + removed as of Qt 5.8: + * Apple OS X 10.8 (Mountain Lion) + + Deprecated platforms and toolchains continue to work until removed. + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - [QTBUG-50548] Added qAsConst(). + - Added qOverload() to select overloaded functions. + - Added qHash(std::pair), defined in <QHashFunctions>. + - Added qUtf16Printable(). + - QLocale data updated to CLDR v29 + + - QDataStream: + * [QTBUG-44418] Added startTransaction(), commitTransaction(), + rollbackTransaction(), abortTransaction() functions to support read + transactions. + + - QDebug: + * QDebug can now output std::vector, std::list, std::map, and + std::multimap. + + - QFlags: + * [QTBUG-27100] Added setFlag method to set or unset a flag + + - QHash/QSet: + * Added QHash::equal_range(). + * Added erase(const_iterator). + + - QIODevice: + * Added support for devices with multiple streams. + * [QTBUG-44418] Added startTransaction(), commitTransaction(), + rollbackTransaction(), isTransactionStarted() functions to support + read transactions. + + - QJsonObject: + * Added value(), op[] const, find(), constFind(), contains() overloads + taking QLatin1String. + + - QLocale: + * Added special value for double conversion precision to get shortest + accurate representation. + * Added additional flags in QLocale::NumberOption that allow generating + and parsing doubles in EcmaScript compliant format. + * [QTBUG-46595] Added an overload for toCurrencyString() that allows the + decimal precision to be specified. + + - QMutex: + * Made the isRecursive() method be a const function so that it can be + called in const QMutex objects too. + + - QObject: + * [QTBUG-52542] If the compiler supports variadic templates, functors + connected to signals will not be copied any more each time the signal is + emitted. This is the behavior that was exhibited with C++98 compilers. + + - QReadWriteLock: + * Optimized QReadWriteLock to be faster and take less memory. + + - QRect: + * Fixed integer overflow in center(). This fixes the result for some + corner-cases like a 1x1 rectangle at (INT_MIN, INT_MIN), for which the + previous implementation could return anything (due to invoking + undefined behavior), but commonly returned (0, 0). + + - QRect/QRectF: + * Added transposed(). + + - QSharedPointer: + * Added support for debug printing via QDebug. + + - QStorageInfo: + * [QTBUG-49498] Fixed a bug that caused QStorageInfo to report + information for the wrong filesystem if there is a mounted filesystem + at a path that is a prefix of the requested path (e.g., it would + report "/usr" filesystem for "/usrfoo"). + + - QString: + * Added resize(int, QChar) overload. + + - QStringRef: + * Added subscript operator. + * Fixed relational operators against (const char*) to return the correct + result. + * Added reverse iterators, rbegin(), rend(), crbegin(), crend(). + + - QUuid: + * Added Objective-C NSUUID/CFUUIDRef converters. + + - QVariant: + * [QTBUG-53384] Fixed QVariant::canConvert and conversion from integer + types to enumeration types. + + - QVector: + * clear() now preserves capacity. To shed capacity, call squeeze() or + swap with a default-constructed QVector object, see the documentation + for an example. + + - State Machine: + * Added constructor overload that takes a pointer-to-member for the + QSignalTransition. + +QtDBus +------ + + - QDBusArgument: + * [QTBUG-53376] Deprecated relying on a streamable Base to stream a + Derived without providing operator<</>>() for Derived. No diagnostic + provided. Support will be removed in Qt 5.8. + +QtGui +----- + + - QWheelEvent::phase() now returns NoScrollPhase with non-phase-aware mice. + This is most mice and input devices except, for now, Apple's trackpads + and Magic Mouse. It is no longer necessary to set the + QT_ENABLE_MOUSE_WHEEL_TRACKING environment variable to enable the fix for + QTBUG-50199. + - [QTBUG-35972] Added QWheelEvent::inverted() to enable detection of the + "natural scrolling" system setting. This feature currently only works on + OS X, though support for other operating systems is planned. + + - Image: + * [QTBUG-50745] Fixed possible crash in QImage::pixel() for mono or + indexed images. + + - QIcon: + * Split fromTheme() in two different overloads, one of which will only + lazily lookup the icons, in order to speed up startup of applications + that initialize many icons that are not necessarily visible. + * fromTheme gained the ability to use the GTK icon cache to speed up + lookups. + + - QPixmapCache: + * Added QPixmapCache::Key::isValid(). + + - QRawFont: + * Fixed kerning on advances in QRawFont for OS X and Windows. + + - Tablet support: + * [QTBUG-47007][QTBUG-51618] A synthetic mouse event will no longer be + sent after every QTabletEvent, only after those which are not accepted + (as documented). + + - Text: + * [QTBUG-35156] Added support for color font rendering with Freetype. + * [QTBUG-52048] Added QTextOption::ShowDocumentTerminator flag. + +QtNetwork +--------- + + - QAuthenticator: + * [QTBUG-53338] Fixed crash when comparing a initialized QAuthenticator + with an uninitialized QAuthenticator. + +QtWidgets +--------- + + - Moved QGtkStyle to the qtstyleplugins repository. + - [QTBUG-37580] Added the Qt::AA_UseStyleSheetPropagationInWidgetStyles + attribute which enables font and palette propagation for Qt Style + Sheets. + - [QTBUG-48138] QPinchGesture on OS X now behaves like on other platforms: + totalScaleFactor is the magnitude of the pinch and scaleFactor is the + delta for the current event. + + - Item Views: + * [QTBUG-50102] Item views scroll per pixel on OS X now. + * [QTBUG-50102] QAbstractItemView::verticalScrollMode and + QAbstractItemView::horizontalScrollMode are now resettable. + + - QAbstractItemView: + * [QTBUG-7232] In ItemViews when scrollMode is set to scrollPerPixel, it + is now possible to change the single step. Qt will automatically adjust + the single step until setSingleStep is called. When setSingleStep is + called it will however respect that and stop doing automatic changes + of the value. Calling setSingleStep(-1) will switch mode back to + automatic adjusting. + + - QAbstractScrollArea, QTextEdit, QPlainTextEdit: + * [QTBUG-52559] Changed focus to Qt::StrongFocus. That respects + platforms' native guidelines. + + - QHeaderView: + * [QTBUG-39010] Fixed some issues with restoring of section size after a + section is no longer the last visible section (in stretchLastSection + mode). + * [QTBUG-50171] Fixed a repainting issue when items had been reordered. + + - QListWidget: + * [QTBUG-15741] Fixed a bug that caused the default drop action to be + ignored when using icon mode. + + - QTableView: + * [QTBUG-50171] Fixed a selection bug when rows or columns were hidden. + + - Styles: + * [QTBUG-50102] Added SH_ItemView_ScrollMode style hint. + + - Dialogs: + * [QTBUG-51148] Fixed requesting a font from font dialog with a + non-existent family name and/or pixel size when using GTK2 platform + theme. + +QTest +----- + + - Added a new logging mode that allow test-results to be parsed on-the-fly + when using Jetbrains TeamCity as CI-server. This mode is enabled by + using the -teamcity option on the command-line. + +**************************************************************************** +* Platform-specific Changes * +**************************************************************************** + + - The Gtk+ platform theme has been ported to Gtk+ 3. + - Dropped support for Windows CE. + - Added support for INTEGRITY RTOS. + +Android +------- + + - Support for Android API < 16 was removed. + - [QTBUG-37221] Qt can now be used to easily create Android Services. + - Allow the user to choose how much from the Android theme is extracted. + +iOS +--- + + - [QTBUG-35271] QBackingStore now uses the raster paint engine instead of + the OpenGL paint engine, enabling improved antialiased drawing. In case + of performance regressions, the old code path can be enabled by setting + the window's surface type to QSurface::OpenGLSurface. + +OS X +---- + + - Support for OS X < 10.8 was removed. + - [QTBUG-7000] QMacPrintEngine now really sets the printer resolution. + - [QTBUG-32898] OS X now accepts trusted certificates from the login and + system keychains. + - [QTBUG-48953] Pasting text from Qt applications to Apple Mail now works. + - [QTBUG-48953] "text/vcard" is now required as the mime type when + placing vCards on the clipboard. + - [QTBUG-50262] QStandardPaths now returns the correct display name for + the download folder. + +Windows +------- + + - [QTBUG-390][QTBUG-6917][QTBUG-9350][QTBUG-24619] Added method + QProcess::setCreateProcessArgumentsModifier() to enable users to + intercept and modify CreateProcess parameters. + - Added support for color fonts (color emojis) when DirectWrite 2 is + available. + + - Text: + * [QTBUG-47141] Made it possible to disable antialiasing for text when + drawing into images. + * [QTBUG-18711] Fixed disabling hinting for application fonts, e.g. when + automatic scaling by device pixel ratio is in effect. + +XCB / X11 +--------- + + - [QTBUG-44964] It's now possible to unset AA_CompressHighFrequencyEvents + to disable the new X event compression feature that was added in 5.6.0. + This is a replacement for the WA_NoX11EventCompression flag in Qt 4. + - [QTBUG-49071] Fixed failure to deliver focusIn event on hide/show with XCB + - QMenuBar now uses the unified D-Bus AppMenu menubar when the desktop + environment supports it. + +**************************************************************************** +* Tools * +**************************************************************************** + +moc +--- + + - [QTBUG-53441] Fixed crash when processing files ending with \\\r. + +configure & build system +------------------------ + + - [QTBUG-35754] Static builds now embed QML resources into the libraries + to make them self-contained. + - [QTBUG-35886][Unix] Made it explicit that -fontconfig implies + -system-freetype. + - [QTBUG-43784][Unix] Fixed GLX not being enabled with -qt-xcb. + - [QTBUG-45291][GCC] Enabled use of Qt with -Wzero-as-null-pointer-constant. + - [Android@Windows] Fixed configure tests outside QtBase. + - [Unix] Fixed config.log corruption with option -v. + - [Unix] Fixed the MySQL configure test on RHEL 6.6. + - [Android] Enabled building with newer SDKs than the minimal supported one. + - QNX and Android builds on Windows use -system-zlib now. + - Added support for "Canadian Cross Builds"; options -external-hostbindir + and -host-option. + - Added makespecs for DRIVE CX (Tegra X1), NVIDIA Jetson TK1, and i.MX7 + boards. + - Qt now makes use of AVX512 instructions on Intel platforms. + +qmake +----- + + - Specifying directories in RESOURCES now actually works. + - Added -qtconf option to make it possible to use the same qmake binary + with several builds of Qt. diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index cb348a1036..d40054cf79 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -24,3 +24,44 @@ CONFIG += c++11 } unset(today) } + +isEmpty(QMAKE_DEFAULT_INCDIRS):!host_build { + # + # Get default include and library paths from compiler + # + gcc { + equals(QMAKE_DIR_SEP, /) { + cmd_prefix = "LC_ALL=C" + cmd_suffix = "</dev/null >/dev/null" + } else { + cmd_prefix = "set LC_ALL=C&" + cmd_suffix = "<NUL >NUL" + } + output = $$system("$$cmd_prefix $$QMAKE_CXX $$QMAKE_CXXFLAGS -xc++ -E -v - 2>&1 $$cmd_suffix", lines) + add_includes = false + for (line, output) { + line ~= s/^ *// # remove leading spaces + contains(line, "LIBRARY_PATH=.*") { + line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH= + paths = $$split(line, $$QMAKE_DIRLIST_SEP) + for (path, paths): \ + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path) + } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here: + add_includes = true + } else: contains(line, "End of search list.*") { + add_includes = false + } else { + $$add_includes: QMAKE_DEFAULT_INCDIRS += $$clean_path($$line) + } + } + QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) + } + + unix { + isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include + isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib + } + + !isEmpty(QMAKE_DEFAULT_INCDIRS): cache(QMAKE_DEFAULT_INCDIRS, set stash) + !isEmpty(QMAKE_DEFAULT_LIBDIRS): cache(QMAKE_DEFAULT_LIBDIRS, set stash) +} diff --git a/src/android/templates/AndroidManifest.xml b/src/android/templates/AndroidManifest.xml index 808cc82ae9..066ec0a63c 100644 --- a/src/android/templates/AndroidManifest.xml +++ b/src/android/templates/AndroidManifest.xml @@ -63,50 +63,8 @@ <!-- extract android style --> </activity> - <!--service android:process=":qt" android:name="org.qtproject.qt5.android.bindings.QtService"--> - <!-- android:process=":qt" is needed to force the service to run on a separate process than the Activity --> + <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices --> - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="-service"/ --> - <!-- Application arguments --> - <!-- If you're using the same application (.so file) for activity and also for service, then you - need to use *android.app.arguments* to pass some arguments to your service in order to know which - one is which - --> - - <!-- Ministro --> - <!-- meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/ --> - <!-- Ministro --> - - <!-- Deploy Qt libs as part of package --> - <!-- meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> - <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/ --> - <!-- Deploy Qt libs as part of package --> - - <!-- Run with local libs --> - <!-- meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/ --> - <!-- Run with local libs --> - - <!-- Messages maps --> - <!-- meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/ --> - <!-- Messages maps --> - - - <!-- Background running --> - <!-- meta-data android:name="android.app.background_running" android:value="true"/ --> - <!-- Background running --> - <!--/service --> </application> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/> diff --git a/src/android/templates/res/values/libs.xml b/src/android/templates/res/values/libs.xml index ee3f5e940e..43296f2e7a 100644 --- a/src/android/templates/res/values/libs.xml +++ b/src/android/templates/res/values/libs.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='utf-8'?> <resources> <array name="qt_sources"> - <item>https://download.qt.io/ministro/android/qt5/qt-5.6</item> + <item>https://download.qt.io/ministro/android/qt5/qt-5.7</item> </array> <!-- The following is handled automatically by the deployment tool. It should diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 34bb015a2f..c2028289a7 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -58,25 +58,26 @@ QT_BEGIN_NAMESPACE /* * ENDIAN FUNCTIONS */ -inline void qbswap_helper(const uchar *src, uchar *dest, int size) +inline void qbswap_helper(const void *src, void *dest, int size) { - for (int i = 0; i < size ; ++i) dest[i] = src[size - 1 - i]; + for (int i = 0; i < size ; ++i) + static_cast<uchar *>(dest)[i] = static_cast<const uchar *>(src)[size - 1 - i]; } /* - * qbswap(const T src, const uchar *dest); + * qbswap(const T src, const void *dest); * Changes the byte order of \a src from big endian to little endian or vice versa * and stores the result in \a dest. * There is no alignment requirements for \a dest. */ -template <typename T> inline void qbswap(const T src, uchar *dest) +template <typename T> inline void qbswap(const T src, void *dest) { - qbswap_helper(reinterpret_cast<const uchar *>(&src), dest, sizeof(T)); + qbswap_helper(&src, dest, sizeof(T)); } // Used to implement a type-safe and alignment-safe copy operation // If you want to avoid the memcpy, you must write specializations for these functions -template <typename T> Q_ALWAYS_INLINE void qToUnaligned(const T src, uchar *dest) +template <typename T> Q_ALWAYS_INLINE void qToUnaligned(const T src, void *dest) { // Using sizeof(T) inside memcpy function produces internal compiler error with // MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T. @@ -89,7 +90,7 @@ template <typename T> Q_ALWAYS_INLINE void qToUnaligned(const T src, uchar *dest (dest, &src, size); } -template <typename T> Q_ALWAYS_INLINE T qFromUnaligned(const uchar *src) +template <typename T> Q_ALWAYS_INLINE T qFromUnaligned(const void *src) { T dest; const size_t size = sizeof(T); @@ -122,11 +123,11 @@ template <> inline quint32 qbswap<quint32>(quint32 source) return __builtin_bswap32(source); } -template <> inline void qbswap<quint64>(quint64 source, uchar *dest) +template <> inline void qbswap<quint64>(quint64 source, void *dest) { qToUnaligned<quint64>(__builtin_bswap64(source), dest); } -template <> inline void qbswap<quint32>(quint32 source, uchar *dest) +template <> inline void qbswap<quint32>(quint32 source, void *dest) { qToUnaligned<quint32>(__builtin_bswap32(source), dest); } @@ -158,7 +159,7 @@ template <> inline quint16 qbswap<quint16>(quint16 source) { return __builtin_bswap16(source); } -template <> inline void qbswap<quint16>(quint16 source, uchar *dest) +template <> inline void qbswap<quint16>(quint16 source, void *dest) { qToUnaligned<quint16>(__builtin_bswap16(source), dest); } @@ -187,17 +188,17 @@ template <> inline qint16 qbswap<qint16>(qint16 source) return qbswap<quint16>(quint16(source)); } -template <> inline void qbswap<qint64>(qint64 source, uchar *dest) +template <> inline void qbswap<qint64>(qint64 source, void *dest) { qbswap<quint64>(quint64(source), dest); } -template <> inline void qbswap<qint32>(qint32 source, uchar *dest) +template <> inline void qbswap<qint32>(qint32 source, void *dest) { qbswap<quint32>(quint32(source), dest); } -template <> inline void qbswap<qint16>(qint16 source, uchar *dest) +template <> inline void qbswap<qint16>(qint16 source, void *dest) { qbswap<quint16>(quint16(source), dest); } @@ -212,9 +213,9 @@ template <typename T> inline T qToLittleEndian(T source) { return qbswap<T>(source); } template <typename T> inline T qFromLittleEndian(T source) { return qbswap<T>(source); } -template <typename T> inline void qToBigEndian(T src, uchar *dest) +template <typename T> inline void qToBigEndian(T src, void *dest) { qToUnaligned<T>(src, dest); } -template <typename T> inline void qToLittleEndian(T src, uchar *dest) +template <typename T> inline void qToLittleEndian(T src, void *dest) { qbswap<T>(src, dest); } #else // Q_LITTLE_ENDIAN @@ -226,9 +227,9 @@ template <typename T> inline T qToLittleEndian(T source) { return source; } template <typename T> inline T qFromLittleEndian(T source) { return source; } -template <typename T> inline void qToBigEndian(T src, uchar *dest) +template <typename T> inline void qToBigEndian(T src, void *dest) { qbswap<T>(src, dest); } -template <typename T> inline void qToLittleEndian(T src, uchar *dest) +template <typename T> inline void qToLittleEndian(T src, void *dest) { qToUnaligned<T>(src, dest); } #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN @@ -243,34 +244,34 @@ template <> inline qint8 qbswap<qint8>(qint8 source) return source; } -/* T qFromLittleEndian(const uchar *src) +/* T qFromLittleEndian(const void *src) * This function will read a little-endian encoded value from \a src * and return the value in host-endian encoding. * There is no requirement that \a src must be aligned. */ -template <typename T> inline T qFromLittleEndian(const uchar *src) +template <typename T> inline T qFromLittleEndian(const void *src) { return qFromLittleEndian(qFromUnaligned<T>(src)); } -template <> inline quint8 qFromLittleEndian<quint8>(const uchar *src) -{ return static_cast<quint8>(src[0]); } -template <> inline qint8 qFromLittleEndian<qint8>(const uchar *src) -{ return static_cast<qint8>(src[0]); } +template <> inline quint8 qFromLittleEndian<quint8>(const void *src) +{ return static_cast<const quint8 *>(src)[0]; } +template <> inline qint8 qFromLittleEndian<qint8>(const void *src) +{ return static_cast<const qint8 *>(src)[0]; } /* This function will read a big-endian (also known as network order) encoded value from \a src * and return the value in host-endian encoding. * There is no requirement that \a src must be aligned. */ -template <class T> inline T qFromBigEndian(const uchar *src) +template <class T> inline T qFromBigEndian(const void *src) { return qFromBigEndian(qFromUnaligned<T>(src)); } -template <> inline quint8 qFromBigEndian<quint8>(const uchar *src) -{ return static_cast<quint8>(src[0]); } -template <> inline qint8 qFromBigEndian<qint8>(const uchar *src) -{ return static_cast<qint8>(src[0]); } +template <> inline quint8 qFromBigEndian<quint8>(const void *src) +{ return static_cast<const quint8 *>(src)[0]; } +template <> inline qint8 qFromBigEndian<qint8>(const void *src) +{ return static_cast<const qint8 *>(src)[0]; } QT_END_NAMESPACE diff --git a/src/corelib/global/qendian.qdoc b/src/corelib/global/qendian.qdoc index 3b22dcec87..9ce9dbdb0e 100644 --- a/src/corelib/global/qendian.qdoc +++ b/src/corelib/global/qendian.qdoc @@ -35,7 +35,7 @@ /*! \internal - \fn T qFromUnaligned(const uchar *ptr) + \fn T qFromUnaligned(const void *ptr) \since 5.5 Loads a \c{T} from address \a ptr, which may be misaligned. @@ -46,7 +46,7 @@ /*! \internal - \fn void qToUnaligned(T t, uchar *ptr) + \fn void qToUnaligned(T t, void *ptr) \since 4.5 Stores \a t to address \a ptr, which may be misaligned. @@ -57,7 +57,7 @@ /*! - \fn T qFromBigEndian(const uchar *src) + \fn T qFromBigEndian(const void *src) \since 4.3 \relates <QtEndian> @@ -69,6 +69,8 @@ \note Template type \c{T} can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable. + \note Since Qt 5.7, the type of the \a src parameter is a void pointer. + There are no data alignment constraints for \a src. \sa qFromLittleEndian() @@ -88,7 +90,7 @@ unmodified. */ /*! - \fn T qFromLittleEndian(const uchar *src) + \fn T qFromLittleEndian(const void *src) \since 4.3 \relates <QtEndian> @@ -100,6 +102,8 @@ \note Template type \c{T} can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable. + \note Since Qt 5.7, the type of the \a src parameter is a void pointer. + There are no data alignment constraints for \a src. \sa qFromBigEndian() @@ -119,7 +123,7 @@ unmodified. */ /*! - \fn void qToBigEndian(T src, uchar *dest) + \fn void qToBigEndian(T src, void *dest) \since 4.3 \relates <QtEndian> @@ -130,6 +134,8 @@ There are no data alignment constraints for \a dest. + \note Since Qt 5.7, the type of the \a dest parameter is a void pointer. + \sa qFromBigEndian() \sa qFromLittleEndian() \sa qToLittleEndian() @@ -147,7 +153,7 @@ unmodified. */ /*! - \fn void qToLittleEndian(T src, uchar *dest) + \fn void qToLittleEndian(T src, void *dest) \since 4.3 \relates <QtEndian> @@ -158,6 +164,8 @@ There are no data alignment constraints for \a dest. + \note Since Qt 5.7, the type of the \a dest parameter is a void pointer. + \sa qFromBigEndian() \sa qFromLittleEndian() \sa qToBigEndian() diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cf647ea20d..f9d7a1c43f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1071,9 +1071,9 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...> }; #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14 -template <typename... Args> Q_CONSTEXPR QOverload<Args...> qOverload Q_DECL_UNUSED = {}; -template <typename... Args> Q_CONSTEXPR QConstOverload<Args...> qConstOverload Q_DECL_UNUSED = {}; -template <typename... Args> Q_CONSTEXPR QNonConstOverload<Args...> qNonConstOverload Q_DECL_UNUSED = {}; +template <typename... Args> Q_CONSTEXPR Q_DECL_UNUSED QOverload<Args...> qOverload = {}; +template <typename... Args> Q_CONSTEXPR Q_DECL_UNUSED QConstOverload<Args...> qConstOverload = {}; +template <typename... Args> Q_CONSTEXPR Q_DECL_UNUSED QNonConstOverload<Args...> qNonConstOverload = {}; #endif #endif diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index 76d173bb3e..c7f8840a82 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -364,8 +364,10 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QHash<Key, T> &has if (in.status() != QDataStream::Ok) hash.clear(); - if (oldStatus != QDataStream::Ok) + if (oldStatus != QDataStream::Ok) { + in.resetStatus(); in.setStatus(oldStatus); + } return in; } @@ -408,8 +410,10 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &ma } if (in.status() != QDataStream::Ok) map.clear(); - if (oldStatus != QDataStream::Ok) + if (oldStatus != QDataStream::Ok) { + in.resetStatus(); in.setStatus(oldStatus); + } return in; } diff --git a/src/corelib/json/qjson.cpp b/src/corelib/json/qjson.cpp index bb98e25fa5..4b98ef076c 100644 --- a/src/corelib/json/qjson.cpp +++ b/src/corelib/json/qjson.cpp @@ -435,7 +435,7 @@ void Value::copyData(const QJsonValue &v, char *dest, bool compressed) switch (v.t) { case QJsonValue::Double: if (!compressed) { - qToLittleEndian(v.ui, (uchar *)dest); + qToLittleEndian(v.ui, dest); } break; case QJsonValue::String: { diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index 2926adf10a..6a3d1de99a 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -738,7 +738,7 @@ bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset) } int pos = reserveSpace(sizeof(double)); - qToLittleEndian(ui, reinterpret_cast<uchar *>(data + pos)); + qToLittleEndian(ui, data + pos); if (current - baseOffset >= Value::MaxSize) { lastError = QJsonParseError::DocumentTooLarge; return false; diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp index 8461bf7130..7e07f8acb9 100644 --- a/src/corelib/mimetypes/qmimemagicrule.cpp +++ b/src/corelib/mimetypes/qmimemagicrule.cpp @@ -163,7 +163,7 @@ bool QMimeMagicRule::matchNumber(const QByteArray &data) const const char *p = data.constData() + m_startPos; const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), m_endPos + 1); for ( ; p <= e; ++p) { - if ((qFromUnaligned<T>(reinterpret_cast<const uchar *>(p)) & mask) == (value & mask)) + if ((qFromUnaligned<T>(p) & mask) == (value & mask)) return true; } diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h index 2ecdc4e786..145f00df43 100644 --- a/src/corelib/plugin/qelfparser_p.h +++ b/src/corelib/plugin/qelfparser_p.h @@ -89,9 +89,9 @@ public: T read(const char *s) { if (m_endian == ElfBigEndian) - return qFromBigEndian<T>(reinterpret_cast<const uchar *>(s)); + return qFromBigEndian<T>(s); else - return qFromLittleEndian<T>(reinterpret_cast<const uchar *>(s)); + return qFromLittleEndian<T>(s); } const char *parseSectionHeader(const char* s, ElfSectionHeader *sh); diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 522fd5eac2..90b6989467 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -92,10 +92,11 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive)) QMutexPool is destructed. */ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) - : count(size), - mutexes(new QAtomicPointer<QMutex>[size]()), // (): zero-initialize - recursionMode(recursionMode) + : mutexes(size), recursionMode(recursionMode) { + for (int index = 0; index < mutexes.count(); ++index) { + mutexes[index].store(0); + } } /*! @@ -104,8 +105,8 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) */ QMutexPool::~QMutexPool() { - qDeleteAll(mutexes, mutexes + count); - delete[] mutexes; + for (int index = 0; index < mutexes.count(); ++index) + delete mutexes[index].load(); } /*! diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 33e9a52cb7..796e65d960 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -66,7 +66,7 @@ public: ~QMutexPool(); inline QMutex *get(const void *address) { - int index = uint(quintptr(address)) % count; + int index = uint(quintptr(address)) % mutexes.count(); QMutex *m = mutexes[index].load(); if (m) return m; @@ -78,8 +78,7 @@ public: private: QMutex *createMutex(int index); - int count; - QAtomicPointer<QMutex> *mutexes; + QVarLengthArray<QAtomicPointer<QMutex>, 131> mutexes; QMutex::RecursionMode recursionMode; }; diff --git a/src/corelib/thread/qreadwritelock_p.h b/src/corelib/thread/qreadwritelock_p.h index 285f017655..24d25eb2be 100644 --- a/src/corelib/thread/qreadwritelock_p.h +++ b/src/corelib/thread/qreadwritelock_p.h @@ -65,7 +65,7 @@ class QReadWriteLockPrivate public: QReadWriteLockPrivate(bool isRecursive = false) : readerCount(0), writerCount(0), waitingReaders(0), waitingWriters(0), - recursive(isRecursive), id(0) {} + recursive(isRecursive), id(0), currentWriter(nullptr) {} QMutex mutex; QWaitCondition writerCond; diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 47df15ddaa..6bb8280ca8 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -319,7 +319,8 @@ struct QMovableArrayOps , end(finish) , displace(diff) { - ::memmove(begin + displace, begin, (end - begin) * sizeof(T)); + ::memmove(static_cast<void *>(begin + displace), static_cast<void *>(begin), + (end - begin) * sizeof(T)); } void commit() { displace = 0; } @@ -327,7 +328,8 @@ struct QMovableArrayOps ~ReversibleDisplace() { if (displace) - ::memmove(begin, begin + displace, (end - begin) * sizeof(T)); + ::memmove(static_cast<void *>(begin), static_cast<void *>(begin + displace), + (end - begin) * sizeof(T)); } T *const begin; @@ -384,7 +386,7 @@ struct QMovableArrayOps ~Mover() { - ::memmove(destination, source, n * sizeof(T)); + ::memmove(static_cast<void *>(destination), static_cast<const void *>(source), n * sizeof(T)); size -= (source - destination); } diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 8cf0c5a4d2..259da3cfec 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -285,7 +285,7 @@ #endif #endif // AArch64/ARM64 -#if defined(Q_PROCESSOR_ARM_V8) +#if defined(Q_PROCESSOR_ARM_V8) && defined(__ARM_FEATURE_CRC32) #define QT_FUNCTION_TARGET_STRING_CRC32 "+crc" # include <arm_acle.h> #endif @@ -468,32 +468,6 @@ static inline quint64 qCpuFeatures() #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i) -template <typename T> -Q_ALWAYS_INLINE -T qUnalignedLoad(const void *ptr) Q_DECL_NOTHROW -{ - T result; -#if QT_HAS_BUILTIN(__builtin_memcpy) - __builtin_memcpy -#else - memcpy -#endif - /*memcpy*/(&result, ptr, sizeof result); - return result; -} - -template <typename T> -Q_ALWAYS_INLINE -void qUnalignedStore(void *ptr, T t) Q_DECL_NOTHROW -{ -#if QT_HAS_BUILTIN(__builtin_memcpy) - __builtin_memcpy -#else - memcpy -#endif - /*memcpy*/(ptr, &t, sizeof t); -} - QT_END_NAMESPACE #endif // QSIMD_P_H diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index b4e46eb1c6..85469fbc3d 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -261,6 +261,35 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &l return arg; } +// QList specializations +template<typename T> +inline QDBusArgument &operator<<(QDBusArgument &arg, const QList<T> &list) +{ + int id = qMetaTypeId<T>(); + arg.beginArray(id); + typename QList<T>::ConstIterator it = list.constBegin(); + typename QList<T>::ConstIterator end = list.constEnd(); + for ( ; it != end; ++it) + arg << *it; + arg.endArray(); + return arg; +} + +template<typename T> +inline const QDBusArgument &operator>>(const QDBusArgument &arg, QList<T> &list) +{ + arg.beginArray(); + list.clear(); + while (!arg.atEnd()) { + T item; + arg >> item; + list.push_back(item); + } + arg.endArray(); + + return arg; +} + inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list) { int id = qMetaTypeId<QDBusVariant>(); @@ -273,6 +302,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list) return arg; } +// QMap specializations template<typename Key, typename T> inline QDBusArgument &operator<<(QDBusArgument &arg, const QMap<Key, T> &map) { @@ -321,6 +351,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map) return arg; } +// QHash specializations template<typename Key, typename T> inline QDBusArgument &operator<<(QDBusArgument &arg, const QHash<Key, T> &map) { diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index 5696290ed3..59a71ade3e 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -177,7 +177,7 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) \snippet code/src_qdbus_qdbusmetatype.cpp 0 - If \c{T} isn't a type derived from one of + If \c{T} isn't one of Qt's \l{container classes}, the \c{operator<<} and \c{operator>>} streaming operators between \c{T} and QDBusArgument must be already declared. See the \l {qdbustypesystem.html}{Qt D-Bus @@ -187,6 +187,14 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) This function returns the Qt meta type id for the type (the same value that is returned from qRegisterMetaType()). + \note The feature that a \c{T} inheriting a streamable type (including + the containers QList, QHash or QMap) can be streamed without providing + custom \c{operator<<} and \c{operator>>} is deprecated as of Qt 5.7, + because it ignores everything in \c{T} except the base class. There is + no diagnostic. You should always provide these operators for all types + you wish to stream and not rely on Qt-provided stream operators for + base classes. + \sa {qdbustypesystem.html}{Qt D-Bus Type System}, qRegisterMetaType(), QMetaType */ diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp index c3a911fc55..2e4af09550 100644 --- a/src/gui/text/qfontengine_qpf2.cpp +++ b/src/gui/text/qfontengine_qpf2.cpp @@ -533,7 +533,7 @@ void QPF2Generator::writeHeader() { const QByteArray head = fe->getSfntTable(MAKE_TAG('h', 'e', 'a', 'd')); if (head.size() >= 4) { - const quint32 revision = qFromBigEndian<quint32>(reinterpret_cast<const uchar *>(head.constData())); + const quint32 revision = qFromBigEndian<quint32>(head.constData()); writeTaggedUInt32(QFontEngineQPF2::Tag_FontRevision, revision); } } diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index f591b4333c..c8f0393084 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -1145,7 +1145,7 @@ static QByteArray bindFont(const QVector<QTtfTable>& _tables) // calculate the fonts checksum and qToBigEndian into 'head's checksum_adjust quint32 checksum_adjust = 0xB1B0AFBA - checksum(font); - qToBigEndian(checksum_adjust, (uchar *)font.data() + head_offset + 8); + qToBigEndian(checksum_adjust, font.data() + head_offset + 8); return font; } diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 23ec390ae5..19b519243c 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -1218,7 +1218,7 @@ bool QFtpPI::startNextCmd() pendingCommands.pop_front(); #if defined(QFTPPI_DEBUG) - qDebug("QFtpPI send: %s", currentCmd.left(currentCmd.length()-2).toLatin1().constData()); + qDebug("QFtpPI send: %s", currentCmd.leftRef(currentCmd.length() - 2).toLatin1().constData()); #endif state = Waiting; commandSocket.write(currentCmd.toUtf8()); diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 283dd3509e..429b71eb21 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -160,7 +160,7 @@ static inline bool isParentDomain(const QString &domain, const QString &referenc if (!reference.startsWith(QLatin1Char('.'))) return domain == reference; - return domain.endsWith(reference) || domain == reference.mid(1); + return domain.endsWith(reference) || domain == reference.midRef(1); } /*! diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index a87599c77a..445a2a1c29 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -364,43 +364,43 @@ void QSpdyProtocolHandler::_q_readyRead() static qint16 twoBytesToInt(const char *bytes) { - return qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(bytes)); + return qFromBigEndian<qint16>(bytes); } static qint32 threeBytesToInt(const char *bytes) { - return qFromBigEndian<qint32>(reinterpret_cast<const uchar *>(bytes)) >> 8; + return qFromBigEndian<qint32>(bytes) >> 8; } static qint32 fourBytesToInt(const char *bytes) { - return qFromBigEndian<qint32>(reinterpret_cast<const uchar *>(bytes)); + return qFromBigEndian<qint32>(bytes); } static void appendIntToThreeBytes(char *output, qint32 number) { - qToBigEndian<qint16>(number, reinterpret_cast<uchar *>(output + 1)); - qToBigEndian<qint8>(number >> 16, reinterpret_cast<uchar *>(output)); + qToBigEndian<qint16>(number, output + 1); + qToBigEndian<qint8>(number >> 16, output); } static void appendIntToFourBytes(char *output, qint32 number) { - qToBigEndian<qint32>(number, reinterpret_cast<uchar *>(output)); + qToBigEndian<qint32>(number, output); } static QByteArray intToFourBytes(qint32 number) // ### try to use appendIntToFourBytes where possible { - uchar data[4]; + char data[4]; qToBigEndian<qint32>(number, data); - QByteArray ret(reinterpret_cast<char *>(data), 4); + QByteArray ret(data, 4); return ret; } static QByteArray intToThreeBytes(qint32 number) { - uchar data[4]; + char data[4]; qToBigEndian<qint32>(number << 8, data); - QByteArray ret(reinterpret_cast<char *>(data), 3); + QByteArray ret(data, 3); return ret; } diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 681c81d6eb..95f90af49e 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -1103,7 +1103,7 @@ QPair<QHostAddress, int> QHostAddress::parseSubnet(const QString &subnet) netmask = parser.prefixLength(); } else { bool ok; - netmask = subnet.mid(slash + 1).toUInt(&ok); + netmask = subnet.midRef(slash + 1).toUInt(&ok); if (!ok) return invalid; // failed to parse the subnet } diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 03109b4e46..2727bd9257 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -320,7 +320,7 @@ static QList<QNetworkProxy> parseServerList(const QNetworkProxyQuery &query, con pos = entry.indexOf(QLatin1Char(':'), server); if (pos != -1) { bool ok; - uint value = entry.mid(pos + 1).toUInt(&ok); + uint value = entry.midRef(pos + 1).toUInt(&ok); if (!ok || value > 65535) continue; // invalid port number diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 140b6c129f..971f0b0cce 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -251,9 +251,9 @@ void QCoreTextFontEngine::init() QByteArray os2Table = getSfntTable(MAKE_TAG('O', 'S', '/', '2')); unsigned emSize = CTFontGetUnitsPerEm(ctfont); if (os2Table.size() >= 10) { - fsType = qFromBigEndian<quint16>(reinterpret_cast<const uchar *>(os2Table.constData() + 8)); + fsType = qFromBigEndian<quint16>(os2Table.constData() + 8); // qAbs is a workaround for weird fonts like Lucida Grande - qint16 width = qAbs(qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(os2Table.constData() + 2))); + qint16 width = qAbs(qFromBigEndian<qint16>(os2Table.constData() + 2)); avgCharWidth = QFixed::fromReal(width * fontDef.pixelSize / emSize); } else avgCharWidth = QFontEngine::averageCharWidth(); diff --git a/src/plugins/generic/tuiotouch/qoscbundle.cpp b/src/plugins/generic/tuiotouch/qoscbundle.cpp index 26dabebd23..6ddca9b09d 100644 --- a/src/plugins/generic/tuiotouch/qoscbundle.cpp +++ b/src/plugins/generic/tuiotouch/qoscbundle.cpp @@ -89,9 +89,9 @@ QOscBundle::QOscBundle(const QByteArray &data) // (editor's note: one may wonder how a 64bit big-endian number can also be // two 32bit numbers, without specifying in which order they occur or // anything, and one may indeed continue to wonder.) - quint32 oscTimeEpoch = qFromBigEndian<quint32>((const uchar*)data.constData() + parsedBytes); + quint32 oscTimeEpoch = qFromBigEndian<quint32>(data.constData() + parsedBytes); parsedBytes += sizeof(quint32); - quint32 oscTimePico = qFromBigEndian<quint32>((const uchar*)data.constData() + parsedBytes); + quint32 oscTimePico = qFromBigEndian<quint32>(data.constData() + parsedBytes); parsedBytes += sizeof(quint32); bool isImmediate = false; diff --git a/src/plugins/generic/tuiotouch/qoscmessage.cpp b/src/plugins/generic/tuiotouch/qoscmessage.cpp index 30cf117767..6f82cd784b 100644 --- a/src/plugins/generic/tuiotouch/qoscmessage.cpp +++ b/src/plugins/generic/tuiotouch/qoscmessage.cpp @@ -95,7 +95,7 @@ QOscMessage::QOscMessage(const QByteArray &data) if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < sizeof(quint32)) return; - quint32 anInt = qFromBigEndian<quint32>((const uchar*)data.constData() + parsedBytes); + quint32 anInt = qFromBigEndian<quint32>(data.constData() + parsedBytes); parsedBytes += sizeof(quint32); // TODO: is int32 in OSC signed, or unsigned? @@ -109,7 +109,7 @@ QOscMessage::QOscMessage(const QByteArray &data) quint32 u; float f; } value; - value.u = qFromBigEndian<quint32>((const uchar*)data.constData() + parsedBytes); + value.u = qFromBigEndian<quint32>(data.constData() + parsedBytes); parsedBytes += sizeof(quint32); arguments.append(value.f); } else { diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 899dc0158a..401eb8043c 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -158,8 +158,8 @@ public: #define ADJUST_BO(b, t, x) \ ((b == LSBFirst) ? \ - qFromLittleEndian<t>((const uchar *)(x)) : \ - qFromBigEndian<t>((const uchar *)(x))) + qFromLittleEndian<t>(x) : \ + qFromBigEndian<t>(x)) #define VALIDATE_LENGTH(x) \ if ((size_t)xSettings.length() < (offset + local_offset + 12 + x)) { \ qWarning("Length %d runs past end of data", x); \ diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 3c46f4faca..689704884f 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1820,13 +1820,10 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) "<p>Qt licensed under our commercial license agreement is appropriate " "for development of proprietary/commercial software where you do not " "want to share any source code with third parties or otherwise cannot " - "comply with the terms of the GNU LGPL version 3 or GNU LGPL version 2.1.</p>" + "comply with the terms of the GNU LGPL version 3.</p>" "<p>Qt licensed under the GNU LGPL version 3 is appropriate for the " "development of Qt applications provided you can comply with the terms " "and conditions of the GNU LGPL version 3.</p>" - "<p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the " - "development of Qt applications provided you can comply with the terms " - "and conditions of the GNU LGPL version 2.1.</p>" "<p>Please see <a href=\"http://%2/\">%2</a> " "for an overview of Qt licensing.</p>" "<p>Copyright (C) %1 The Qt Company Ltd and other " diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index cd3081dae5..1e7ca803d6 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -3231,7 +3231,8 @@ void QTreeViewPrivate::drawAnimatedOperation(QPainter *painter) const QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) const { Q_Q(const QTreeView); - QPixmap pixmap(rect.size()); + QPixmap pixmap(rect.size() * q->devicePixelRatio()); + pixmap.setDevicePixelRatio(q->devicePixelRatio()); if (rect.size().isEmpty()) return pixmap; pixmap.fill(Qt::transparent); //the base might not be opaque, and we don't want uninitialized pixels. diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index 912d782ffa..4a5aead17a 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -2721,10 +2721,11 @@ void tst_QDataStream::status_QBitArray() QCOMPARE(str, expectedString); } -#define MAP_TEST(byteArray, expectedStatus, expectedHash) \ +#define MAP_TEST(byteArray, initialStatus, expectedStatus, expectedHash) \ { \ QByteArray ba = byteArray; \ QDataStream stream(&ba, QIODevice::ReadOnly); \ + stream.setStatus(initialStatus); \ stream >> hash; \ QCOMPARE((int)stream.status(), (int)expectedStatus); \ QCOMPARE(hash.size(), expectedHash.size()); \ @@ -2737,6 +2738,7 @@ void tst_QDataStream::status_QBitArray() for (; it != expectedHash.constEnd(); ++it) \ expectedMap.insert(it.key(), it.value()); \ QDataStream stream(&ba, QIODevice::ReadOnly); \ + stream.setStatus(initialStatus); \ stream >> map; \ QCOMPARE((int)stream.status(), (int)expectedStatus); \ QCOMPARE(map.size(), expectedMap.size()); \ @@ -2758,25 +2760,30 @@ void tst_QDataStream::status_QHash_QMap() hash2.insert("L", "MN"); // ok - MAP_TEST(QByteArray("\x00\x00\x00\x00", 4), QDataStream::Ok, StringHash()); - MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", 12), QDataStream::Ok, hash1); + MAP_TEST(QByteArray("\x00\x00\x00\x00", 4), QDataStream::Ok, QDataStream::Ok, StringHash()); + MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", 12), QDataStream::Ok, QDataStream::Ok, hash1); MAP_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x02\x00J\x00\x00\x00\x02\x00K" - "\x00\x00\x00\x02\x00L\x00\x00\x00\x04\x00M\x00N", 30), QDataStream::Ok, hash2); + "\x00\x00\x00\x02\x00L\x00\x00\x00\x04\x00M\x00N", 30), QDataStream::Ok, QDataStream::Ok, hash2); // past end - MAP_TEST(QByteArray(), QDataStream::ReadPastEnd, StringHash()); - MAP_TEST(QByteArray("\x00", 1), QDataStream::ReadPastEnd, StringHash()); - MAP_TEST(QByteArray("\x00\x00", 2), QDataStream::ReadPastEnd, StringHash()); - MAP_TEST(QByteArray("\x00\x00\x00", 3), QDataStream::ReadPastEnd, StringHash()); - MAP_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::ReadPastEnd, StringHash()); + MAP_TEST(QByteArray(), QDataStream::Ok, QDataStream::ReadPastEnd, StringHash()); + MAP_TEST(QByteArray("\x00", 1), QDataStream::Ok, QDataStream::ReadPastEnd, StringHash()); + MAP_TEST(QByteArray("\x00\x00", 2), QDataStream::Ok, QDataStream::ReadPastEnd, StringHash()); + MAP_TEST(QByteArray("\x00\x00\x00", 3), QDataStream::Ok, QDataStream::ReadPastEnd, StringHash()); + MAP_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::Ok, QDataStream::ReadPastEnd, StringHash()); for (int i = 4; i < 12; ++i) { - MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", i), QDataStream::ReadPastEnd, StringHash()); + MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", i), QDataStream::Ok, QDataStream::ReadPastEnd, StringHash()); } // corrupt data - MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::ReadCorruptData, StringHash()); + MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::Ok, QDataStream::ReadCorruptData, StringHash()); MAP_TEST(QByteArray("\x00\x00\x00\x02\x00\x00\x00\x01\x00J\x00\x00\x00\x01\x00K" - "\x00\x00\x00\x01\x00L\x00\x00\x00\x02\x00M\x00N", 30), QDataStream::ReadCorruptData, StringHash()); + "\x00\x00\x00\x01\x00L\x00\x00\x00\x02\x00M\x00N", 30), QDataStream::Ok, QDataStream::ReadCorruptData, StringHash()); + + // test the previously latched error status is not affected by reading + MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", 12), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, hash1); + MAP_TEST(QByteArray("\x00\x00\x00\x01", 4), QDataStream::ReadCorruptData, QDataStream::ReadCorruptData, StringHash()); + MAP_TEST(QByteArray("\x00\x00\x00\x01\x00\x00\x00\x01", 8), QDataStream::ReadPastEnd, QDataStream::ReadPastEnd, StringHash()); } #define LIST_TEST(byteArray, expectedStatus, expectedList) \ diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 8cefad37fc..0f1c5723d5 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -44,6 +44,7 @@ #include <QtWidgets/QDialog> #include <QtWidgets/QStyledItemDelegate> #include <QtWidgets/QStyleFactory> +#include <QtWidgets/QVBoxLayout> #if defined(Q_OS_WIN) # include <windows.h> @@ -110,7 +111,7 @@ private slots: void scrollBarAsNeeded(); void moveItems(); void wordWrap(); -#if defined(Q_OS_WIN) && WINVER >= 0x0500 +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void setCurrentIndexAfterAppendRowCrash(); #endif void emptyItemSize(); @@ -1418,8 +1419,10 @@ class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog public: SetCurrentIndexAfterAppendRowCrashDialog() { -#if WINVER >= 0x0500 - listView = new QListView(); + setWindowTitle(QTest::currentTestFunction()); + listView = new QListView(this); + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(listView); listView->setViewMode(QListView::IconMode); model = new QStandardItemModel(this); @@ -1428,12 +1431,16 @@ public: timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(buttonClicked())); timer->start(1000); + } +protected: + void showEvent(QShowEvent *event) override + { + QDialog::showEvent(event); DWORD lParam = 0xFFFFFFFC/*OBJID_CLIENT*/; DWORD wParam = 0; if (const HWND hwnd =getHWNDForWidget(this)) SendMessage(hwnd, WM_GETOBJECT, wParam, lParam); -#endif } private slots: @@ -1450,16 +1457,13 @@ private: QStandardItemModel *model; QTimer *timer; }; -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && WINVER >= 0x0500 -// This test only makes sense on windows 2000 and higher. void tst_QListView::setCurrentIndexAfterAppendRowCrash() { SetCurrentIndexAfterAppendRowCrashDialog w; w.exec(); } -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT void tst_QListView::emptyItemSize() { diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 12efc67325..be11851910 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3313,11 +3313,6 @@ void Configure::generateQConfigPri() configStream << " QT_TARGET_ARCH = " << dictionary["QT_ARCH"] << endl; configStream << "} else {" << endl; configStream << " QT_ARCH = " << dictionary["QT_ARCH"] << endl; - if (dictionary.contains("XQMAKESPEC")) { - // FIXME: add detection - configStream << " QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib" << endl; - configStream << " QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include" << endl; - } configStream << "}" << endl; configStream << "QT_CONFIG += " << qtConfig.join(' ') << endl; |