diff --git a/src/libs/utils/savedaction.cpp b/src/libs/utils/savedaction.cpp index af6f6469e27..0a405e5c7e7 100644 --- a/src/libs/utils/savedaction.cpp +++ b/src/libs/utils/savedaction.cpp @@ -35,12 +35,13 @@ #include #include +#include #include #include -#include -#include #include #include +#include +#include using namespace Core::Utils; @@ -289,6 +290,13 @@ void SavedAction::connectWidget(QWidget *widget, ApplyMode applyMode) connect(button, SIGNAL(clicked()), this, SLOT(uncheckableButtonClicked())); } + } else if (QSpinBox *spinBox = qobject_cast(widget)) { + spinBox->setValue(m_value.toInt()); + //qDebug() << "SETTING VALUE" << spinBox->value(); + connect(spinBox, SIGNAL(valueChanged(int)), + this, SLOT(spinBoxValueChanged(int))); + connect(spinBox, SIGNAL(valueChanged(QString)), + this, SLOT(spinBoxValueChanged(QString))); } else if (QLineEdit *lineEdit = qobject_cast(widget)) { lineEdit->setText(m_value.toString()); //qDebug() << "SETTING TEXT" << lineEdit->text(); @@ -322,6 +330,8 @@ void SavedAction::apply(QSettings *s) setValue(button->isChecked()); else if (QLineEdit *lineEdit = qobject_cast(m_widget)) setValue(lineEdit->text()); + else if (QSpinBox *spinBox = qobject_cast(m_widget)) + setValue(spinBox->value()); else if (PathChooser *pathChooser = qobject_cast(m_widget)) setValue(pathChooser->path()); if (s) @@ -353,6 +363,22 @@ void SavedAction::lineEditEditingFinished() setValue(lineEdit->text()); } +void SavedAction::spinBoxValueChanged(int value) +{ + QSpinBox *spinBox = qobject_cast(sender()); + QTC_ASSERT(spinBox, return); + if (m_applyMode == ImmediateApply) + setValue(value); +} + +void SavedAction::spinBoxValueChanged(QString value) +{ + QSpinBox *spinBox = qobject_cast(sender()); + QTC_ASSERT(spinBox, return); + if (m_applyMode == ImmediateApply) + setValue(value); +} + void SavedAction::pathChooserEditingFinished() { PathChooser *pathChooser = qobject_cast(sender());