我有两个QMainWindows。我希望当一个带有exec()的QMessageBox显示在QMainWindow上时,另一个QMainWindow不会被阻塞。
两个QMainWindow必须是独立的。
怎么做的?
发布于 2013-08-22 07:56:45
它与QThread无关,Qt文档指出,在QT应用程序中只能有一个GUI线程。
您应该做的是设置模式标志,以使对话框模态,因此它将与其父窗口相关。在执行对话框之前,请调用:
pDialog->setWindowModality( Qt::WindowModal );不要忘记为您的对话框对象设置一个正确的父。
Qt文档声明:-
Modal Dialogs
A modal dialog is a dialog that blocks input to other visible windows in the
same application. Dialogs that are used to request a file name from the user or
that are used to set application preferences are usually modal. Dialogs can be
application modal (the default) or window modal.发布于 2013-08-22 07:45:39
使用show()方法显示每个QMainWindow而不是exec()。
https://stackoverflow.com/questions/18374377
复制相似问题