bool dark = false; if (theme == ThemeType::System) { #if QT_VERSION >= QT_VERSION_CHECK(6,5,0) dark = qApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark; #endif } else { dark = (theme == ThemeType::Dark); } this->applyTheme(dark);