Fix widget refresh after stylesheet property clearing

This commit is contained in:
Gaute Lindkvist 2019-11-28 19:23:41 +01:00
parent c6bb4414c5
commit 330f2ea62a
2 changed files with 4 additions and 3 deletions

View File

@ -191,6 +191,7 @@ void caf::UiStyleSheet::clearWidgetStates(QWidget* widget)
{ {
widget->setProperty(existingProperty, QVariant()); widget->setProperty(existingProperty, QVariant());
} }
refreshWidget(widget);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -209,7 +210,7 @@ void caf::UiStyleSheet::setWidgetState(QWidget* widget, QString stateTag, bool o
} }
// Trigger style update // 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()->unpolish(widget);
widget->style()->polish(widget); widget->style()->polish(widget);

View File

@ -89,7 +89,7 @@ public:
private: private:
QString fullText(const QString& className, const QString& objectName, bool applyToSubClasses) const; QString fullText(const QString& className, const QString& objectName, bool applyToSubClasses) const;
void refreshWidget(QWidget* widget) const; static void refreshWidget(QWidget* widget);
private: private:
std::map<QString, State> m_states; std::map<QString, State> m_states;