QProgressDialog "closes" 当另一个进程启动时
QProgressDialog "closes" when another process is started
在我的项目中,我有一个函数正在运行,而QProgressDialog显示进度。
QProgressDialog progress("Saving savegame.dat...", "Abort Save", 0, 3016, this);
progress.setWindowModality(Qt::WindowModal);
//... some loops and other calculations run while I update the progress bar with:
progress.setValue(1000);
一切都很好,直到我开始另一个过程。(打开 CLI 程序(
QProcess decomBR;
QStringList filePathListBR;
filePathListBR.append("-o");
filePathListBR.append("stuff\compress.bms");
filePathListBR.append("stuff\regions\xbox_chunks\br");
filePathListBR.append("stuff\regions\xbox_chunks\br");
decomBR.start("stuff\quickbms.exe", filePathListBR);
decomBR.waitForFinished();
一旦启动这样的进程,进度条对话框就会隐藏或其他内容,并且不再显示进度,但进程仍然运行良好。
有什么方法可以防止这些进程"关闭"QProgressDialog?
编辑:所以显然,对话框没有关闭,它只是主窗口优先并"覆盖"对话框......如果这是有道理的。有没有办法使对话框保持显示优先级?
感谢您抽出宝贵时间:)
我没有尝试过这个,但setWindowFlags(Qt::WindowStaysOnTopHint);
可能会有所帮助。请注意,它是一个标志,所以你想写这样的东西:
progress.setWindowsFlags( progress.getWindowsFlags() | Qt::WindowStaysOnTopHint );
考虑使用断言来查看它是否已经设置,如果是,那么您可以明确地驳回我的答案,并通过否定来增加人类的知识!
相关文章:
- 在挂钩启动新线程时解除挂钩进程
- 如何制作启动 Python 脚本的 linux 后台进程(在 c 中)
- 由 JOB 中的进程启动的子进程是否可以将 JOB 属性设置为脱离作业?
- 通过服务启动进程后,从SHGetKnownFolderPath 0x80070005错误
- 如何在启动时将 gdbserver 附加到进程?
- 在C++中启动进程时隐藏命令提示符
- 如何正确启动进程并转发 stdin/stdout/stderr
- 以不同用户身份启动进程
- 使用 posix_spawn 启动进程
- 当java作为服务运行时,从java启动进程
- 当用std::system启动进程时,我可以指定一个工作目录吗
- 在窗口错误中使用QProcess启动进程:"Timers can only be used with threads started with QThread"
- 创建进程 我无法启动进程
- Windows 7或Windows 2008如何在本地系统帐户或系统上下文中启动进程(从桌面应用程序)
- 在派生的线程中启动进程
- Windows服务启动进程结束通知(20032008)
- 无法使用参数启动进程
- 提示重新启动进程以获得管理权限
- 如何在 C、C++ 的 Linux 操作系统上启动进程
- 在linux上用c++启动进程,使用环境变量c++