Use changed spinbox-value in another void-function
-
[quote author="newe1" date="1305371816"]but the "void Tab::calculate()" function still does not get the value of "k"... [/quote]
What does happen? Does it raise division by zero exception? Have you tried to debug it and check if the setVal function is called? And check what is the value of k in the calculate function?
-
Hi again!
Thanks Volker, I changed it. We were posting at the same time :-)
VCsala: Well it happens nothing. The divison by zero exception is not made, because of my range 2 to 20.
This are the private Slots:
@
private slots:
void calculate();
void setVal(int);
@I´m using "k" like this:
@
void Tab::calculate()
{
double result, result1, result2, a, ....;if(radio1->isChecked()) { result = a/k; } if(k==2) { if(radio2->isChecked()) { result = a/k; //1. result1 = a/k*2; //2. QString result1String = ""; re1->setText(result1String.setNum(result)); QString result2String = ""; re2->setText(result2String.setNum(result1)); } else { QString result1String = ""; re1->setText(result1String.setNum(result)); re2->setText(result1String.setNum(result)); } if(k==3) if(radio2->isChecked()) { result = a/k; //1. result1 = a/k*2; //2. result2 = a/k*3; //3.
.....
@When I debug, I don´t get any error... but it does not get "k"...
VCsala: How do I check if the setval function is called?
Thanks in advance!
-
Hi!
Thank you VCsala and Volker for your ideas. It took me quite some time to solve the problem but now everything runs fine.
Finally I rebuilt everything without the GroupBox and it got the value of "k". I´m not 100% sure, why it could not get it before (maybe because of other interferring problems) but now it works. :-)
But I didn´t declare the slots to public. Just private slots, with the code above and it gets the value of "k".
Thanks anyway!