如何在QMessageBox中打印变量值

How do I print a variable value in QMessageBox?

本文关键字:打印 变量值 QMessageBox      更新时间:2023-10-16

我是否需要先使用QString然后将其放在msgbox中?有什么例子吗?

QMessageBox文档中有示例:

QMessageBox msgBox;
msgBox.setText("Put your text here");
msgBox.exec();

还有一些人在那里。

您可以使用下面的示例,您可以添加任意数量的参数。

int device_count=0;
QString status = QString("Found %1 device(s):").arg(device_count);
QMessageBox::information(this, tr("Info"), status);