Fix detection of the proxy base style when QT_STYLE_OVERRIDE is set

QProxyStyle checks QApplicationPrivate::styleOverride but ignores
QT_STYLE_OVERRIDE when it is trying to detect the name of the base
style.
Set styleOverride from QT_STYLE_OVERRIDE to make it work. Thus there
is no need to check QT_STYLE_OVERRIDE from multiple places.

Change-Id: I2a64b5ff5443701f800ef5d2a9cb425068f909f1
Task-number: QTBUG-52596
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Alexander Volkov 2016-02-05 14:56:06 +03:00
parent 4c6b0cf5d5
commit 4d10e55d4d

View File

@ -464,6 +464,9 @@ QDesktopWidget *qt_desktopWidget = 0; // root window widgets
*/
void QApplicationPrivate::process_cmdline()
{
if (styleOverride.isEmpty() && qEnvironmentVariableIsSet("QT_STYLE_OVERRIDE"))
styleOverride = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
if (!styleOverride.isEmpty()) {
if (app_style) {
delete app_style;
@ -1120,11 +1123,8 @@ QStyle *QApplication::style()
// Compile-time search for default style
//
QString style;
QString envStyle = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
if (!QApplicationPrivate::styleOverride.isEmpty()) {
style = QApplicationPrivate::styleOverride;
} else if (!envStyle.isEmpty()) {
style = envStyle;
} else {
style = QApplicationPrivate::desktopStyleKey();
}