[英]Display QMessageBox with multiple arguments
我正在使用Qt框架,對此有些不滿意。
我有兩個QStrings first
和last
我想在QMessageBox
顯示它們,但不知道如何包含多個參數。
這是我必須使用on參數編碼的內容:
QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first));
如何獲得該輸出中包含的另一個參數( last
)?
所有的arg()都返回一個QString,因此以下代碼應該起作用:
QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first).arg(last));
有關更多信息,您可以在此處查看文檔。
是的,應該做這樣的事情:
QMessageBox::information(0, "Full Name", QString("%1 %2").arg(first, last));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.