Add text when selecting radiobutton
-
When you select a specific radiobutton, you need to add text to the already existing one. Ie in the group box is 60, then 60 is added, if 40 is selected, then 40. How to do it correctly? Now my current text is deleted and replaced, but not added.
An example of how it should be
-
Hi @fender ,
You have to first check that radio button is checked or not for this,if( ui->radio_button->isChecked())
{
ui->lineEdit->setText(ui->radio_button->text());
}
code inside if condition is set the value of radio button( in your case 40 ,60 etc.) in lineEdit.
This code help you. -
When you select a specific radiobutton, you need to add text to the already existing one. Ie in the group box is 60, then 60 is added, if 40 is selected, then 40. How to do it correctly? Now my current text is deleted and replaced, but not added.
An example of how it should be
-
Hi
Is that a good strategy adding the radios text ?
How will you handle if user changes his mind and goes from 30 to 60 in group 2 ?
However, if you construct the full string each time, it will work.
Just wondering :) -
Hi
Is that a good strategy adding the radios text ?
How will you handle if user changes his mind and goes from 30 to 60 in group 2 ?
However, if you construct the full string each time, it will work.
Just wondering :)@mrjj Yes you are right!!!!
Whenever user changes radiobutton checked event then text is appending everytime cause of concatenation in lineEdit. Therefore button text is as it is everytime. -
Hi,
Then re-build the full string when any of these widgets change and replace the whole text.