[quote=引用 3 楼 jklinux 的回复:] [quote=引用 2 楼 qqwangfan 的回复:] 可以改为直接用QMessageBox的对象操作对话框,能够像正常窗口widget一样操作QMessageBox,代码如下: QMessageBox box; box.setText(QString::fromLocal8Bit("Come on \n Welcome.")); box.setStyleSheet("color:red"); QFont font; font.setPixelSize(18); box.setFont(font); box.setFixedSize(200, 200); int bret = box.exec();
我一般喜欢继承qwidget然后自定义一个界面专门用作对话框,这样很灵活,效果:
[quote=引用 2 楼 qqwangfan 的回复:] 可以改为直接用QMessageBox的对象操作对话框,能够像正常窗口widget一样操作QMessageBox,代码如下: QMessageBox box; box.setText(QString::fromLocal8Bit("Come on \n Welcome.")); box.setStyleSheet("color:red"); QFont font; font.setPixelSize(18); box.setFont(font); box.setFixedSize(200, 200); int bret = box.exec();
可以改为直接用QMessageBox的对象操作对话框,能够像正常窗口widget一样操作QMessageBox,代码如下: QMessageBox box; box.setText(QString::fromLocal8Bit("Come on \n Welcome.")); box.setStyleSheet("color:red"); QFont font; font.setPixelSize(18); box.setFont(font); box.setFixedSize(200, 200); int bret = box.exec();
16,203
社区成员
26,591
社区内容
加载中
试试用AI创作助手写篇文章吧