diff options
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qfloat16.h | 2 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 34 | ||||
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.cpp | 9 | ||||
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.h | 1 | ||||
-rw-r--r-- | src/corelib/global/qrandom.cpp | 73 |
6 files changed, 70 insertions, 53 deletions
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 054d503249..89a62a93db 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -141,7 +141,7 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW #elif defined (__ARM_FP16_FORMAT_IEEE) __fp16 f16; memcpy(&f16, &b16, sizeof(quint16)); - return f16; + return float(f16); #else quint32 u = mantissatable[offsettable[b16 >> 10] + (b16 & 0x3ff)] + exponenttable[b16 >> 10]; diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 33d7d58df4..f2f807e1d9 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2385,6 +2385,7 @@ Lollipop Marshmallow Nougat Nougat +Oreo */ static const char versions_string[] = "\0" @@ -2400,13 +2401,14 @@ Nougat "Lollipop\0" "Marshmallow\0" "Nougat\0" + "Oreo\0" "\0"; static const int versions_indices[] = { 0, 0, 0, 1, 9, 15, 15, 15, 22, 28, 28, 40, 40, 40, 50, 50, 69, 69, 69, 80, 80, 87, 87, 96, - 108, 108, -1 + 108, 108, 115, -1 }; static const int versions_count = (sizeof versions_indices) / (sizeof versions_indices[0]); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 93f468f64b..e74ba4026a 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -128,15 +128,13 @@ \value AA_PluginApplication Indicates that Qt is used to author a plugin. Depending on the operating system, it suppresses specific initializations that do not necessarily make sense in the plugin case. - For example on OS X, this includes avoiding loading our nib for the main + For example on \macos, this includes avoiding loading our nib for the main menu and not taking possession of the native menu bar. Setting this attribute to true will also set the AA_DontUseNativeMenuBar attribute to true. It also disables native event filters. This attribute has been added in Qt 5.7. It must be set before - \l {QGuiApplication}{Q(Gui)Application} is constructed. + \l {QGuiApplication}{Q\(Gui\)Application} is constructed. - \value AA_MacPluginApplication This attribute has been deprecated. - Use AA_PluginApplication instead. \value AA_DontUseNativeMenuBar All menubars created while this attribute is set to true won't be used as a native menubar (e.g, the menubar at @@ -155,8 +153,6 @@ to be consistent in pixels-per-point across devices rather than defining 1 point as 1/72 inch. - \value AA_X11InitThreads This value is obsolete and has no effect. - \value AA_SynthesizeTouchForUnhandledMouseEvents All mouse events that are not accepted by the application will be translated to touch events instead. @@ -179,12 +175,13 @@ \value AA_UseDesktopOpenGL Forces the usage of desktop OpenGL (for example, \e opengl32.dll or \e libGL.so) on platforms that use dynamic loading of the OpenGL implementation. This value has been added in Qt 5.3. - This attribute must be set before Q(Gui)Application is constructed. + This attribute must be set before \l {QGuiApplication} + {Q\(Gui\)Application} is constructed. \value AA_UseOpenGLES Forces the usage of OpenGL ES 2.0 or higher on platforms that use dynamic loading of the OpenGL implementation. This value has been added in Qt 5.3. This attribute must be set - before Q(Gui)Application is constructed. + before \l {QGuiApplication}{Q\(Gui\)Application} is constructed. \value AA_UseSoftwareOpenGL Forces the usage of a software based OpenGL implementation on platforms that use dynamic loading of the OpenGL @@ -196,24 +193,25 @@ variable \e QT_OPENGL_DLL. See the platform-specific pages, for instance \l{Qt for Windows}, for more information. This value has been added in Qt 5.4. This attribute must be set before - Q(Gui)Application is constructed. + \l {QGuiApplication}{Q\(Gui\)Application} is constructed. \value AA_ShareOpenGLContexts Enables resource sharing between the OpenGL contexts used by classes like QOpenGLWidget and QQuickWidget. This allows sharing OpenGL resources, like textures, between QOpenGLWidget instances that belong to different top-level windows. This value has been added in Qt 5.4. This attribute must be set before - Q(Gui)Application is constructed. + \l {QGuiApplication}{Q\(Gui\)Application} is constructed. \value AA_SetPalette Indicates whether a palette was explicitly set on the - QApplication/QGuiApplication. This value has been added in Qt 5.5. + \l {QGuiApplication}{Q\(Gui\)Application}. This value has been added + in Qt 5.5. \value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported platforms (see also \l{High DPI Displays}). Supported platforms are X11, Windows and Android. Enabling makes Qt scale the main (device independent) coordinate system according to display scale factors provided by the operating system. This corresponds to setting the - QT_AUTO_SCREEN_SCALE_FACTOR environment variable to 1. This value + QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 1. This value has been added in Qt 5.6. This attribute must be set before Q(Gui)Application is constructed. @@ -221,8 +219,9 @@ system coordinates. Note that the window system may do its own scaling, so this does not guarantee that QPaintDevice::devicePixelRatio() will be equal to 1. In addition, scale factors set by QT_SCALE_FACTOR will not - be affected. This corresponds to setting the QT_AUTO_SCREEN_SCALE_FACTOR - environment variable to 0. This value has been added in Qt 5.6. This + be affected. This corresponds to setting the + QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 0. + This value has been added in Qt 5.6. This attribute must be set before Q(Gui)Application is constructed. \value AA_UseStyleSheetPropagationInWidgetStyles By default, Qt Style Sheets @@ -281,7 +280,7 @@ This value has been added in Qt 5.10. For Qt 6, WindowContextHelpButtonHint will not be set by default. - The following values are obsolete: + The following values are deprecated or obsolete: \value AA_ImmediateWidgetCreation This attribute is no longer fully supported in Qt 5. It ensures that widgets are created @@ -293,9 +292,14 @@ Therefore, if it is important to minimize resource consumption, do not set this attribute. + \value AA_MacPluginApplication This attribute has been deprecated. + Use AA_PluginApplication instead. + \value AA_MSWindowsUseDirect3DByDefault This value is obsolete and has no effect. + \value AA_X11InitThreads This value is obsolete and has no effect. + \omitvalue AA_AttributeCount */ diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 83ba6e69ee..594dc6bc17 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -204,6 +204,7 @@ QOperatingSystemVersion QOperatingSystemVersion::current() { 6, 0 }, // API level 23 { 7, 0 }, // API level 24 { 7, 1 }, // API level 25 + { 8, 0 }, // API level 26 }; // This will give us at least the first 2 version components @@ -501,4 +502,12 @@ const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat = const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 = QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 1); +/*! + \variable QOperatingSystemVersion::AndroidOreo + \brief a version corresponding to Android Oreo (version 8.0, API level 26). + \since 5.9.2 + */ +const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo = + QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 0); + QT_END_NAMESPACE diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 2e319e66d5..1f3ff8e1ab 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -80,6 +80,7 @@ public: static const QOperatingSystemVersion AndroidMarshmallow; static const QOperatingSystemVersion AndroidNougat; static const QOperatingSystemVersion AndroidNougat_MR1; + static const QOperatingSystemVersion AndroidOreo; Q_DECL_CONSTEXPR QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1) diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index fb20f459b5..395bf0b0cb 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -918,15 +918,16 @@ void QRandomGenerator::fillRange_helper(void *buffer, void *bufferEnd) fill(buffer, bufferEnd); } -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) +#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) +typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage; +Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) + +#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) using SeedStorageType = QtPrivate::FunctionPointer<decltype(&srand)>::Arguments::Car; typedef QThreadStorage<SeedStorageType *> SeedStorage; Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value -#elif defined(Q_OS_ANDROID) -typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage; -Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) #endif /*! @@ -946,21 +947,7 @@ Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) */ void qsrand(uint seed) { -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) - SeedStorage *seedStorage = randTLS(); - if (seedStorage) { - SeedStorageType *pseed = seedStorage->localData(); - if (!pseed) - seedStorage->setLocalData(pseed = new SeedStorageType); - *pseed = seed; - } else { - //global static seed storage should always exist, - //except after being deleted by QGlobalStaticDeleter. - //But since it still can be called from destructor of another - //global static object, fallback to srand(seed) - srand(seed); - } -#elif defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) if (randomTLS->hasLocalData()) { randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed)); return; @@ -975,6 +962,20 @@ void qsrand(uint seed) } randomTLS->setLocalData(random); +#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = seed; + } else { + //global static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to srand(seed) + srand(seed); + } #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls @@ -1002,23 +1003,7 @@ void qsrand(uint seed) */ int qrand() { -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) - SeedStorage *seedStorage = randTLS(); - if (seedStorage) { - SeedStorageType *pseed = seedStorage->localData(); - if (!pseed) { - seedStorage->setLocalData(pseed = new SeedStorageType); - *pseed = 1; - } - return rand_r(pseed); - } else { - //global static seed storage should always exist, - //except after being deleted by QGlobalStaticDeleter. - //But since it still can be called from destructor of another - //global static object, fallback to rand() - return rand(); - } -#elif defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) AndroidRandomStorage *randomStorage = randomTLS(); if (!randomStorage) return rand(); @@ -1038,6 +1023,22 @@ int qrand() randomStorage->setLocalData(random); return random.callMethod<jint>("nextInt", "(I)I", RAND_MAX); +#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) { + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = 1; + } + return rand_r(pseed); + } else { + //global static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to rand() + return rand(); + } #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls |