When warning about invalid style override also print available ones

Change-Id: Ia017a342648a1f1e1185e74ddec1a77cb6dcfebe
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Sergio Martins 2018-11-11 15:27:01 +00:00 committed by Sérgio Martins
parent 589f9f179c
commit da37291f28

View File

@ -1064,8 +1064,10 @@ QStyle *QApplication::style()
if (!QApplicationPrivate::styleOverride.isEmpty()) { if (!QApplicationPrivate::styleOverride.isEmpty()) {
const QString style = QApplicationPrivate::styleOverride.toLower(); const QString style = QApplicationPrivate::styleOverride.toLower();
app_style = QStyleFactory::create(style); app_style = QStyleFactory::create(style);
if (!app_style) if (Q_UNLIKELY(!app_style)) {
qWarning("QApplication: invalid style override passed, ignoring it."); qWarning("QApplication: invalid style override passed, ignoring it.\n"
" Available styles: %s", qPrintable(QStyleFactory::keys().join(QLatin1String(", "))));
}
} }
if (!app_style) if (!app_style)
app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey());