Restore compatibility with Qt 5.7.0 and 5.6.1
QSysInfo::productType() returned "osx" for all versions of macOS, even 10.12. Change 3e2bde35786 was incorrect. [ChangeLog][Important Behavior Changes] QSysInfo::productType() and QFileSelector behavior on macOS was restored to match what Qt used to return in version 5.7.0 and earlier. The behavior found in Qt 5.6.2, 5.7.1 and 5.8.0 is removed. [ChangeLog][Future Compatibility Notice] The identifiers that QSysInfo::productType() and QFileSelector will use to identify macOS systems will change in Qt 6.0 to match the Apple naming guidelines which will be current then. Task-number: QTBUG-59849 Change-Id: Ib0e40a7a3ebc44329f23fffd14b2b39392210c4f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
parent
e893e657e5
commit
cdc5f47aeb
@ -2652,12 +2652,14 @@ QString QSysInfo::kernelVersion()
|
||||
to determine the distribution name and returns that. If determining the
|
||||
distribution name failed, it returns "unknown".
|
||||
|
||||
\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{\macos note}: this function returns "osx" for all \macos systems,
|
||||
regardless of Apple naming convention. The returned string will be updated
|
||||
for Qt 6. Note that this function erroneously returned "macos" for \macos
|
||||
10.12 in Qt versions 5.6.2, 5.7.1, and 5.8.0.
|
||||
|
||||
\b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
|
||||
\b{Darwin, iOS, tvOS, and watchOS note}: this function returns "ios" for
|
||||
iOS systems, "tvos" for tvOS systems, "watchos" for watchOS systems, and
|
||||
"darwin" in case the system could not be determined.
|
||||
|
||||
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
|
||||
"unknown" otherwise.
|
||||
@ -2692,10 +2694,12 @@ QString QSysInfo::productType()
|
||||
#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)
|
||||
return QStringLiteral("osx");
|
||||
// ### Qt6: remove fallback
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return QStringLiteral("macos");
|
||||
# else
|
||||
return QStringLiteral("osx");
|
||||
# endif
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
return QStringLiteral("darwin");
|
||||
|
||||
|
@ -366,6 +366,7 @@ void QFileSelectorPrivate::updateSelectors()
|
||||
QStringList QFileSelectorPrivate::platformSelectors()
|
||||
{
|
||||
// similar, but not identical to QSysInfo::osType
|
||||
// ### Qt6: remove macOS fallbacks to "mac" and the future compatibility
|
||||
QStringList ret;
|
||||
#if defined(Q_OS_WIN)
|
||||
// can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case
|
||||
@ -387,12 +388,11 @@ QStringList QFileSelectorPrivate::platformSelectors()
|
||||
# endif
|
||||
# endif
|
||||
QString productName = QSysInfo::productType();
|
||||
# ifdef Q_OS_MACOS
|
||||
if (productName != QLatin1String("osx"))
|
||||
ret << QStringLiteral("osx"); // compatibility
|
||||
# endif
|
||||
if (productName != QLatin1String("unknown"))
|
||||
ret << productName; // "opensuse", "fedora", "macos", "ios", "android"
|
||||
ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
|
||||
# if defined(Q_OS_MACOS)
|
||||
ret << QStringLiteral("macos"); // future compatibility
|
||||
# endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
0
tests/auto/corelib/io/qfileselector/platforms/test4
Normal file
0
tests/auto/corelib/io/qfileselector/platforms/test4
Normal file
0
tests/auto/corelib/io/qfileselector/platforms/test5
Normal file
0
tests/auto/corelib/io/qfileselector/platforms/test5
Normal file
@ -15,6 +15,7 @@
|
||||
<file>platforms/test</file>
|
||||
<file>platforms/+unix/+android/test</file>
|
||||
<file>platforms/+unix/+darwin/+mac/+ios/test</file>
|
||||
<file>platforms/+unix/+darwin/+mac/+osx/+macos/test</file>
|
||||
<file>platforms/+unix/+darwin/+mac/+osx/test</file>
|
||||
<file>platforms/+unix/+darwin/+mac/test</file>
|
||||
<file>platforms/+unix/+darwin/test</file>
|
||||
@ -27,6 +28,7 @@
|
||||
<file>platforms/+windows/test</file>
|
||||
<file>platforms/+android/test</file>
|
||||
<file>platforms/+ios/test</file>
|
||||
<file>platforms/+macos/test</file>
|
||||
<file>platforms/+osx/test</file>
|
||||
<file>platforms/+darwin/test</file>
|
||||
<file>platforms/+mac/test</file>
|
||||
@ -39,7 +41,7 @@
|
||||
<file>platforms/test2</file>
|
||||
<file>platforms/+android/test2</file>
|
||||
<file>platforms/+ios/test2</file>
|
||||
<file>platforms/+osx/test2</file>
|
||||
<file>platforms/+macos/test2</file>
|
||||
<file>platforms/+haiku/test2</file>
|
||||
<file>platforms/+linux/test2</file>
|
||||
<file>platforms/+wince/test2</file>
|
||||
@ -50,5 +52,11 @@
|
||||
<file>platforms/test3</file>
|
||||
<file>platforms/+windows/test3</file>
|
||||
<file>platforms/+unix/test3</file>
|
||||
|
||||
<!-- platforms/test4 and 5: special cases for macOS -->
|
||||
<file>platforms/test4</file>
|
||||
<file>platforms/+osx/test4</file>
|
||||
<file>platforms/test5</file>
|
||||
<file>platforms/+mac/test5</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -126,6 +126,14 @@ void tst_QFileSelector::basicTest_data()
|
||||
QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList()
|
||||
<< expectedPlatform3File;
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
// special case for compatibility code
|
||||
QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList()
|
||||
<< ":/platforms/+osx/test4";
|
||||
QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList()
|
||||
<< ":/platforms/+mac/test5";
|
||||
#endif
|
||||
|
||||
QString resourceTestPath(":/extras/test");
|
||||
QString custom1("custom1");
|
||||
QTest::newRow("custom1-noselector") << resourceTestPath << QStringList()
|
||||
|
Loading…
x
Reference in New Issue
Block a user