How to make a dialog window always on the front at my application level

末鹿安然 提交于 2019-12-04 05:14:46

You can achieve this by giving the dialogs a parent. A child dialog always stays on top of its parent window.

If you can't send parent to your dialog_window (based on code conditional) Like me, use flags.

Dialog_dlg::Dialog_dlg(QWidget *parent)
    : QDialog(parent), ui(new Ui::Dialog_dlg)
{
    ui->setupUi(this);
    setFixedSize(width(), height()); //for no maximaize
    setWindowFlag(Qt::WindowStaysOnTopHint);
}

I used this and good to me. See other flags, test them, and choose.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!