我使用的是Qt框架,我对它有点生疏。
我有两个QS字符串first
和last
我希望在QMessageBox
中显示它们,但不知道如何包含多个参数。
这就是我必须在参数上编码:
QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first));
如何获得该输出中包含的其他参数(last
)?
答案 0 :(得分:4)
所有arg()都返回一个QString,因此以下内容应该有效:
for(ARecord rec : started) {
JLogger.appendLineToConsole(rec.line);
commonTextArea.append(rec.line+"\n");
}
有关详细信息,请查看文档here。
答案 1 :(得分:0)
是的,应该这样做:
QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first, last));