• 8517阅读
  • 1回复

passing 'const QString' as 'this' argument of 'QString& QString::…… [复制链接]

上一主题 下一主题
离线pangsht
 
只看楼主 正序阅读 楼主  发表于: 2010-12-28
如题。错误出现在下面的槽函数的str=ui->comboBox_2->currentText();这一行中,错误是:
passing 'const QString' as 'this' argument of 'QString& QString::operator=(const QString&)' discards qualifiers

voidProInfo::StyleAdd(constQString&str)
{
       str=ui->comboBox_2->currentText();
       if(str=="abc")
            dlg->show();
}
谢谢!
离线jdwx

只看该作者 1楼 发表于: 2010-12-28
去掉Const试试。也就是说=号左边的值不可变导致错误!
voidProInfo::StyleAdd(QString&str)
{
       str=ui->comboBox_2->currentText();
       if(str=="abc")
            dlg->show();
}
发帖时要说明:操作系统、Qt版本、编译器,这样能更快的得到回复。
快速回复
限100 字节
 
上一个 下一个