QProgressDialog: how to modal window
-
Give it a proper parent.
-
Give it a proper parent.
I found a difference in setting parent style
1
void MDIChild::show_p(){ progress = new QProgressDialog("text","Cancel",0,100, this); progress->setWindowModality(Qt::WIndowModal); ... progress->show(); }
2
void MDIChild::show_p(){ progress = new QProgressDialog("text","Cancel"); progress->setParent(this); progress->setWindowModality(Qt::WIndowModal); ... progress->show(); }
Modality works fine for first "set parent" variant only. And, I don't know why, but blocks all application, not a parent (mdi child) window only.
-
I found a difference in setting parent style
1
void MDIChild::show_p(){ progress = new QProgressDialog("text","Cancel",0,100, this); progress->setWindowModality(Qt::WIndowModal); ... progress->show(); }
2
void MDIChild::show_p(){ progress = new QProgressDialog("text","Cancel"); progress->setParent(this); progress->setWindowModality(Qt::WIndowModal); ... progress->show(); }
Modality works fine for first "set parent" variant only. And, I don't know why, but blocks all application, not a parent (mdi child) window only.
Hello!
You can try to set
setWindowModality(Qt::ApplicationModal);
toQProgressDialog
object instead ofQt::WindowModal
to check if it works for you in such case.
Also, I would suggest to callQProgressDialog
-exec()
method instead ofshow()
. -
Hello!
You can try to set
setWindowModality(Qt::ApplicationModal);
toQProgressDialog
object instead ofQt::WindowModal
to check if it works for you in such case.
Also, I would suggest to callQProgressDialog
-exec()
method instead ofshow()
.@Cobra91151 the same result. QProgressDialog blocks all app.
-
@Cobra91151 the same result. QProgressDialog blocks all app.
Do you have the same issue with a simple
QDialog
or just aQProgressDialog
? I ask because I had some issue withQProgressDialog
button and to fix it I created my own progress dialog class which inherits fromQDialog
class. -
Do you have the same issue with a simple
QDialog
or just aQProgressDialog
? I ask because I had some issue withQProgressDialog
button and to fix it I created my own progress dialog class which inherits fromQDialog
class.@Cobra91151 , thanks for an advice.
Yes, this issue I have with QProgressDialog object only -
Hi,
There's one key information missing, what are you doing while the dialog is shown ?
-
@SGaist said in QProgressDialog: how to modal window:
Hi,
There's one key information missing, what are you doing while the dialog is shown ?Hi!
App waits for some process accomplish and user mustn't click anywhere on the app while qprocessdialog shows...Same problem found with QMessageBox.
There is different behavior while centering in case of parent setting by constructor and by 'setParent'. -
@SGaist said in QProgressDialog: how to modal window:
Hi,
There's one key information missing, what are you doing while the dialog is shown ?Hi!
App waits for some process accomplish and user mustn't click anywhere on the app while qprocessdialog shows...Same problem found with QMessageBox.
There is different behavior while centering in case of parent setting by constructor and by 'setParent'.