diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 6b3cb502e55..9a779305d26 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -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");
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 920281cef73..22995db07d1 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -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;
}
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test2 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test5
similarity index 100%
rename from tests/auto/corelib/io/qfileselector/platforms/+mac/test2
rename to tests/auto/corelib/io/qfileselector/platforms/+mac/test5
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test2 b/tests/auto/corelib/io/qfileselector/platforms/+macos/test
similarity index 100%
rename from tests/auto/corelib/io/qfileselector/platforms/+osx/test2
rename to tests/auto/corelib/io/qfileselector/platforms/+macos/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+macos/test2 b/tests/auto/corelib/io/qfileselector/platforms/+macos/test2
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test4
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/auto/corelib/io/qfileselector/platforms/test4 b/tests/auto/corelib/io/qfileselector/platforms/test4
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/auto/corelib/io/qfileselector/platforms/test5 b/tests/auto/corelib/io/qfileselector/platforms/test5
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
index ab7a4d7f23c..ea9b8270e0e 100644
--- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc
+++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
@@ -15,6 +15,7 @@
platforms/test
platforms/+unix/+android/test
platforms/+unix/+darwin/+mac/+ios/test
+ platforms/+unix/+darwin/+mac/+osx/+macos/test
platforms/+unix/+darwin/+mac/+osx/test
platforms/+unix/+darwin/+mac/test
platforms/+unix/+darwin/test
@@ -27,6 +28,7 @@
platforms/+windows/test
platforms/+android/test
platforms/+ios/test
+ platforms/+macos/test
platforms/+osx/test
platforms/+darwin/test
platforms/+mac/test
@@ -39,7 +41,7 @@
platforms/test2
platforms/+android/test2
platforms/+ios/test2
- platforms/+osx/test2
+ platforms/+macos/test2
platforms/+haiku/test2
platforms/+linux/test2
platforms/+wince/test2
@@ -50,5 +52,11 @@
platforms/test3
platforms/+windows/test3
platforms/+unix/test3
+
+
+ platforms/test4
+ platforms/+osx/test4
+ platforms/test5
+ platforms/+mac/test5
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index e5ede1ad061..f2d09429ccc 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -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()