简体   繁体   English

在另一个窗口之上的窗口?

[英]Window on top of another window?

I want one window to stay above my MainWindow so I use this->setWindowFlags(Qt::WindowStaysOnTopHint); 我希望一个窗口停留在MainWindow上方,所以我使用this->setWindowFlags(Qt::WindowStaysOnTopHint); This makes the window stay on top of EVERY window (also from other applications). 这使得该窗口停留在每个窗口的顶部(也来自其他应用程序)。 Also it is above QMessageBox Windows and blocks them. 此外,它位于QMessageBox Windows上方并阻止它们。 I want them to appear on top of that window. 我希望它们出现在该窗口的顶部。

How can I do that? 我怎样才能做到这一点?

You don't need to set WindowStaysOnTopHint flag to force your dialog stay on top of main window. 您不需要设置WindowStaysOnTopHint标志来强制您的对话框停留在主窗口的顶部。 Just set main window as the parent of the dialog when instantiating it in the constructor of main window like : 在主窗口的构造函数中实例化对话框时,只需将其设置为对话框的父窗口即可:

dialog = new MyDialog(this);

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

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