diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 46e0d2c76c7..0af28e3cfd5 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2725,8 +2725,10 @@ void QWidgetPrivate::inheritStyle() // to be running a proxy if (!qApp->styleSheet().isEmpty() || qt_styleSheet(parentStyle)) { QStyle *newStyle = parentStyle; - if (q->testAttribute(Qt::WA_SetStyle)) + if (q->testAttribute(Qt::WA_SetStyle) && qt_styleSheet(origStyle) == nullptr) newStyle = new QStyleSheetStyle(origStyle); + else if (auto *styleSheetStyle = qt_styleSheet(origStyle)) + newStyle = styleSheetStyle; else if (QStyleSheetStyle *newProxy = qt_styleSheet(parentStyle)) newProxy->ref();