I want to chanhe the background colour and font of QMessageBox button? Any help will be greatly appreciated.
问问题
3394 次
1 回答
2
#include <QtWidgets>
int main(int argc,char* argv[])
{
QApplication app(argc,argv);
QMessageBox msgBox(QMessageBox::Information,
"QMessageBox Background Color",
"This is QMessageBox with Different Background Color");
//Change background color
QPalette palette;
palette.setColor(QPalette::Background, Qt::cyan);
msgBox.setPalette(palette);
//Change font
QFont font( "Tokyo" );
font.setPointSize( 32 );
font.setWeight( QFont::Bold );
font.setItalic( TRUE );
msg->setFont(font);
msg->exec();
msgBox.show();
return app.exec();
}
于 2016-02-10T06:40:19.007 回答