Isn't it better to put the 'i' variable in the class definition? (not a local variable to that function)
And declare a function (a slot, with "public slots:" access specifier) and that function will look like:
void YourClass::set_i(double input) { i = input;} //i is your member variable i
void YourClass::set_i(double input) { i = input;} //i is your member variable i
To copy to clipboard, switch view to plain text mode
and connect this slot with the SpinBox valueChanged signal:
(in your class constructor if the spinbox2 is member of the same class!)
connect(spinBox2,SIGNAL(valueChanged(double)), this, SLOT(set_i(double));
connect(spinBox2,SIGNAL(valueChanged(double)), this, SLOT(set_i(double));
To copy to clipboard, switch view to plain text mode
Note: You can do it with double or int, but the QSpinBox doesn't have a valueChanged(double) only int
QDoubleSpinBox has valueChanged(double) not int
And we can't create a complete design, we can only give you advices, because we don't know the actual problem (don't even know the design of your class)
Bookmarks