Avoid warning after `QOperatingSystemVersion::OSType` was moved

This is now `QOperatingSystemVersionBase::OSType` causing a warning about
an implicit conversion. Making an explicit cast to whatever type
`os.type()` actually returns (depends on the Qt version) this warning does
not occur anymore and the code should still compile with any Qt version.
This commit is contained in:
Martchus 2024-03-15 23:54:17 +01:00
parent 600470e609
commit 63ffbc4a6f
1 changed files with 1 additions and 1 deletions

View File

@ -352,7 +352,7 @@ void QtSettings::apply()
}
const auto debugLoggingEnabled = CppUtilities::isEnvVariableSet(PROJECT_VARNAME_UPPER "_LOG_QT_CONFIG");
if (debugLoggingEnabled.has_value() && debugLoggingEnabled.value()) {
if (const auto os = QOperatingSystemVersion::current(); os.type() != QOperatingSystemVersion::Unknown) {
if (const auto os = QOperatingSystemVersion::current(); os.type() != static_cast<decltype(os.type())>(QOperatingSystemVersion::Unknown)) {
const auto version = QVersionNumber(os.majorVersion(), os.minorVersion(), os.microVersion());
std::cerr << "OS name and version: " << os.name().toStdString() << ' ' << version.toString().toStdString() << '\n';
}