Skip to content

Commit

Permalink
Refs #7853. Add method to enabled/disable saving for one widget only.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Feb 13, 2014
1 parent 387d815 commit 4218084
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Expand Up @@ -31,6 +31,7 @@ class Q_DECL_EXPORT WidgetAutoSaver : QObject
void endGroup();

void setAutoSaveEnabled(bool enabled);
void setAutoSaveEnabled(QWidget& widget, bool enabled);

void loadWidgetValues();
void loadWidgetValue(QWidget* widget);
Expand Down
22 changes: 9 additions & 13 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysisHelper.cpp
Expand Up @@ -60,22 +60,18 @@ const char* WidgetAutoSaver::changedSignal(QWidget *widget)

void WidgetAutoSaver::setAutoSaveEnabled(bool enabled)
{
if (enabled)
foreach (QWidget* w, registeredWidgets)
{
// Connect all the widgets
foreach (QWidget* w, registeredWidgets)
{
connect(w, changedSignal(w), this, SLOT(saveWidgetValue()));
}
setAutoSaveEnabled(w, enabled);
}
}

void WidgetAutoSaver::setAutoSaveEnabled(QWidget &widget, bool enabled)
{
if (enabled)
connect(widget, changedSignal(widget), this, SLOT(saveWidgetValue()));
else
{
// Disconnect all the widgets
foreach (QWidget* w, registeredWidgets)
{
disconnect(w, changedSignal(w), this, SLOT(saveWidgetValue()));
}
}
disconnect(widget, changedSignal(widget), this, SLOT(saveWidgetValue()));
}

void WidgetAutoSaver::saveWidgetValue()
Expand Down

0 comments on commit 4218084

Please sign in to comment.