如何在QtCreator中编写多行QMessageBox
How to write on multiple lines in a QMessageBox in QtCreator?
本文关键字:QMessageBox QtCreator 更新时间:2023-10-16
我想在消息框中有以下几行:
name:
surname:
data:
test:
在每个:
之后,我将以编程方式填充该行。我想问我怎么能在QMessageBox中有这个结构。有可能吗?
我是Qt Creator的初学者。目前我学会了这样做:
QMessageBox noc;
std::string s= "hello1";
QString er = s.c_str();
noc.setText(er);
noc.exec()
QString str;
str = QString("name: %1nsurname: %2ndata: %3").arg(...).arg(...).arg(...);
QMessageBox::information(0, "Title", str);
看一下QMessageBox::information()和QString::arg()
只需在每个字符串的末尾加上"n"…
QMessageBox noc;
QString er = tr("name: %1nsurname: %2ndata: %3ntest:%4").arg(...);
noc.setText(er);
noc.exec();
相关文章:
- 桌面中的Qt QMessageBox中心'critical'
- 如何从QDialog的常量方法显示QMessageBox?
- QT5对QinputDialog和Qmessagebox的未识别引用.错误
- QMessageBox exec 似乎没有返回 QDialog::D ialogCode
- 如何在不使用json的情况下解析QtC++中的数据
- QMessageBox:无法在框中显示文本(使用 c++)
- 在程序启动时选择不同的QMainWindow,但面临奇怪的QMessageBox exec()行为
- 如何在qt qmessagebox中添加可变值
- 如何在QtC++中生成带有数字签名的PDF
- 如何调整 QMessageBox 的大小
- Moving QMessageBox?
- 显示带有多个参数的QmessageBox
- 如何防止显示 QMessageBox 时出现双槽调用
- 共享库中的QMessageBox引发错误
- QMessageBox disappears
- 如何设置QGraphicsSimpleTextItem(QtC++)的背景
- 问题5.1-QMessageBox错误?如果在QDialog隐藏时调用了QMessageBox,则程序退出(0)
- '(QMessageBox::Icon)1u'不能用作函数
- Q桥接和显示QMessageBox
- QtC++编译是在没有显示程序的情况下完成的