I have multiple QDoubleSpinBox in a dialog as follows:

QDoubleSpinBox *qsb_fov_min_x;
QDoubleSpinBox *qsb_fov_max_x;
QDoubleSpinBox *qsb_fov_min_y;
QDoubleSpinBox *qsb_fov_max_y;
QDoubleSpinBox *qsb_fov_min_z;
QDoubleSpinBox *qsb_fov_max_z;
QDoubleSpinBox *qsb_fov_step_x;
QDoubleSpinBox *qsb_fov_step_y;
QDoubleSpinBox *qsb_fov_step_z;

When the value in each QDoubleSpinBox is changed, I do some updates in update(). This works fine for me. Now I add one QPushButton as a "reset" button. When I click this reset button, I need to reset values of all QDoubleSpinBox to their own default values. So I connect button's click() signal to my own slot resetFOVDIM(). When I run this program and click the "reset" button, I found that not all QDoubleSpinBox values are set to their default values at the same time, but only one QDoubleSpinBox value is set on each clicking. I need to click the "reset" button nine times to reset all nine QDoubleSpinBox values.

Could anyone show me what the problem is in my code and how to reset all values one time when I click the "reset" button? Many thanks!


Here are code snippets:

Setup_Dialog::void Setup_Dialog()
{
// other initializations
......

// signal / slot connection
connect(qsb_fov_min_x, SIGNAL(valueChanged(double)), this, SLOT(update()));
connect(qsb_fov_max_x, SIGNAL(valueChanged(double)), this, SLOT(update()));
connect(qsb_fov_min_y, SIGNAL(valueChanged(double)), this, SLOT(update()));
connect(qsb_fov_max_y, SIGNAL(valueChanged(double)), this, SLOT(update()));
connect(qsb_fov_min_z, SIGNAL(valueChanged(double)), this, SLOT(update()));
connect(qsb_fov_max_z, SIGNAL(valueChanged(double)), this, SLOT(update()));

connect(qsb_fov_step_x, SIGNAL(valueChanged(double)), this, SLOT(update()));
connect(qsb_fov_step_y, SIGNAL(valueChanged(double)), this, SLOT(update()));
connect(qsb_fov_step_z, SIGNAL(valueChanged(double)), this, SLOT(update()));

connect(reset, SIGNAL(clicked()), this, SLOT(resetFOV()));
}

void Setup_Dialog::resetFOV()
{
fov_min_x = -150.0;
fov_max_x = 150.0;
fov_step_x = 1.0;

fov_min_y = -150.0;
fov_max_y = 150.0;
fov_step_y = 1.0;

fov_min_z = 50.0;
fov_max_z = 60.0;
fov_step_z = 1.0;


// set values
qsb_fov_min_x->setValue(fov_min_x);
qsb_fov_max_x->setValue(fov_max_x);
qsb_fov_step_x->setValue(fov_step_x);

qsb_fov_min_y->setValue(fov_min_y);
qsb_fov_max_y->setValue(fov_max_y);
qsb_fov_step_y->setValue(fov_step_y);

qsb_fov_min_z->setValue(fov_min_z);
qsb_fov_max_z->setValue(fov_max_z);
qsb_fov_step_z->setValue(fov_step_z);

}

void Setup_Dialog::update()
{
// do other updates
}