只需要在自己代码初始化里加上一句就行。
比如,中间的 | 是选择多个。
self.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)
class ProgressBar(QDialog):
def __init__(self):
QDialog.__init__(self)
self.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)
self.setGeometry(800, 500, 400, 150)
self.setWindowTitle(u'正在上传,请稍等')
这个例子是显示的,其他的一些选择如下,只需要替换即可。
setWindowFlags ( Qt::WindowFlags type )
Qt.FrameWindowHint:没有边框的窗口
Qt.WindowStaysOnTopHint://总在最上面的窗口
Qt.CustomizeWindowHint://自定义窗口标题栏,以下标志必须与这个标志一起使用才有效,否则窗口将有默认的标题栏
Qt.WindowTitleHint:显示窗口标题栏
Qt.WindowSystemMenuHint://显示系统菜单
Qt.WindowMinimizeButtonHint://显示最小化按钮
Qt.WindowMaximizeButtonHint://显示最大化按钮
Qt.WindowMinMaxButtonsHint://显示最小化按钮和最大化按钮
Qt.WindowCloseButtonHint://显示关闭按钮
Qt.Drawer://去掉窗口左上角的图标,右上角的最大化最小化按钮(好像关闭按钮会变个样。。。)
setWindowFlags(Qt::FramelessWindowHint);直接隐藏掉