QMessageBox not able to close.
-
@Anas_Deshmukh How can you reach closePopUp() if you call
int ret = this->msgBox->exec();in popUp() as exec() is a blocking call? How/where do you call closePopUp()?
@jsulm Using qml timer sigal making closePopUp() as slot.
please do refer main.qml part. -
@Anas_Deshmukh How can you reach closePopUp() if you call
int ret = this->msgBox->exec();in popUp() as exec() is a blocking call? How/where do you call closePopUp()?
This post is deleted! -
@jsulm Using qml timer sigal making closePopUp() as slot.
please do refer main.qml part. -
@jsulm it return true in all scenario (either successfully close or not close at all).
-
@jsulm it return true in all scenario (either successfully close or not close at all).
@Anas_Deshmukh
Although I doubt it will help your behaviour --- though worth a try --- you might like to replacethis->msgBox->close();with something likethis->msgBox->reject();orthis->msgBox->done(-1);, to aid your caller. -
@Anas_Deshmukh
Although I doubt it will help your behaviour --- though worth a try --- you might like to replacethis->msgBox->close();with something likethis->msgBox->reject();orthis->msgBox->done(-1);, to aid your caller.@JonB hi tried but both but nothing work.
if(this->msgBox->isEnabled() ) // this condition is still true even after using reject and done. -
@JonB hi tried but both but nothing work.
if(this->msgBox->isEnabled() ) // this condition is still true even after using reject and done.@Anas_Deshmukh
Like I said, I did not expect this change to help your issue now. But I think you will want it when you have your code working, since you test the result returned from the dialog.Never mind whether
this->msgBox->isEnabled()is still true, does the dialog actually close or not? -
@Anas_Deshmukh
Like I said, I did not expect this change to help your issue now. But I think you will want it when you have your code working, since you test the result returned from the dialog.Never mind whether
this->msgBox->isEnabled()is still true, does the dialog actually close or not?@JonB Not close.
-
@JonB Not close.
@Anas_Deshmukh
Well, I'd try inserting a single-shot timer for 1 second which will close the message box immediately before your.exec()line, to eliminate whatever might be going on with your QML timer stuff. There are plenty of examples on the web of doing that for timed closure of a dialog. And/or change your.exec()to.show()(have to adjust your calling code) and see whether that makes it work. -
@Anas_Deshmukh
Well, I'd try inserting a single-shot timer for 1 second which will close the message box immediately before your.exec()line, to eliminate whatever might be going on with your QML timer stuff. There are plenty of examples on the web of doing that for timed closure of a dialog. And/or change your.exec()to.show()(have to adjust your calling code) and see whether that makes it work.@JonB Hi, i fix the problem.
Issue i had is somehow in my project one new object were created (typical scenario), and function closePopUp() unable to access newly created instance as it always pointing previously created object.thaks for your time and consideration.