Solved passing values Working on Debug mode and doesn't on release mode!
-
hi ~~
registeracc *registeraccount; // the problem is here sure! it works on debug but not on release mode !~ connect(ui->statuslineedit,SIGNAL(textChanged(QString)),registeraccount,SLOT(recieveacco(QString)));
void registeracc::recieveacco(QString recieve){ ch = recieve; qDebug()<<ch; if(recieve=="yes"){ ui->statusregister->setText(" you accepted the rules "); ui->licenceagrement->setChecked(true); } if(recieve=="no"){ ui->licenceagrement->setChecked(false); } if(ui->licenceagrement->isChecked()){ ui->registerdatabutton_2->setEnabled(true); }else{ ui->statusregister->setText(" you didn't accept software rules"); ui->registerdatabutton_2->setDisabled(true); QTimer timer2; timer2.singleShot(3000, this, SLOT(cleartext())); timer2.start(); timer2.stop(); } }
is there any solution !~~?
how can i initialize without = new ....
and the important thing ,, everything work smoothly on debug mode!~
the error on release mode is ~
QObject::connect: Cannot connect QLineEdit::textChanged(QString) to (nullptr)::recieveacco(QString) -
@Proton-Phoenix said in passing values Working on Debug mode and doesn't on release mode!:
registeracc *registeraccount;
thats a floating pointer not a pointer to a vaild instance, of course the connect fails
im surpised it worked in debug at all, luck I guess
-
@J-Hilk
yep it works on debug mode .. not only this , i have many floating pointers on my test software and all of it works on debug mode ... but doesn't on release mode~!
iif i write it like this ... registeracc *registeraccount= new registeracc();
it will work but i can't see the changes because it will show the changes on another object of registeracc ... ~~~ is there any solution to initialize registeracc ~?
i want it to connect with the same already openned form not new one -
@Proton-Phoenix
Forget about apparent differences between debug vs release builds. You need to understand the basics of C++ instances. -
okay bro Thank you so much i will try to understand more about c++ instances <3
-
@Proton-Phoenix
Nicely, you really do, because without understanding instances you won't get far in Qt or OO programming. It's worth the time to understand. -
@JonB said in passing values Working on Debug mode and doesn't on release mode!:
@Proton-Phoenix
Nicely, you really do, because without understanding instances you won't get far in Qt or OO programming. It's worth the time to understand.Thank you bro <3 i am learning programming from creating softwares ... that's why a lot of basics i didn't understand yet .. but i need to to continue the road <3
but really thank you guys ...
you could give me the solution but you want me to learn <3
As an old Chinese saying goes, it is better to teach one the skill of fishing than to offer him fish.
really thank you guys many time <3