显示具有多个参数的QMessageBox [英] Display QMessageBox with multiple arguments
本文介绍了显示具有多个参数的QMessageBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Qt框架,我有点生锈。
我有两个QStrings 第一
和最后
我想显示在 QMessageBox
但不知道如何包括多个参数。
这是我必须用参数来编码:
QMessageBox :: information(0,Full Name,QString(%1%2)。
如何获取其他参数( last
所有的arg()都返回一个QString,所以下面的代码应该工作:
解决方案
p>
QMessageBox :: information(0,Full Name,QString(%1%2)。arg(first).arg (持续));
有关详细信息,可以查看文档此处。
I'm using the Qt framework and I'm a little rusty with it.
I have two QStrings first
and last
I want to display them in a QMessageBox
but don't know how to include multiple arguments.
This is what I have to code it with on argument:
QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first));
How do I get the other argument (last
) included in that output?
解决方案
All of the arg()s return a QString so the following should work:
QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first).arg(last));
For more information, you can check the documentation here.
这篇关于显示具有多个参数的QMessageBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文