diff options
Diffstat (limited to 'src/corelib')
34 files changed, 366 insertions, 334 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 1627de4002..819b48f973 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -294,3 +294,54 @@ function(QT5_ADD_RESOURCES outfiles ) endfunction() set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") + +if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) + macro(qt5_use_modules _target _link_type) + if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11) + if(CMAKE_WARN_DEPRECATED) + set(messageType WARNING) + endif() + if(CMAKE_ERROR_DEPRECATED) + set(messageType FATAL_ERROR) + endif() + if(messageType) + message(${messageType} "The qt5_use_modules macro is obsolete. Use target_link_libraries with IMPORTED targets instead.") + endif() + endif() + + if (NOT TARGET ${_target}) + message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.") + endif() + if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" ) + set(_qt5_modules ${ARGN}) + set(_qt5_link_type ${_link_type}) + else() + set(_qt5_modules ${_link_type} ${ARGN}) + endif() + + if ("${_qt5_modules}" STREQUAL "") + message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.") + endif() + + foreach(_module ${_qt5_modules}) + if (NOT Qt5${_module}_FOUND) + find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH) + if (NOT Qt5${_module}_FOUND) + message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") + endif() + endif() + target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES}) + set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS}) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS}) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) + if (Qt5_POSITION_INDEPENDENT_CODE + AND (CMAKE_VERSION VERSION_LESS 2.8.12 + AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))) + set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE}) + endif() + endforeach() + endmacro() +endif() diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 9fd845bb93..5ba2a1fa73 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -40,7 +40,7 @@ /*! \class QPropertyAnimation \inmodule QtCore - \brief The QPropertyAnimation class animates Qt properties + \brief The QPropertyAnimation class animates Qt properties. \since 4.6 \ingroup animation diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 87ade23503..9906425f5b 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -629,7 +629,7 @@ # define Q_COMPILER_THREAD_LOCAL # define Q_COMPILER_UDL # endif -# elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L s +# elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L // C11 features supported. Only tested with ICC 17 and up. # define Q_COMPILER_STATIC_ASSERT # if __has_include(<threads.h>) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b654f5863a..3fe91cae65 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1038,6 +1038,11 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value)); \snippet code/src_corelib_global_qglobal.cpp 53 + \note Qt detects the necessary C++14 compiler support by way of the feature + test recommendations from + \l{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations} + {C++ Committee's Standing Document 6}. + \sa qConstOverload(), qNonConstOverload(), {Differences between String-Based and Functor-Based Connections} */ diff --git a/src/corelib/global/qglobalstatic.qdoc b/src/corelib/global/qglobalstatic.qdoc index 63cc968d1c..303709bb1d 100644 --- a/src/corelib/global/qglobalstatic.qdoc +++ b/src/corelib/global/qglobalstatic.qdoc @@ -3,9 +3,9 @@ ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -14,25 +14,13 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -336,7 +324,7 @@ \threadsafe \inmodule QtCore \since 5.1 - \brief The QGlobalStatic class is used to implement a global static object + \brief The QGlobalStatic class is used to implement a global static object. The QGlobalStatic class is the front-end API exported when Q_GLOBAL_STATIC() is used. See the documentation for the macro for a diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 4d267e328d..2f8d339ca7 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -438,6 +438,14 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSHighSierra = QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 13); /*! + \variable QOperatingSystemVersion::MacOSMojave + \brief a version corresponding to macOS Mojave (version 10.14). + \since 5.11.2 + */ +const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave = + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14); + +/*! \variable QOperatingSystemVersion::AndroidJellyBean \brief a version corresponding to Android Jelly Bean (version 4.1, API level 16). \since 5.9 diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 5f27deab9e..df01e5438a 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -70,6 +70,7 @@ public: static const QOperatingSystemVersion OSXElCapitan; static const QOperatingSystemVersion MacOSSierra; static const QOperatingSystemVersion MacOSHighSierra; + static const QOperatingSystemVersion MacOSMojave; static const QOperatingSystemVersion AndroidJellyBean; static const QOperatingSystemVersion AndroidJellyBean_MR1; diff --git a/src/corelib/global/qoperatingsystemversion_win.cpp b/src/corelib/global/qoperatingsystemversion_win.cpp index f3662ae1f9..7659fb2550 100644 --- a/src/corelib/global/qoperatingsystemversion_win.cpp +++ b/src/corelib/global/qoperatingsystemversion_win.cpp @@ -97,7 +97,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion() // because linking to it at load time will not pass the Windows App Certification Kit // https://msdn.microsoft.com/en-us/library/windows/hardware/ff561910.aspx RtlGetVersionFunction pRtlGetVersion = reinterpret_cast<RtlGetVersionFunction>( - GetProcAddressA(ntdll, "RtlGetVersion")); + reinterpret_cast<QFunctionPointer>(GetProcAddressA(ntdll, "RtlGetVersion"))); if (Q_UNLIKELY(!pRtlGetVersion)) return result; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index ff0e03108b..cacb95b674 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -216,18 +216,6 @@ # // Numerical checks are preferred to named checks, but to be safe # // we define the missing version names in case Qt uses them. # -# if !defined(__MAC_10_7) -# define __MAC_10_7 1070 -# endif -# if !defined(__MAC_10_8) -# define __MAC_10_8 1080 -# endif -# if !defined(__MAC_10_9) -# define __MAC_10_9 1090 -# endif -# if !defined(__MAC_10_10) -# define __MAC_10_10 101000 -# endif # if !defined(__MAC_10_11) # define __MAC_10_11 101100 # endif @@ -237,17 +225,8 @@ # if !defined(__MAC_10_13) # define __MAC_10_13 101300 # endif -# if !defined(MAC_OS_X_VERSION_10_7) -# define MAC_OS_X_VERSION_10_7 1070 -# endif -# if !defined(MAC_OS_X_VERSION_10_8) -# define MAC_OS_X_VERSION_10_8 1080 -# endif -# if !defined(MAC_OS_X_VERSION_10_9) -# define MAC_OS_X_VERSION_10_9 1090 -# endif -# if !defined(MAC_OS_X_VERSION_10_10) -# define MAC_OS_X_VERSION_10_10 101000 +# if !defined(__MAC_10_14) +# define __MAC_10_14 101400 # endif # if !defined(MAC_OS_X_VERSION_10_11) # define MAC_OS_X_VERSION_10_11 101100 @@ -258,55 +237,10 @@ # if !defined(MAC_OS_X_VERSION_10_13) # define MAC_OS_X_VERSION_10_13 101300 # endif -# -# if !defined(__IPHONE_4_3) -# define __IPHONE_4_3 40300 -# endif -# if !defined(__IPHONE_5_0) -# define __IPHONE_5_0 50000 -# endif -# if !defined(__IPHONE_5_1) -# define __IPHONE_5_1 50100 -# endif -# if !defined(__IPHONE_6_0) -# define __IPHONE_6_0 60000 -# endif -# if !defined(__IPHONE_6_1) -# define __IPHONE_6_1 60100 -# endif -# if !defined(__IPHONE_7_0) -# define __IPHONE_7_0 70000 -# endif -# if !defined(__IPHONE_7_1) -# define __IPHONE_7_1 70100 -# endif -# if !defined(__IPHONE_8_0) -# define __IPHONE_8_0 80000 -# endif -# if !defined(__IPHONE_8_1) -# define __IPHONE_8_1 80100 -# endif -# if !defined(__IPHONE_8_2) -# define __IPHONE_8_2 80200 -# endif -# if !defined(__IPHONE_8_3) -# define __IPHONE_8_3 80300 -# endif -# if !defined(__IPHONE_8_4) -# define __IPHONE_8_4 80400 -# endif -# if !defined(__IPHONE_9_0) -# define __IPHONE_9_0 90000 -# endif -# if !defined(__IPHONE_9_1) -# define __IPHONE_9_1 90100 -# endif -# if !defined(__IPHONE_9_2) -# define __IPHONE_9_2 90200 -# endif -# if !defined(__IPHONE_9_3) -# define __IPHONE_9_3 90300 +# if !defined(MAC_OS_X_VERSION_10_14) +# define MAC_OS_X_VERSION_10_14 101400 # endif +# # if !defined(__IPHONE_10_0) # define __IPHONE_10_0 100000 # endif @@ -322,6 +256,9 @@ # if !defined(__IPHONE_11_0) # define __IPHONE_11_0 110000 # endif +# if !defined(__IPHONE_12_0) +# define __IPHONE_12_0 120000 +# endif #endif #ifdef __LSB_VERSION__ diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 0d9a6c8749..013d531581 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -842,7 +842,7 @@ QDebug &QDebug::resetFormat() /*! \class QDebugStateSaver \inmodule QtCore - \brief Convenience class for custom QDebug operators + \brief Convenience class for custom QDebug operators. Saves the settings used by QDebug, and restores them upon destruction, then calls \l {QDebug::maybeSpace()}{maybeSpace()}, to separate arguments with a space if diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 048669b92f..c0c5f9d744 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -302,7 +302,8 @@ QStringList QInotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, | IN_DELETE_SELF ))); if (wd < 0) { - qWarning().nospace() << "inotify_add_watch(" << path << ") failed: " << QSystemError(errno, QSystemError::NativeError).toString(); + if (errno != ENOENT) + qErrnoWarning("inotify_add_watch(%ls) failed:", path.constData()); continue; } diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 6b8028460c..277f8d4230 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -153,9 +153,8 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) HMODULE hPsapi = LoadLibraryA("psapi"); if (!hPsapi) return QString(); - - GetModuleFileNameExFunc qGetModuleFileNameEx - = (GetModuleFileNameExFunc)GetProcAddress(hPsapi, "GetModuleFileNameExW"); + GetModuleFileNameExFunc qGetModuleFileNameEx = reinterpret_cast<GetModuleFileNameExFunc>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hPsapi, "GetModuleFileNameExW"))); if (!qGetModuleFileNameEx) { FreeLibrary(hPsapi); return QString(); diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index d826110ec7..3a6f67521f 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -182,8 +182,8 @@ QPersistentModelIndex::~QPersistentModelIndex() Returns \c{true} if this persistent model index is equal to the \a other persistent model index; otherwise returns \c{false}. - All values in the persistent model index are used when comparing - with another persistent model index. + The internal data pointer, row, column, and model values in the persistent + model index are used when comparing with another persistent model index. */ bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const @@ -199,8 +199,8 @@ bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const Returns \c{true} if this persistent model index is smaller than the \a other persistent model index; otherwise returns \c{false}. - All values in the persistent model index are used when comparing - with another persistent model index. + The internal data pointer, row, column, and model values in the persistent + model index are used when comparing with another persistent model index. */ bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const @@ -275,13 +275,11 @@ QPersistentModelIndex::operator const QModelIndex&() const } /*! - \fn bool QPersistentModelIndex::operator==(const QModelIndex &other) const - Returns \c{true} if this persistent model index refers to the same location as the \a other model index; otherwise returns \c{false}. - All values in the persistent model index are used when comparing with - another model index. + The internal data pointer, row, column, and model values in the persistent + model index are used when comparing with another model index. */ bool QPersistentModelIndex::operator==(const QModelIndex &other) const @@ -1167,8 +1165,8 @@ void QAbstractItemModel::resetInternalData() Returns \c{true} if this model index refers to the same location as the \a other model index; otherwise returns \c{false}. - All values in the model index are used when comparing with another model - index. + The internal data pointer, row, column, and model values are used when + comparing with another model index. */ diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp index e984ec194e..c1e23dbd0c 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.cpp +++ b/src/corelib/itemmodels/qidentityproxymodel.cpp @@ -83,7 +83,7 @@ class QIdentityProxyModelPrivate : public QAbstractProxyModelPrivate \since 4.8 \class QIdentityProxyModel \inmodule QtCore - \brief The QIdentityProxyModel class proxies its source model unmodified + \brief The QIdentityProxyModel class proxies its source model unmodified. \ingroup model-view diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index ca8bd30698..c528b16f9c 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -120,7 +120,7 @@ mac { LIBS_PRIVATE += -framework Foundation - osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit + osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit -framework Security ios|tvos { # We need UIKit for UIApplication in qeventdispatcher_cf.mm diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 97a3acacd2..0d7bfad943 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -44,6 +44,10 @@ #include <AppKit/NSText.h> #endif +#if defined(QT_PLATFORM_UIKIT) +#include <UIKit/UIKit.h> +#endif + #include <qdebug.h> QT_BEGIN_NAMESPACE @@ -190,6 +194,43 @@ AppleApplication *qt_apple_sharedApplication() } #endif +#if defined(Q_OS_MACOS) && !defined(QT_BOOTSTRAPPED) +bool qt_apple_isSandboxed() +{ + static bool isSandboxed = []() { + QCFType<SecStaticCodeRef> staticCode = nullptr; + NSURL *bundleUrl = [[NSBundle mainBundle] bundleURL]; + if (SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleUrl, + kSecCSDefaultFlags, &staticCode) != errSecSuccess) + return false; + + QCFType<SecRequirementRef> sandboxRequirement; + if (SecRequirementCreateWithString(CFSTR("entitlement[\"com.apple.security.app-sandbox\"] exists"), + kSecCSDefaultFlags, &sandboxRequirement) != errSecSuccess) + return false; + + if (SecStaticCodeCheckValidityWithErrors(staticCode, + kSecCSBasicValidateOnly, sandboxRequirement, nullptr) != errSecSuccess) + return false; + + return true; + }(); + return isSandboxed; +} + +QT_END_NAMESPACE +@implementation NSObject (QtSandboxHelpers) +- (id)qt_valueForPrivateKey:(NSString *)key +{ + if (qt_apple_isSandboxed()) + return nil; + + return [self valueForKey:key]; +} +@end +QT_BEGIN_NAMESPACE +#endif + #ifdef Q_OS_MACOS /* Ensure that Objective-C objects auto-released in main(), directly or indirectly, diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 84978bbbc3..1161e363b7 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -192,6 +192,17 @@ QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool); Q_CORE_EXPORT void qt_apple_check_os_version(); Q_CORE_EXPORT bool qt_apple_isApplicationExtension(); +#if defined(Q_OS_MACOS) && !defined(QT_BOOTSTRAPPED) +Q_CORE_EXPORT bool qt_apple_isSandboxed(); +# ifdef __OBJC__ +QT_END_NAMESPACE +@interface NSObject (QtSandboxHelpers) +- (id)qt_valueForPrivateKey:(NSString *)key; +@end +QT_BEGIN_NAMESPACE +# endif +#endif + #if !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WATCHOS) QT_END_NAMESPACE # if defined(Q_OS_MACOS) diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp index 97b98a1376..4fba30050d 100644 --- a/src/corelib/kernel/qdeadlinetimer.cpp +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -344,6 +344,11 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time deadline.setRemainingTime(250ms); \endcode + \note Qt detects the necessary C++14 compiler support by way of the feature + test recommendations from + \l{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations} + {C++ Committee's Standing Document 6}. + \sa setDeadline(), remainingTime(), hasExpired(), isForever() */ diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index a0969ee908..cf68752f85 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -1413,8 +1413,8 @@ namespace QtPrivate static char checkType(void (X::*)()); static void *checkType(void (T::*)()); enum { - IsRealGadget = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *), - IsGadgetOrDerivedFrom = true + IsRealGadget = !IsPointerToTypeDerivedFromQObject<T*>::Value && sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *), + IsGadgetOrDerivedFrom = !IsPointerToTypeDerivedFromQObject<T*>::Value }; }; diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 3717d7a19e..5387d549c6 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -511,7 +511,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object) /*! \class QSignalBlocker - \brief Exception-safe wrapper around QObject::blockSignals() + \brief Exception-safe wrapper around QObject::blockSignals(). \since 5.3 \ingroup objectmodel \inmodule QtCore diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 802c8d72f6..d8d520ff58 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -117,7 +117,7 @@ QT_BEGIN_NAMESPACE All timer types may time out later than expected if the system is busy or unable to provide the requested accuracy. In such a case of timeout - overrun, Qt will emit activated() only once, even if multiple timeouts have + overrun, Qt will emit timeout() only once, even if multiple timeouts have expired, and then will resume the original interval. \section1 Alternatives to QTimer diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h index 4ae4a3d76c..eae0146553 100644 --- a/src/corelib/serialization/qdatastream.h +++ b/src/corelib/serialization/qdatastream.h @@ -152,7 +152,7 @@ public: QDataStream &operator>>(qint16 &i); QDataStream &operator>>(quint16 &i); QDataStream &operator>>(qint32 &i); - QDataStream &operator>>(quint32 &i); + inline QDataStream &operator>>(quint32 &i); QDataStream &operator>>(qint64 &i); QDataStream &operator>>(quint64 &i); QDataStream &operator>>(std::nullptr_t &ptr) { ptr = nullptr; return *this; } @@ -168,7 +168,7 @@ public: QDataStream &operator<<(qint16 i); QDataStream &operator<<(quint16 i); QDataStream &operator<<(qint32 i); - QDataStream &operator<<(quint32 i); + inline QDataStream &operator<<(quint32 i); QDataStream &operator<<(qint64 i); QDataStream &operator<<(quint64 i); QDataStream &operator<<(std::nullptr_t) { return *this; } diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index a92dd71df5..f18c4cc8e7 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -2265,7 +2265,7 @@ QXmlStreamAttributes QXmlStreamReader::attributes() const \inmodule QtCore \since 4.3 \reentrant - \brief The QXmlStreamAttribute class represents a single XML attribute + \brief The QXmlStreamAttribute class represents a single XML attribute. \ingroup xml-tools diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc index e607d090c5..7db65dacd3 100644 --- a/src/corelib/thread/qfuture.qdoc +++ b/src/corelib/thread/qfuture.qdoc @@ -3,9 +3,9 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -14,25 +14,13 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/thread/qfuturesynchronizer.qdoc b/src/corelib/thread/qfuturesynchronizer.qdoc index c9c402ff87..67dafb039e 100644 --- a/src/corelib/thread/qfuturesynchronizer.qdoc +++ b/src/corelib/thread/qfuturesynchronizer.qdoc @@ -3,9 +3,9 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -14,25 +14,13 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index f418ac1205..82d439a728 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -501,7 +501,7 @@ bool QSemaphore::tryAcquire(int n, int timeout) /*! \class QSemaphoreReleaser - \brief The QSemaphoreReleaser class provides exception-safe deferral of a QSemaphore::release() call + \brief The QSemaphoreReleaser class provides exception-safe deferral of a QSemaphore::release() call. \since 5.10 \ingroup thread \inmodule QtCore diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 651f260f0e..d8d8be7a26 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3917,8 +3917,8 @@ T toIntegral_helper(const char *data, bool *ok, int base) Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3943,8 +3943,8 @@ qlonglong QByteArray::toLongLong(bool *ok, int base) const Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -3968,8 +3968,8 @@ qulonglong QByteArray::toULongLong(bool *ok, int base) const Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \snippet code/src_corelib_tools_qbytearray.cpp 36 @@ -3995,8 +3995,8 @@ int QByteArray::toInt(bool *ok, int base) const Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -4022,8 +4022,8 @@ uint QByteArray::toUInt(bool *ok, int base) const Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \snippet code/src_corelib_tools_qbytearray.cpp 37 @@ -4050,8 +4050,8 @@ long QByteArray::toLong(bool *ok, int base) const Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -4074,8 +4074,8 @@ ulong QByteArray::toULong(bool *ok, int base) const Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -4099,8 +4099,8 @@ short QByteArray::toShort(bool *ok, int base) const Returns 0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. @@ -4119,8 +4119,8 @@ ushort QByteArray::toUShort(bool *ok, int base) const Returns 0.0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \snippet code/src_corelib_tools_qbytearray.cpp 38 @@ -4146,8 +4146,8 @@ double QByteArray::toDouble(bool *ok) const Returns 0.0 if the conversion fails. - If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to - false; otherwise *\a{ok} is set to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \note The conversion of the number is performed in the default C locale, irrespective of the user's locale. diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index 06d01f9829..a54afc5a9d 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -334,7 +334,7 @@ int qFindByteArray( \class QStaticByteArrayMatcher \since 5.9 \inmodule QtCore - \brief The QStaticByteArrayMatcher class is a compile-time version of QByteArrayMatcher + \brief The QStaticByteArrayMatcher class is a compile-time version of QByteArrayMatcher. \ingroup tools \ingroup string-processing @@ -366,6 +366,11 @@ int qFindByteArray( Since this class is designed to do all the up-front calculations at compile-time, it does not offer a setPattern() method. + \note Qt detects the necessary C++14 compiler support by way of the feature + test recommendations from + \l{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations} + {C++ Committee's Standing Document 6}. + \sa QByteArrayMatcher, QStringMatcher */ diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 9c1e78ee61..e70630eb12 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1262,8 +1262,8 @@ QString QLocale::scriptToString(QLocale::Script script) If the conversion fails the function returns 0. - If \a ok is not 0, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1280,8 +1280,8 @@ short QLocale::toShort(const QString &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not 0, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1298,8 +1298,8 @@ ushort QLocale::toUShort(const QString &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not 0, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1316,8 +1316,8 @@ int QLocale::toInt(const QString &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not 0, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1334,8 +1334,8 @@ uint QLocale::toUInt(const QString &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not 0, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1354,8 +1354,8 @@ qlonglong QLocale::toLongLong(const QString &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not 0, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1371,8 +1371,11 @@ qulonglong QLocale::toULongLong(const QString &s, bool *ok) const Returns the float represented by the localized string \a s, or 0.0 if the conversion failed. - If \a ok is not 0, reports failure by setting - *ok to false and success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. + + This function does not fall back to the 'C' locale if the string + cannot be interpreted in this locale. This function ignores leading and trailing whitespace. @@ -1388,12 +1391,11 @@ float QLocale::toFloat(const QString &s, bool *ok) const Returns the double represented by the localized string \a s, or 0.0 if the conversion failed. - If \a ok is not 0, reports failure by setting - *ok to false and success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. - Unlike QString::toDouble(), this function does not use - the 'C' locale if the string cannot be interpreted in this - locale. + This function does not fall back to the 'C' locale if the string + cannot be interpreted in this locale. \snippet code/src_corelib_tools_qlocale.cpp 3 @@ -1415,8 +1417,8 @@ double QLocale::toDouble(const QString &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1435,8 +1437,8 @@ short QLocale::toShort(const QStringRef &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1455,8 +1457,8 @@ ushort QLocale::toUShort(const QStringRef &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1475,8 +1477,8 @@ int QLocale::toInt(const QStringRef &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1495,8 +1497,8 @@ uint QLocale::toUInt(const QStringRef &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1517,8 +1519,8 @@ qlonglong QLocale::toLongLong(const QStringRef &s, bool *ok) const If the conversion fails the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1536,8 +1538,11 @@ qulonglong QLocale::toULongLong(const QStringRef &s, bool *ok) const Returns the float represented by the localized string \a s, or 0.0 if the conversion failed. - If \a ok is not null, reports failure by setting - *ok to false and success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. + + This function does not fall back to the 'C' locale if the string + cannot be interpreted in this locale. This function ignores leading and trailing whitespace. @@ -1555,12 +1560,11 @@ float QLocale::toFloat(const QStringRef &s, bool *ok) const Returns the double represented by the localized string \a s, or 0.0 if the conversion failed. - If \a ok is not null, reports failure by setting - *ok to false and success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. - Unlike QString::toDouble(), this function does not fall back to - the "C" locale if the string cannot be interpreted in this - locale. + This function does not fall back to the 'C' locale if the string + cannot be interpreted in this locale. \snippet code/src_corelib_tools_qlocale.cpp 3 @@ -1585,8 +1589,8 @@ double QLocale::toDouble(const QStringRef &s, bool *ok) const If the conversion fails, the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1605,8 +1609,8 @@ short QLocale::toShort(QStringView s, bool *ok) const If the conversion fails, the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1625,8 +1629,8 @@ ushort QLocale::toUShort(QStringView s, bool *ok) const If the conversion fails, the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1645,8 +1649,8 @@ int QLocale::toInt(QStringView s, bool *ok) const If the conversion fails, the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1665,8 +1669,8 @@ uint QLocale::toUInt(QStringView s, bool *ok) const If the conversion fails, the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1687,8 +1691,8 @@ qlonglong QLocale::toLongLong(QStringView s, bool *ok) const If the conversion fails, the function returns 0. - If \a ok is not null, failure is reported by setting *ok to false, and - success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1706,8 +1710,8 @@ qulonglong QLocale::toULongLong(QStringView s, bool *ok) const Returns the float represented by the localized string \a s, or 0.0 if the conversion failed. - If \a ok is not null, reports failure by setting - *ok to false and success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. This function ignores leading and trailing whitespace. @@ -1725,8 +1729,8 @@ float QLocale::toFloat(QStringView s, bool *ok) const Returns the double represented by the localized string \a s, or 0.0 if the conversion failed. - If \a ok is not null, reports failure by setting - *ok to false and success by setting *ok to true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. Unlike QString::toDouble(), this function does not fall back to the "C" locale if the string cannot be interpreted in this diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 22cf516b68..2d5fd2a00e 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -46,7 +46,7 @@ /*! \class QSharedPointer \inmodule QtCore - \brief The QSharedPointer class holds a strong reference to a shared pointer + \brief The QSharedPointer class holds a strong reference to a shared pointer. \since 4.5 \reentrant @@ -315,7 +315,7 @@ /*! \class QWeakPointer \inmodule QtCore - \brief The QWeakPointer class holds a weak reference to a shared pointer + \brief The QWeakPointer class holds a weak reference to a shared pointer. \since 4.5 \reentrant @@ -373,7 +373,7 @@ /*! \class QEnableSharedFromThis \inmodule QtCore - \brief A base class that allows obtaining a QSharedPointer for an object already managed by a shared pointer + \brief A base class that allows obtaining a QSharedPointer for an object already managed by a shared pointer. \since 5.4 You can inherit this class when you need to create a QSharedPointer diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index b6731cffcd..d3a6851e2c 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7104,8 +7104,8 @@ QString QString::vasprintf(const char *cformat, va_list ap) base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7146,8 +7146,8 @@ qlonglong QString::toIntegral_helper(const QChar *data, int len, bool *ok, int b base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7190,8 +7190,8 @@ qulonglong QString::toIntegral_helper(const QChar *data, uint len, bool *ok, int base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7221,8 +7221,8 @@ long QString::toLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7251,8 +7251,8 @@ ulong QString::toULong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7280,8 +7280,8 @@ int QString::toInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7309,8 +7309,8 @@ uint QString::toUInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7338,8 +7338,8 @@ short QString::toShort(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -7368,8 +7368,8 @@ ushort QString::toUShort(bool *ok, int base) const Returns 0.0 if the conversion fails. - If a conversion error occurs, \c{*}\a{ok} is set to \c false; - otherwise \c{*}\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. \snippet qstring/main.cpp 66 @@ -7404,21 +7404,30 @@ double QString::toDouble(bool *ok) const /*! Returns the string converted to a \c float value. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. Returns 0.0 if the conversion fails. + Returns 0.0 if the conversion fails. - This function ignores leading and trailing whitespace. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. + + \warning The QString content may only contain valid numerical characters + which includes the plus/minus sign, the characters g and e used in scientific + notation, and the decimal point. Including the unit or additional characters + leads to a conversion error. The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat() + For historical reasons, this function does not handle + thousands group separators. If you need to convert such numbers, + use QLocale::toFloat(). + Example: \snippet qstring/main.cpp 71 This function ignores leading and trailing whitespace. - \sa number(), toDouble(), toInt(), QLocale::toFloat() + \sa number(), toDouble(), toInt(), QLocale::toFloat(), trimmed() */ float QString::toFloat(bool *ok) const @@ -7611,13 +7620,12 @@ QString QString::number(qulonglong n, int base) QString QString::number(double n, char f, int prec) { QLocaleData::DoubleForm form = QLocaleData::DFDecimal; - uint flags = 0; + uint flags = QLocaleData::ZeroPadExponent; if (qIsUpper(f)) - flags = QLocaleData::CapitalEorX; - f = qToLower(f); + flags |= QLocaleData::CapitalEorX; - switch (f) { + switch (qToLower(f)) { case 'f': form = QLocaleData::DFDecimal; break; @@ -8676,14 +8684,13 @@ QString QString::arg(double a, int fieldWidth, char fmt, int prec, QChar fillCha unsigned flags = QLocaleData::NoFlags; if (fillChar == QLatin1Char('0')) - flags = QLocaleData::ZeroPadded; + flags |= QLocaleData::ZeroPadded; if (qIsUpper(fmt)) flags |= QLocaleData::CapitalEorX; - fmt = qToLower(fmt); QLocaleData::DoubleForm form = QLocaleData::DFDecimal; - switch (fmt) { + switch (qToLower(fmt)) { case 'f': form = QLocaleData::DFDecimal; break; @@ -8702,7 +8709,7 @@ QString QString::arg(double a, int fieldWidth, char fmt, int prec, QChar fillCha QString arg; if (d.occurrences > d.locale_occurrences) - arg = QLocaleData::c()->doubleToString(a, prec, form, fieldWidth, flags); + arg = QLocaleData::c()->doubleToString(a, prec, form, fieldWidth, flags | QLocaleData::ZeroPadExponent); QString locale_arg; if (d.locale_occurrences > 0) { @@ -11772,8 +11779,8 @@ QStringRef QStringRef::trimmed() const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11797,8 +11804,8 @@ qint64 QStringRef::toLongLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11824,8 +11831,8 @@ quint64 QStringRef::toULongLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11851,8 +11858,8 @@ long QStringRef::toLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11877,8 +11884,8 @@ ulong QStringRef::toULong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11902,8 +11909,8 @@ int QStringRef::toInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11927,8 +11934,8 @@ uint QStringRef::toUInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11952,8 +11959,8 @@ short QStringRef::toShort(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -11978,8 +11985,8 @@ ushort QStringRef::toUShort(bool *ok, int base) const Returns 0.0 if the conversion fails. - If a conversion error occurs, \c{*}\a{ok} is set to \c false; - otherwise \c{*}\a{ok} is set to \c true. + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toDouble() @@ -12001,8 +12008,10 @@ double QStringRef::toDouble(bool *ok) const /*! Returns the string converted to a \c float value. - If a conversion error occurs, *\a{ok} is set to \c false; otherwise - *\a{ok} is set to \c true. Returns 0.0 if the conversion fails. + Returns 0.0 if the conversion fails. + + If \a ok is not \c nullptr, failure is reported by setting *\a{ok} + to \c false, and success by setting *\a{ok} to \c true. The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat() diff --git a/src/corelib/tools/qstringiterator.qdoc b/src/corelib/tools/qstringiterator.qdoc index caec8803f3..9d7c54ce9f 100644 --- a/src/corelib/tools/qstringiterator.qdoc +++ b/src/corelib/tools/qstringiterator.qdoc @@ -3,9 +3,9 @@ ** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -14,25 +14,13 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/corelib/tools/qtimezoneprivate_android.cpp b/src/corelib/tools/qtimezoneprivate_android.cpp index c3f8c3e0d9..b60093617f 100644 --- a/src/corelib/tools/qtimezoneprivate_android.cpp +++ b/src/corelib/tools/qtimezoneprivate_android.cpp @@ -82,7 +82,24 @@ void QAndroidTimeZonePrivate::init(const QByteArray &ianaId) QJNIObjectPrivate jo_ianaId = QJNIObjectPrivate::fromString( QString::fromUtf8(ianaId) ); androidTimeZone = QJNIObjectPrivate::callStaticObjectMethod( "java.util.TimeZone", "getTimeZone", "(Ljava/lang/String;)Ljava/util/TimeZone;", static_cast<jstring>(jo_ianaId.object()) ); - if (ianaId.isEmpty()) + // Painfully, JNI gives us back a default zone object if it doesn't + // recognize the name; so check for whether ianaId is a recognized name of + // the zone object we got and ignore the zone if not. + bool found = false; + // Try checking ianaId against getID(), getDisplayName(): + QJNIObjectPrivate jname = androidTimeZone.callObjectMethod("getID", "()Ljava/lang/String;"); + found = (jname.toString().toUtf8() == ianaId); + for (int style = 1; !found && style-- > 0;) { + for (int dst = 1; !found && dst-- > 0;) { + jname = androidTimeZone.callObjectMethod("getDisplayName", "(ZI;)Ljava/lang/String;", + bool(dst), style); + found = (jname.toString().toUtf8() == ianaId); + } + } + + if (!found) + m_id.clear(); + else if (ianaId.isEmpty()) m_id = systemTimeZoneId(); else m_id = ianaId; diff --git a/src/corelib/tools/qvector.qdoc b/src/corelib/tools/qvector.qdoc index 9a08b030f7..75b17a4207 100644 --- a/src/corelib/tools/qvector.qdoc +++ b/src/corelib/tools/qvector.qdoc @@ -3,9 +3,9 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -14,25 +14,13 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ |