QProgressDialog without close button [duplicate]

You can hide close button of every window by clearing an appropriate flag:

With Qt 5.0

QProgressDialog dlg;
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowCloseButtonHint);

Qt::WindowCloseButtonHint 0x08000000 Adds a close button. On some platforms this implies Qt::WindowSystemMenuHint for it to work.

With earlier versions

    QProgressDialog dlg;
    dlg.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);

where

  • Qt::Window stands for window
  • Qt::WindowTitleHint stands for displaying title on the top of the window
  • Qt::CustomizeWindowHint stands for not displaying buttons

猜你喜欢

转载自blog.csdn.net/wojiuguowei/article/details/87879171