From c35fef9d3b8bb77a7f303e3cd62c86cd00e57f5b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Jul 2016 19:56:41 -0700 Subject: Fix qnumeric_p.h with ICC's supplied math.h ICC supplies a math.h header that defines things like: #define isnan( __x__ ) __IMFC99MACRO1ARG_ALL( __x__, isnan, __, f, __, , __, l) So use the already-existing workaround for it. Since Qt 5.7 requires C++11, we can remove the check for that. Change-Id: I149e0540c00745fe8119fffd1463cc5caf341337 Reviewed-by: Simon Hausmann --- src/corelib/global/qnumeric_p.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 5705bc29c8..3451b2158d 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -66,8 +66,9 @@ #include #endif -#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || !defined(__cplusplus) || __cplusplus < 201103L) -#include +#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL) || !defined(__cplusplus)) +# include +# define QT_MATH_H_DEFINES_MACROS QT_BEGIN_NAMESPACE namespace qnumeric_std_wrapper { // the 'using namespace std' below is cases where the stdlib already put the math.h functions in the std namespace and undefined the macros. @@ -96,7 +97,8 @@ static inline bool isfinite(double d) { return !!_finite(d); } static inline bool isnan(float f) { return !!_isnan(f); } static inline bool isinf(float f) { return !_finite(f) && !_isnan(f); } static inline bool isfinite(float f) { return !!_finite(f); } -#elif !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || !defined(__cplusplus) || __cplusplus < 201103L) +#elif defined(QT_MATH_H_DEFINES_MACROS) +# undef QT_MATH_H_DEFINES_MACROS static inline bool isnan(double d) { return math_h_isnan(d); } static inline bool isinf(double d) { return math_h_isinf(d); } static inline bool isfinite(double d) { return math_h_isfinite(d); } -- cgit v1.2.3 From b0abe20d4b05e9e1e0800b8be64df15fa1660367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 2 Nov 2015 10:49:17 +0100 Subject: Darwin: Add QImage::toCGImage() conversion function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Move QT_FORWARD_DECLARE_CG to qglobal.h) This function converts to CGImage for supported formats. This is done by creating a CGImageRef that reuses the QImage data. The CGImage and QImage ref counting systems are bridged, implemented by using CGDataProvider that holds a copy of the QImage. Unlike the previous internal implementation this public version does not implicitly convert unsupported formats to ARGB32_Premultiplied. See included documentation for the complete description. Change-Id: Ie3984a7a8331e02a6f1c42943caaf76854e93538 Reviewed-by: Morten Johan Sørvig Reviewed-by: Gabriel de Dietrich --- src/corelib/global/qglobal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c5d891cc28..3d8baf7188 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -538,6 +538,12 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max #ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE # define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref #endif +#ifndef Q_FORWARD_DECLARE_CG_TYPE +#define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref; +#endif +#ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE +#define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref; +#endif #ifdef Q_OS_DARWIN # define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \ -- cgit v1.2.3 From a2ae631c04fee752e492f2c0b8fd25f06abffd6b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 3 Aug 2016 12:00:41 +0200 Subject: Doc: Change instances of '(Mac) OS X' to 'macOS' As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen --- src/corelib/global/qglobal.cpp | 54 +++++++++++++++++++------------------- src/corelib/global/qnamespace.qdoc | 50 +++++++++++++++++------------------ 2 files changed, 52 insertions(+), 52 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 8b6d8745f8..eff94f5361 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1001,8 +1001,8 @@ bool qSharedBuild() Q_DECL_NOTHROW \endlist Some constants are defined only on certain platforms. You can use - the preprocessor symbols Q_OS_WIN and Q_OS_OSX to test that - the application is compiled under Windows or OS X. + the preprocessor symbols Q_OS_WIN and Q_OS_MACOS to test that + the application is compiled under Windows or \macos. \sa QLibraryInfo */ @@ -1041,7 +1041,7 @@ bool qSharedBuild() Q_DECL_NOTHROW /*! \fn QSysInfo::MacVersion QSysInfo::macVersion() - Returns the version of Darwin (OS X or iOS) on which the + Returns the version of Darwin (\macos or iOS) on which the application is run, or MV_None if the operating system is not a version of Darwin. */ @@ -1117,24 +1117,24 @@ bool qSharedBuild() Q_DECL_NOTHROW \enum QSysInfo::MacVersion This enum provides symbolic names for the various versions of the - Darwin operating system, covering both OS X and iOS. The + Darwin operating system, covering both \macos and iOS. The QSysInfo::MacintoshVersion variable gives the version of the system on which the application is run. - \value MV_9 Mac OS 9 - \value MV_10_0 Mac OS X 10.0 - \value MV_10_1 Mac OS X 10.1 - \value MV_10_2 Mac OS X 10.2 - \value MV_10_3 Mac OS X 10.3 - \value MV_10_4 Mac OS X 10.4 - \value MV_10_5 Mac OS X 10.5 - \value MV_10_6 Mac OS X 10.6 - \value MV_10_7 Mac OS X 10.7 - \value MV_10_8 OS X 10.8 - \value MV_10_9 OS X 10.9 - \value MV_10_10 OS X 10.10 - \value MV_10_11 OS X 10.11 - \value MV_10_12 macOS 10.12 + \value MV_9 \macos 9 + \value MV_10_0 \macos 10.0 + \value MV_10_1 \macos 10.1 + \value MV_10_2 \macos 10.2 + \value MV_10_3 \macos 10.3 + \value MV_10_4 \macos 10.4 + \value MV_10_5 \macos 10.5 + \value MV_10_6 \macos 10.6 + \value MV_10_7 \macos 10.7 + \value MV_10_8 \macos 10.8 + \value MV_10_9 \macos 10.9 + \value MV_10_10 \macos 10.10 + \value MV_10_11 \macos 10.11 + \value MV_10_12 \macos 10.12 \value MV_Unknown An unknown and currently unsupported platform \value MV_CHEETAH Apple codename for MV_10_0 @@ -1179,7 +1179,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \macro Q_OS_DARWIN \relates - Defined on Darwin-based operating systems such as OS X and iOS. + Defined on Darwin-based operating systems such as \macos and iOS. */ /*! @@ -1200,7 +1200,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \macro Q_OS_MACOS \relates - Defined on macOS. + Defined on \macos. */ /*! @@ -2515,7 +2515,7 @@ static QString unknownText() Note that this function may return surprising values: it returns "linux" for all operating systems running Linux (including Android), "qnx" for all operating systems running QNX (including BlackBerry 10), "freebsd" for - Debian/kFreeBSD, and "darwin" for OS X and iOS. For information on the type + Debian/kFreeBSD, and "darwin" for \macos and iOS. For information on the type of product the application is running on, see productType(). \sa QFileSelector, kernelVersion(), productType(), productVersion(), prettyProductName() @@ -2539,7 +2539,7 @@ QString QSysInfo::kernelType() Returns the release version of the operating system kernel. On Windows, it returns the version of the NT or CE kernel. On Unix systems, including - Android, BlackBerry and OS X, it returns the same as the \c{uname -r} + Android, BlackBerry and \macos, it returns the same as the \c{uname -r} command would return. If the version could not be determined, this function may return an empty @@ -2584,11 +2584,11 @@ QString QSysInfo::kernelVersion() running the BlackBerry userspace, but "qnx" for all other QNX-based systems. - \b{Darwin, OS X and iOS note}: this function returns "macos" for macOS + \b{Darwin, \macos and iOS note}: this function returns "macos" for \macos systems, "ios" for iOS systems and "darwin" in case the system could not be determined. - \b{OS X note}: this function returns "osx" for versions of macOS prior to 10.12. + \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12. \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise. @@ -2646,8 +2646,8 @@ QString QSysInfo::productType() Returns the product version of the operating system in string form. If the version could not be determined, this function returns "unknown". - It will return the Android, BlackBerry, iOS, OS X, Windows full-product - versions on those systems. In particular, on OS X, iOS and Windows, the + It will return the Android, BlackBerry, iOS, \macos, Windows full-product + versions on those systems. In particular, on \macos, iOS and Windows, the returned string is similar to the macVersion() or windowsVersion() enums. On Linux systems, it will try to determine the distribution version and will @@ -2657,7 +2657,7 @@ QString QSysInfo::productType() In all other Unix-type systems, this function always returns "unknown". \note The version string returned from this function is only guaranteed to - be orderable on Android, BlackBerry, OS X and iOS. On Windows, some Windows + be orderable on Android, BlackBerry, \macos and iOS. On Windows, some Windows versions are text ("XP" and "Vista", for example). On Linux, the version of the distribution may jump unexpectedly, please refer to the distribution's documentation for versioning practices. diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 527bded3c2..23eeb01640 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -111,7 +111,7 @@ shown in any menus unless specifically set by the QAction::iconVisibleInMenu property. Menus that are currently open or menus already created in the native - OS X menubar \e{may not} pick up a change in this attribute. Changes + \macos menubar \e{may not} pick up a change in this attribute. Changes in the QAction::iconVisibleInMenu property will always be picked up. \value AA_NativeWindows Ensures that widgets have native windows. @@ -129,9 +129,9 @@ \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 - the top of the main screen on OS X or at the bottom in Windows CE). + the top of the main screen on \macos or at the bottom in Windows CE). - \value AA_MacDontSwapCtrlAndMeta On OS X by default, Qt swaps the + \value AA_MacDontSwapCtrlAndMeta On \macos by default, Qt swaps the Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt sends Meta, and whenever Meta is pressed Control is sent). When this attribute is true, Qt will not do the flip. \l QKeySequence::StandardKey @@ -315,7 +315,7 @@ \omitvalue KeyboardModifierMask - \note On OS X, the \c ControlModifier value corresponds to + \note On \macos, the \c ControlModifier value corresponds to the Command keys on the Macintosh keyboard, and the \c MetaModifier value corresponds to the Control keys. The \c KeypadModifier value will also be set when an arrow key is pressed as the arrow keys are considered part of the @@ -333,7 +333,7 @@ This enum provides shorter names for the keyboard modifier keys supported by Qt. - \note On OS X, the \c CTRL value corresponds to + \note On \macos, the \c CTRL value corresponds to the Command keys on the Macintosh keyboard, and the \c META value corresponds to the Control keys. @@ -934,34 +934,34 @@ \value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip should be opaque instead of transparent (the default). This attribute - is only applicable to OS X and is set by the widget's author. + is only applicable to \macos and is set by the widget's author. \value WA_MacShowFocusRect Indicates that this widget should get a QFocusFrame around it. Some widgets draw their own focus halo regardless of this attribute. Not that the QWidget::focusPolicy also plays the main role in whether something is given focus or not, this only controls whether or not this gets the focus - frame. This attribute is only applicable to OS X. + frame. This attribute is only applicable to \macos. \value WA_MacNormalSize Indicates the widget should have the - normal size for widgets in OS X. This attribute is only - applicable to OS X. + normal size for widgets in \macos. This attribute is only + applicable to \macos. \value WA_MacSmallSize Indicates the widget should have the small - size for widgets in OS X. This attribute is only applicable to - OS X. + size for widgets in \macos. This attribute is only applicable to + \macos. \value WA_MacMiniSize Indicates the widget should have the mini - size for widgets in OS X. This attribute is only applicable to - OS X. + size for widgets in \macos. This attribute is only applicable to + \macos. \value WA_MacVariableSize Indicates the widget can choose between alternative sizes for widgets to avoid clipping. - This attribute is only applicable to OS X. + This attribute is only applicable to \macos. \value WA_MacBrushedMetal Indicates the widget should be drawn in the brushed metal style as supported by the windowing system. This - attribute is only applicable to OS X. + attribute is only applicable to \macos. \omitvalue WA_MacMetalStyle @@ -1111,14 +1111,14 @@ \b Warning: This flag must \e never be set or cleared by the widget's author. \value WA_WindowModified Indicates that the window is marked as modified. - On some platforms this flag will do nothing, on others (including OS X + On some platforms this flag will do nothing, on others (including \macos and Windows) the window will take a modified appearance. This flag is set or cleared by QWidget::setWindowModified(). \value WA_WindowPropagation Makes a toplevel window inherit font and palette from its parent. - \value WA_MacAlwaysShowToolWindow On OS X, show the tool window even + \value WA_MacAlwaysShowToolWindow On \macos, show the tool window even when the application is not active. By default, all tool windows are hidden when the application is inactive. @@ -1301,8 +1301,8 @@ \value Key_PageUp \value Key_PageDown \value Key_Shift - \value Key_Control On OS X, this corresponds to the Command keys. - \value Key_Meta On OS X, this corresponds to the Control keys. + \value Key_Control On \macos, this corresponds to the Command keys. + \value Key_Meta On \macos, this corresponds to the Control keys. On Windows keyboards, this key is mapped to the Windows key. \value Key_Alt @@ -1962,7 +1962,7 @@ \value TabFocus the widget accepts focus by tabbing. \value ClickFocus the widget accepts focus by clicking. \value StrongFocus the widget accepts focus by both tabbing - and clicking. On OS X this will also + and clicking. On \macos this will also be indicate that the widget accepts tab focus when in 'Text/List focus mode'. \value WheelFocus like Qt::StrongFocus plus the widget accepts @@ -2068,7 +2068,7 @@ system supports it, a tool window can be decorated with a somewhat lighter frame. It can also be combined with Qt::FramelessWindowHint. - On OS X, tool windows correspond to the + On \macos, tool windows correspond to the \l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating} class of windows. This means that the window lives on a level above normal windows; it impossible to put a normal @@ -2157,10 +2157,10 @@ \value WindowContextHelpButtonHint Adds a context help button to dialogs. On some platforms this implies Qt::WindowSystemMenuHint for it to work. - \value MacWindowToolBarButtonHint On OS X adds a tool bar button (i.e., + \value MacWindowToolBarButtonHint On \macos adds a tool bar button (i.e., the oblong button that is on the top right of windows that have toolbars). - \value WindowFullscreenButtonHint On OS X adds a fullscreen button. + \value WindowFullscreenButtonHint On \macos adds a fullscreen button. \value BypassGraphicsProxyWidget Prevents the window and its children from automatically embedding themselves into a QGraphicsProxyWidget if the @@ -2184,7 +2184,7 @@ that support _NET_WM_STATE_BELOW atom. If a window always on the bottom has a parent, the parent will also be left on the bottom. This window hint is currently not implemented - for OS X. + for \macos. \value WindowOkButtonHint Adds an OK button to the window decoration of a dialog. Only supported for Windows CE. @@ -3049,7 +3049,7 @@ \value CoarseTimer Coarse timers try to keep accuracy within 5% of the desired interval \value VeryCoarseTimer Very coarse timers only keep full second accuracy - On UNIX (including Linux, OS X, and iOS), Qt will keep millisecond accuracy + On UNIX (including Linux, \macos, and iOS), Qt will keep millisecond accuracy for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up to 5% to align the timer with other timers that are expected to fire at or around the same time. The objective is to make most timers wake up at the -- cgit v1.2.3 From de1da50557a8a641f0620b1e4c490fc1f36b70c9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 16 Aug 2016 18:18:13 +0200 Subject: make bootstrapped build work entirely without generated headers instead, the only relevant defines from qconfig.h (QT_VERSION*) are passed on the command line, like we already did for qmake and configure.exe. this enables us to remove the early forwarding header generation from qtbase.pro, and rely wholly on the regular mechanism from syncqt + qt_module_headers.prf. another advantage is that we can be sure that the bootstrapped namespace is not polluted by the target feature configuration. Change-Id: If29285cfc697ae56b591e2ff1a2114686d18fb30 Reviewed-by: Lars Knoll --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 3d8baf7188..d9ffca3810 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -56,7 +56,7 @@ */ #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) -#if !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE) +#ifndef QT_BOOTSTRAPPED #include #include #endif -- cgit v1.2.3 From 48b4e0bf6f1cc4ce4831c2212d57f00fe792468f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 20 Jul 2016 12:44:16 +0200 Subject: Improve library version handling Output the version as a define into the private config header as a define using a hex number. Like that we can easily do version checks on libraries using the QT_LIBRARY_VERSION(lib) and QT_VERSION_CHECK() macros. Change-Id: I6dc4ac6550886ca95c5542b6e75cd933ed079d76 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal_p.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h index e8d822b6c6..e75d87b384 100644 --- a/src/corelib/global/qglobal_p.h +++ b/src/corelib/global/qglobal_p.h @@ -48,5 +48,14 @@ #include "qglobal.h" #include "qglobal_p.h" // include self to avoid syncqt warning - no-op +#ifndef QT_BOOTSTRAPPED +#include +#endif + +#define QT_LIBRARY_VERSION(lib) QT_LIBRARY_VERSION_##lib +#define QT_LIBRARY_VERSION_MAJOR(lib) (QT_LIBRARY_VERSION_##lib >> 16) +#define QT_LIBRARY_VERSION_MINOR(lib) ((QT_LIBRARY_VERSION_##lib >> 8) & 0xff) +#define QT_LIBRARY_VERSION_PATCH(lib) (QT_LIBRARY_VERSION_##lib & 0xff) + #endif // QGLOBAL_P_H -- cgit v1.2.3 From 606924132ff1f11b9d7b4357251f07ccabb8bdb6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 18 Aug 2016 22:24:26 +0200 Subject: Add support for safe feature checking at compile time Added a qtConfig(feature) function to qmake, and a QT_CONFIG(feature) macro. These can safely check whether a certain compile time feature of Qt is enabled or not. For this to work the feature has to have a publicFeature or privateFeature output in the configure.json file. In pro files, please use the qtConfig(feature) test function instead of checking contains(QT_CONFIG, feature), as the latter will be unreliable with the upcoming modularization (it requires a load(qt_module_config) before doing any such checks). Note that feature names are now lowercase, and identical (except for hyphens versus underscores currently) in the pro and c++ files. This makes the logic easier to follow, as we avoid all double negations, and most importantly, QT_CONFIG and qtConfig are implemented in a way that you'll get a build error for a mistyped or non-existent feature. This will also prevent accidental use of a widget feature in gui in the future. This gives us complete symmetry between the handling in pro and c++ files. Change-Id: I60404f97953724e639ffb6386cce2e8b1e4b735a Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index d9ffca3810..e6d65b0f99 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -62,13 +62,23 @@ #endif // The QT_SUPPORTS macro is deprecated. Don't use it in new code. -// Instead, use #ifdef/ndef QT_NO_feature. +// Instead, use QT_CONFIG(feature) // ### Qt6: remove macro #ifdef _MSC_VER # define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE) #else # define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) #endif + +/* + The QT_CONFIG macro implements a safe compile time check for features of Qt. + Features can be in three states: + 0 or undefined: This will lead to a compile error when testing for it + -1: The feature is not available + 1: The feature is available +*/ +#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1) + #if QT_VERSION >= QT_VERSION_CHECK(6,0,0) # define QT_NO_UNSHARABLE_CONTAINERS #endif -- cgit v1.2.3 From 57378a108ca488cbf5cfaa32590fc762dcbf3315 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 19 May 2016 23:01:59 -0700 Subject: Add support for Apple watchOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qglobal.cpp | 13 ++++++++++--- src/corelib/global/qsysinfo.h | 10 +++++++++- src/corelib/global/qsystemdetection.h | 14 ++++++-------- 3 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index e05b7874e5..71cf1da20a 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1946,6 +1946,8 @@ QSysInfo::MacVersion QSysInfo::macVersion() return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor)); #elif defined(Q_OS_TVOS) return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor)); +#elif defined(Q_OS_WATCHOS) + return QSysInfo::MacVersion(Q_MV_WATCHOS(version.major, version.minor)); #else return QSysInfo::MV_Unknown; #endif @@ -2631,9 +2633,10 @@ QString QSysInfo::kernelVersion() to determine the distribution name and returns that. If determining the distribution name failed, it returns "unknown". - \b{Darwin, \macOS, iOS and tvOS note}: this function returns "macos" for macOS - systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case - the system could not be determined. + \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns + "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems, + "watchos" for watchOS systems, and "darwin" in case the system could not + be determined. \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12. @@ -2667,6 +2670,8 @@ QString QSysInfo::productType() return QStringLiteral("ios"); #elif defined(Q_OS_TVOS) return QStringLiteral("tvos"); +#elif defined(Q_OS_WATCHOS) + return QStringLiteral("watchos"); #elif defined(Q_OS_MACOS) const QAppleOperatingSystemVersion version = qt_apple_os_version(); if (version.major == 10 && version.minor < 12) @@ -2754,6 +2759,8 @@ QString QSysInfo::prettyProductName() return QLatin1String("iOS ") + productVersion(); #elif defined(Q_OS_TVOS) return QLatin1String("tvOS ") + productVersion(); +#elif defined(Q_OS_WATCHOS) + return QLatin1String("watchOS ") + productVersion(); #elif defined(Q_OS_MACOS) const QAppleOperatingSystemVersion version = qt_apple_os_version(); const char *name = osxVer_helper(version); diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 31d78bca50..f01b45cbf9 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -122,6 +122,7 @@ public: #define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0)) #define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor) #define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor) +#define Q_MV_WATCHOS(major, minor) (QSysInfo::MV_WATCHOS | major << 4 | minor) enum MacVersion { MV_None = 0xffff, MV_Unknown = 0x0000, @@ -182,7 +183,14 @@ public: MV_TVOS_9_0 = Q_MV_TVOS(9, 0), MV_TVOS_9_1 = Q_MV_TVOS(9, 1), MV_TVOS_9_2 = Q_MV_TVOS(9, 2), - MV_TVOS_10_0 = Q_MV_TVOS(10, 0) + MV_TVOS_10_0 = Q_MV_TVOS(10, 0), + + /* watchOS */ + MV_WATCHOS = 1 << 10, + MV_WATCHOS_2_0 = Q_MV_WATCHOS(2, 0), + MV_WATCHOS_2_1 = Q_MV_WATCHOS(2, 1), + MV_WATCHOS_2_2 = Q_MV_WATCHOS(2, 2), + MV_WATCHOS_3_0 = Q_MV_WATCHOS(3, 0) }; #if defined(Q_OS_MAC) static const MacVersion MacintoshVersion; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 90954b1eca..3b486b8f6f 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -102,17 +102,15 @@ # define Q_OS_DARWIN32 # endif # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# define QT_PLATFORM_UIKIT # if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH # define Q_OS_WATCHOS +# elif defined(TARGET_OS_TV) && TARGET_OS_TV +# define Q_OS_TVOS # else -# define QT_PLATFORM_UIKIT -# if defined(TARGET_OS_TV) && TARGET_OS_TV -# define Q_OS_TVOS -# else -# // TARGET_OS_IOS is only available in newer SDKs, -# // so assume any other iOS-based platform is iOS for now -# define Q_OS_IOS -# endif +# // TARGET_OS_IOS is only available in newer SDKs, +# // so assume any other iOS-based platform is iOS for now +# define Q_OS_IOS # endif # else # // TARGET_OS_OSX is only available in newer SDKs, -- cgit v1.2.3