Qt MessageBox删除TitleBar?

use*_*285 4 qt

如何从Qt中的Qt MessageBox中删除标题栏?

我经历过

QMessageBox::QMessageBox(Icon icon, const QString & title, const QString & text, StandardButtons buttons, QWidget * parent, Qt::WindowFlags f)
Run Code Online (Sandbox Code Playgroud)

但是如何使用这个.任何例子?任何帮助表示赞赏.谢谢.

Tam*_*lei 7

这是QMessageBox的构造函数.您可以像使用其他任何构造一样使用它,例如:

QMessageBox msgBox(QMessageBox::Question,
                   "This is the title", 
                   "This is the text", 
                   QMessageBox::Yes | QMessageBox::No, this,
                   Qt::FramelessWindowHint);
msgBox.exec();
Run Code Online (Sandbox Code Playgroud)

要么

QMessageBox* msgBox = new QMessageBox(QMessageBox::Question,
                                      "This is the title", 
                                      "This is the text", 
                                      QMessageBox::Yes | QMessageBox::No, this,
                                      Qt::FramelessWindowHint);
msgBox->exec();
Run Code Online (Sandbox Code Playgroud)

在这种情况下,this是一个父窗口(QMainWindow实例)