How to disable the close button of window using Qt?

后端 未结 1 1339
Happy的楠姐
Happy的楠姐 2021-01-19 06:09

I want to disable the close button on the window (main application window) when an operation starts so user can\'t exit the application and enable it again when the operatio

相关标签:
1条回答
  • 2021-01-19 07:02

    If you want disable button, you can use next:

    auto flags = windowFlags();//save current configuration
    //your main configuration which do the trick
    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint );
    //...
    setWindowFlags(flags);//restore
    

    If you are sure that such "feature" will not irritate your users, you can use this, in another case use link from the comment.

    0 讨论(0)
提交回复
热议问题