简体   繁体   English

QProgressDialog没有关闭

[英]The QProgressDialog is not closing

I'm having some trouble with a QProgressDialog on my app. 我的应用程序上的QProgressDialog遇到问题。

When the user clicks on a calculation button, I show a QProgressDialog that is updated from a QThread (I don't think this is related to the problem), and when this QThread finishes I call a function that closes the QProgressDialog . 当用户单击计算按钮时,我将显示从QThread更新的QProgressDialog (我认为这与问题无关),并且当此QThread完成时,我将调用关闭QProgressDialog的函数。

progressDialog->setValue(100);
progressDialog->close();

It seems to be working. 它似乎正在工作。

But if the user clicks on the calculation button and minimizes the app (main window), the QProgressDialog don't close: 但是,如果用户单击计算按钮并最小化应用程序(主窗口),则QProgressDialog不会关闭:

在此处输入图片说明

I already checked and the code is reaching on the command: 我已经检查过,并且代码已到达命令:

progressDialog->close();

I don't know what is happening, can someone help me? 我不知道发生了什么事,有人可以帮我吗?

Thanks 谢谢

我通过在进度对话框中添加以下属性解决了该问题:

progressDialog->setAttribute(Qt::WA_DeleteOnClose, true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM