MULTIPLE CHOICE QUIZ WITH QRADIOBUTTON
-
Hi, am creating a multi choice program I have many questions. I have used some radiobuttons, when I want to move to the next question I just use the setText() of the
Qradiobutton. However, the option the user chose from the previous question remains checked.
I have tried creating an array of radio button objects,however I didn't succeeded as I was using replaceWidget() of QLayout to change them any help please? -
Hi,
You should consider having a "reset" method that will put the widget back in some initial state.
You might want to also check QWizard for that kind of scenario.
On a side note, please avoid all uppercased title, in written language it is considered shouting and rude.
-
Hi,
You should consider having a "reset" method that will put the widget back in some initial state.
You might want to also check QWizard for that kind of scenario.
On a side note, please avoid all uppercased title, in written language it is considered shouting and rude.
@SGaist
Thanks, I have taken note of uppercase i was ignorant of that.
I still have a challenge
I created a QStackedWidget and then I added *widgets[50] to it, to each of the widgets I added 4 radiobuttons . at the last page of the widget when I want to check which radio button was checked it doesn't work . -
@SGaist
Thanks, I have taken note of uppercase i was ignorant of that.
I still have a challenge
I created a QStackedWidget and then I added *widgets[50] to it, to each of the widgets I added 4 radiobuttons . at the last page of the widget when I want to check which radio button was checked it doesn't work .@gblessed said in MULTIPLE CHOICE QUIZ WITH QRADIOBUTTON:
when I want to check which radio button was checked it doesn't work .
then please show how you're doing that
-
@gblessed said in MULTIPLE CHOICE QUIZ WITH QRADIOBUTTON:
when I want to check which radio button was checked it doesn't work .
then please show how you're doing that
@jsulm
In my headerQStackedWidget *stacked = new QStackedWidget; QRadioButton * radio[200]; QVBoxLayout *paged[50]; QWidget *wiggy[50]; //main window.cp int kj=0; for(int i=0; i<50; i++) { into wiggy[i] = new QWidget(); paged[i] = new QVBoxLayout; wiggy [i]->setLayout[paged[I]; for(int j=0; j<4; j++){ radio [kj] = new RadioButton(text); paged[i]->addWidget(radio [kj]); kj++; } } void on_pushbuttonclicked(){ for(int i=0; i<200; i++){ if(radio[i]->is checked()) qDebug()<<"checked"; } }
-
@jsulm
In my headerQStackedWidget *stacked = new QStackedWidget; QRadioButton * radio[200]; QVBoxLayout *paged[50]; QWidget *wiggy[50]; //main window.cp int kj=0; for(int i=0; i<50; i++) { into wiggy[i] = new QWidget(); paged[i] = new QVBoxLayout; wiggy [i]->setLayout[paged[I]; for(int j=0; j<4; j++){ radio [kj] = new RadioButton(text); paged[i]->addWidget(radio [kj]); kj++; } } void on_pushbuttonclicked(){ for(int i=0; i<200; i++){ if(radio[i]->is checked()) qDebug()<<"checked"; } }
@gblessed said in MULTIPLE CHOICE QUIZ WITH QRADIOBUTTON:
radio [kj] = new RadioButton(text);
Do you mean QRadioButton? Or is it your own class?
Is any of the radio buttons checked when you press the button? -
@gblessed said in MULTIPLE CHOICE QUIZ WITH QRADIOBUTTON:
radio [kj] = new RadioButton(text);
Do you mean QRadioButton? Or is it your own class?
Is any of the radio buttons checked when you press the button?