How can I disable Alt + F4 window closing using Qt?

后端 未结 3 1502
长情又很酷
长情又很酷 2021-02-02 16:29

I\'ve disabled X button in Qt from my dialog using this line:

myDialog->setWindowFlags(Qt::Dialog | Qt::Desktop)
         


        
3条回答
  •  孤独总比滥情好
    2021-02-02 16:51

    Also you can handle the event in your dialog's class (at least if it's modal dlg):

    void MyDialog::closeEvent(QCloseEvent* e)
    {
        if ( condition )
           e->ignore();
        else
           __super::closeEvent(e);
    }
    

提交回复
热议问题