显示带有多个参数的QMessageBox

时间:2015-05-05 20:41:07

标签: c++ qt arguments qstring qmessagebox

我使用的是Qt框架,我对它有点生疏。

我有两个QS字符串firstlast

我希望在QMessageBox中显示它们,但不知道如何包含多个参数。

这就是我必须在参数上编码:

QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first));

如何获得该输出中包含的其他参数(last)?

2 个答案:

答案 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));