Solved How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime
-
Hi ~~~ I Have a problem .... i want to pass How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow)
for license Agreement of my software ... so an widget show up after clicking Qradiobutton .. and then choosing to accept the rules .. and this value of acceptence .. (bool) came back to Mainwindow as the user accepted the rules!!!
i tried connect ... but it didn't work it says no slot even if there's a slot (a public one)
can you help guys <3? -
@Proton-Phoenix said in How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime:
i tried connect ... but it didn't work it says no slot even if there's a slot (a public one)
Please post the code and exact error message
-
Hi bro i still just a beginner
this is the second QRadiobutton ...
QString licenceagrement::on_licenceag_clicked() { if(ui->licenceag->isChecked()){ ui->statuslineedit->setText("true"); }else{ ui->statuslineedit->setText("false"); } ch = ui->statuslineedit->text(); ch=photon; registeracc *regis=new registeracc(); QObject::connect(ui->licenceag,SIGNAL(clicked()),regis,SLOT(regis->recipe())); return photon; }
photon and ch are public QString variables
and this is the first QRadioButton
void registeracc::on_radioButton_clicked(){ licenceagrement * lic = new licenceagrement; lic->show(); }
and this is the globalsltop
void registeracc::recipe(){ licenceagrement * lic = new licenceagrement; if(lic->on_licenceag_clicked()=="true"){ ui->radioButton->setChecked(true); }else{ ui->radioButton->setChecked(false); } }
**i knew the code is not completed yet ... i have changed the code so many times .. i tried to pass QString values instead of boolean
The error message :
QObject::connect: No such slot registeracc::regis->recipe() in ..\1stapptestdata\licenceagrement.cpp:36
QObject::connect: (sender name: 'licenceag')
QObject::connect: (receiver name: 'registeracc')** -
@Proton-Phoenix said in How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime:
QObject::connect(ui->licenceag,SIGNAL(clicked()),regis,SLOT(regis->recipe()));
This is invalid connect call. Should be:
QObject::connect(ui->licenceag,SIGNAL(clicked()),regis,SLOT(recipe()));
-
Thank you bro now QObject connect signal and slots very good but the value didn't pass to the other window!
void registeracc::recipe(){ licenceagrement * lic = new licenceagrement; if(lic->on_licenceag_clicked()=="true"){ qDebug()<<lic->on_licenceag_clicked(); ui->radioButton->setChecked(true); }else{ ui->radioButton->setChecked(false); qDebug()<<lic->on_licenceag_clicked(); } }
qDebug()<<lic->on_licenceag_clicked(); // = ""
i want it to get the QString value ... true or false!
is there any problem here! -
@Proton-Phoenix You should pass this information to the slot registeracc::recipe() instead of tightly coupling your classes.
-
This post is deleted! -
@jsulm said in How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime:
@Proton-Phoenix You should pass this information to the slot registeracc::recipe() instead of tightly coupling your classes.
ok Thank you bro <3
really Thank you bro i will try thatproblem fixed by jsulm