如何在Qt中从Qt MessageBox中删除标题栏?
我已经经历了
QMessageBox::QMessageBox(Icon icon, const QString & title, const QString & text, StandardButtons buttons, QWidget * parent, Qt::WindowFlags f)而是如何使用它。有什么例子吗?任何帮助都是非常感谢的。谢谢。
发布于 2011-10-05 19:00:22
这就是QMessageBox的构造函数。您可以像使用任何其他构造函数一样使用它,例如:
QMessageBox msgBox(QMessageBox::Question,
"This is the title",
"This is the text",
QMessageBox::Yes | QMessageBox::No, this,
Qt::FramelessWindowHint);
msgBox.exec();或
QMessageBox* msgBox = new QMessageBox(QMessageBox::Question,
"This is the title",
"This is the text",
QMessageBox::Yes | QMessageBox::No, this,
Qt::FramelessWindowHint);
msgBox->exec();在本例中,this是一个父窗口(QMainWindow实例)
发布于 2011-10-05 18:55:10
在Qt::WindowFlags f参数中,您可以传递告知如何修饰对话框窗口的选项。
Qt::Windows标志是| Qt::WindowType的分隔列表。默认情况下,对话框获取Qt::Dialog类型。如果您想要更改它,可以尝试使用Qt::FramelessWindowHint值来完全删除对话框周围的标题栏和框架。尝试其他选项可能会得到您想要的结果。
发布于 2013-08-08 15:51:37
我认为Qt::Sheet在我的情况下更好。它完全是mac风格的。QtMessageBox::information会给你在mac下的Qt::Dialog风格。
https://stackoverflow.com/questions/7659622
复制相似问题