From 330f2ea62ad427a268671b658b3bd6a617b5932e Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Thu, 28 Nov 2019 19:23:41 +0100 Subject: [PATCH] Fix widget refresh after stylesheet property clearing --- Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.cpp | 5 +++-- Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.cpp b/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.cpp index 0873bef119..c23cd41bba 100644 --- a/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.cpp @@ -191,6 +191,7 @@ void caf::UiStyleSheet::clearWidgetStates(QWidget* widget) { widget->setProperty(existingProperty, QVariant()); } + refreshWidget(widget); } //-------------------------------------------------------------------------------------------------- @@ -209,7 +210,7 @@ void caf::UiStyleSheet::setWidgetState(QWidget* widget, QString stateTag, bool o } // Trigger style update - this->refreshWidget(widget); + refreshWidget(widget); } //-------------------------------------------------------------------------------------------------- @@ -229,7 +230,7 @@ QString caf::UiStyleSheet::fullText(const QString& className, const QString& obj //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void caf::UiStyleSheet::refreshWidget(QWidget* widget) const +void caf::UiStyleSheet::refreshWidget(QWidget* widget) { widget->style()->unpolish(widget); widget->style()->polish(widget); diff --git a/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.h b/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.h index 5aa454246c..e1e9cec7cb 100644 --- a/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.h +++ b/Fwk/AppFwk/cafUserInterface/cafUiStyleSheet.h @@ -89,7 +89,7 @@ public: private: QString fullText(const QString& className, const QString& objectName, bool applyToSubClasses) const; - void refreshWidget(QWidget* widget) const; + static void refreshWidget(QWidget* widget); private: std::map m_states;