【问题标题】:showing argument in QMessageBox->setText在 QMessageBox->setText 中显示参数
【发布时间】:2012-07-13 06:35:37
【问题描述】:

我将QMessageBox 定义为

m_setting2 = new QMessageBox();
m_setting2->setWindowTitle("NOTE");
m_setting2->setText("RESETTING PREFERENTIAL VALUE TO ");
m_setting2->show();

m_setting2 是我的QMessageBox*

现在,在setText 中的VALUE TO 之后,我想添加一个取自QLineEdit 的整数的参数。这个整数存储在valuee

那么我如何在VALUE TO 之后打印该整数。

在某处我看到它应该类似于 QString.("%1").arg(valuee) 但它不起作用。

请帮助我并感谢您的任何关注。

【问题讨论】:

    标签: qt qlineedit qmessagebox


    【解决方案1】:
    int value = 5;
    QString text = QString("RESETTING PREFERENTIAL VALUE TO %1").arg(value);
    m_setting2->setText(text);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-15
      • 2023-03-03
      • 2011-04-02
      • 2012-07-18
      • 1970-01-01
      • 2016-07-05
      • 1970-01-01
      • 2015-10-01
      相关资源
      最近更新 更多