void ProcessiondisplayMessageconst QString& information qDebug information; 在TextEdit中显示消息 if information ui-message-appendinformation; GQtClientSmarthome_Clientprocessioncpp63 e
这个错误是因为在条件语句中,需要一个布尔值作为条件,而你传递了一个QString类型的变量。要解决这个问题,你可以使用QString的isEmpty()方法来检查字符串是否为空。修改代码如下:
void Procession::displayMessage(const QString& information)
{
qDebug() << information;
// 在TextEdit中显示消息
if (!information.isEmpty()) {
ui->message->append(information);
}
}
这样修改后,如果字符串不为空,就会将其追加到TextEdit中显示。
原文地址: https://www.cveoy.top/t/topic/iBdH 著作权归作者所有。请勿转载和采集!