diff options
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 106 |
1 files changed, 97 insertions, 9 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 01f534cc0f..30a44aeef8 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -530,6 +530,31 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value)); made private. In that case, no error would be reported, but your application would probably crash when you called a member function of \c{w}. + + \sa Q_DISABLE_COPY_MOVE, Q_DISABLE_MOVE +*/ + +/*! + \macro Q_DISABLE_MOVE(Class) + \relates QObject + + Disables the use of move constructors and move assignment operators + for the given \a Class. + + \sa Q_DISABLE_COPY, Q_DISABLE_COPY_MOVE + \since 5.13 +*/ + +/*! + \macro Q_DISABLE_COPY_MOVE(Class) + \relates QObject + + A convenience macro that disables the use of copy constructors, assignment + operators, move constructors and move assignment operators for the given + \a Class, combining Q_DISABLE_COPY and Q_DISABLE_MOVE. + + \sa Q_DISABLE_COPY, Q_DISABLE_MOVE + \since 5.13 */ /*! @@ -1533,6 +1558,13 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! + \macro Q_OS_WASM + \relates <QtGlobal> + + Defined on Web Assembly. +*/ + +/*! \macro Q_CC_SYM \relates <QtGlobal> @@ -1966,11 +1998,11 @@ bool qSharedBuild() Q_DECL_NOTHROW a specified version of Qt or any earlier version. The default version number is 5.0, meaning that functions deprecated in or before Qt 5.0 will not be included. - Examples: - When using a future release of Qt 5, set QT_DISABLE_DEPRECATED_BEFORE=0x050100 to - disable functions deprecated in Qt 5.1 and earlier. In any release, set - QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones - deprecated in Qt 5.0 + For instance, when using a future release of Qt 5, set + \c{QT_DISABLE_DEPRECATED_BEFORE=0x050100} to disable functions deprecated in + Qt 5.1 and earlier. In any release, set + \c{QT_DISABLE_DEPRECATED_BEFORE=0x000000} to enable all functions, including + the ones deprecated in Qt 5.0. \sa QT_DEPRECATED_WARNINGS */ @@ -1980,12 +2012,24 @@ bool qSharedBuild() Q_DECL_NOTHROW \macro QT_DEPRECATED_WARNINGS \relates <QtGlobal> - If this macro is defined, the compiler will generate warnings if API declared as + Since Qt 5.13, this macro has no effect. In Qt 5.12 and before, if this macro + is defined, the compiler will generate warnings if any API declared as deprecated by Qt is used. - \sa QT_DISABLE_DEPRECATED_BEFORE + \sa QT_DISABLE_DEPRECATED_BEFORE, QT_NO_DEPRECATED_WARNINGS */ +/*! + \macro QT_NO_DEPRECATED_WARNINGS + \relates <QtGlobal> + \since 5.13 + + This macro can be used to suppress deprecation warnings that would otherwise + be generated when using deprecated APIs. + + \sa QT_DISABLE_DEPRECATED_BEFORE +*/ + #if defined(QT_BUILD_QMAKE) // needed to bootstrap qmake static const unsigned int qt_one = 1; @@ -2156,11 +2200,20 @@ struct QUnixOSVersion static QString unquote(const char *begin, const char *end) { + // man os-release says: + // Variable assignment values must be enclosed in double + // or single quotes if they include spaces, semicolons or + // other special characters outside of A–Z, a–z, 0–9. Shell + // special characters ("$", quotes, backslash, backtick) + // must be escaped with backslashes, following shell style. + // All strings should be in UTF-8 format, and non-printable + // characters should not be used. It is not supported to + // concatenate multiple individually quoted strings. if (*begin == '"') { Q_ASSERT(end[-1] == '"'); - return QString::fromLatin1(begin + 1, end - begin - 2); + return QString::fromUtf8(begin + 1, end - begin - 2); } - return QString::fromLatin1(begin, end - begin); + return QString::fromUtf8(begin, end - begin); } static QByteArray getEtcFileContent(const char *filename) { @@ -3256,6 +3309,34 @@ void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); } // add thread-safety for the Qt wrappers. static QBasicMutex environmentMutex; +/* + Wraps tzset(), which accesses the environment, so should only be called while + we hold the lock on the environment mutex. +*/ +void qTzSet() +{ + QMutexLocker locker(&environmentMutex); +#if defined(Q_OS_WIN) + _tzset(); +#else + tzset(); +#endif // Q_OS_WIN +} + +/* + Wrap mktime(), which is specified to behave as if it called tzset(), hence + shares its implicit environment-dependence. +*/ +time_t qMkTime(struct tm *when) +{ + QMutexLocker locker(&environmentMutex); + return mktime(when); +} + +// Also specified to behave as if they call tzset(): +// localtime() -- but not localtime_r(), which we use when threaded +// strftime() -- not used (except in tests) + /*! \relates <QtGlobal> \threadsafe @@ -4054,6 +4135,13 @@ bool qunsetenv(const char *varName) Example of a movable type: \snippet code/src_corelib_global_qglobal.cpp 39 + + Qt will try to detect the class of a type using std::is_trivial or + std::is_trivially_copyable. Use this macro to tune the behavior. + For instance many types would be candidates for Q_MOVABLE_TYPE despite + not being trivially-copyable. For binary compatibility reasons, QList + optimizations are only enabled if there is an explicit + Q_DECLARE_TYPEINFO even for trivially-copyable types. */ /*! |