To automatically close a QDialog in a constructor, you may use the following line of code:
QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
If you have another method of closing(not hiding) a QDialog based on a condition in its constructor, kindly share it within the comments below - thank you.
Reference:
https://www.qtcentre.org/threads/26183-How-to-exit-in-a-QDialog-constructor
Thanks again for reading and I hope this helps.



No comments:
Post a Comment