mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add support for stashing and restoring states in caf::UiStyleSheet
This commit is contained in:
parent
e5d7af4c18
commit
2044b99818
@ -213,6 +213,25 @@ void caf::UiStyleSheet::setWidgetState(QWidget* widget, QString stateTag, bool o
|
||||
refreshWidget(widget);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::UiStyleSheet::stashWidgetStates()
|
||||
{
|
||||
m_stashedStates.swap(m_states);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::UiStyleSheet::restoreWidgetStates()
|
||||
{
|
||||
if (!m_stashedStates.empty())
|
||||
{
|
||||
m_stashedStates.swap(m_states);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
void applyToWidgetAndChildren(QWidget* widget);
|
||||
static void clearWidgetStates(QWidget* widget);
|
||||
void setWidgetState(QWidget* widget, QString stateTag, bool on = true) const;
|
||||
void stashWidgetStates();
|
||||
void restoreWidgetStates();
|
||||
|
||||
private:
|
||||
QString fullText(const QString& className, const QString& objectName, bool applyToSubClasses) const;
|
||||
@ -93,5 +95,6 @@ private:
|
||||
|
||||
private:
|
||||
std::map<QString, State> m_states;
|
||||
std::map<QString, State> m_stashedStates;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user