How do I print a variable value in QMessageBox?
Do I need to use a 开发者_开发技巧QString
first then put it in the msgbox? Are there any examples?
The QMessageBox documentation has examples in it:
QMessageBox msgBox;
msgBox.setText("Put your text here");
msgBox.exec();
There are a few others in there. Please read the docs.
you can use the folowing example and you can add as many as arguments you want.
int device_count=0;
QString status = QString("Found %1 device(s):").arg(device_count);
QMessageBox::information(this, tr("Info"), status);
精彩评论