显示带有多个参数的QmessageBox

Display QMessageBox with multiple arguments

本文关键字:参数 QmessageBox 显示      更新时间:2023-10-16

我正在使用QT框架,我对此有点生锈。

我有两个QStrings firstlast

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

这是我必须与参数进行编码:

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

如何获得该输出中包含的另一个参数(last)?

所有arg()s返回QString,以下内容应起作用:

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

有关更多信息,您可以在此处查看文档。

是的,应该做这样的事情:

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