简述
QDialog自带的标题栏或者样式可能不是我们想要的,当我们打算重写标题栏或者去掉标题栏或者更改为圆角窗体时我们通常是使用Qt::FramelessWindowHint先去掉标题栏,但是这里会有一个问题:
// 方式一不显示窗口
QDialog *p1 = new QDialog(this);
p1->setWindowFlags(Qt::FramelessWindowHint);
p1->show();
// 方式二显示窗口
QDialog *p2 = new QDialog(this, Qt::FramelessWindowHint);
p2->show();
源码
/*!
Constructs a dialog with parent \a parent.
A dialog is always a top-level widget, but if it has a parent, its
default location is centered on top of the parent. It will also
share the parent's taskbar entry.
The widget flags \a f are passed on to the QWidget constructor.
If, for example, you don't want a What's This button in the title bar
of the dialog, pass Qt::WindowTitleHint | Qt::WindowSystemMenuHint in \a f.
\sa QWidget::setWindowFlags()
*/
QDialog::QDialog(QWidget *parent, Qt::Wi