QString New Line
问题 I want to add a new line to my QString . I tried to use \n , but I am receiving an error of "Expected Expression". An example of my code can be found below: if (ui->lineEdit_Company_Name->text().isEmpty()) ErrorLog = ErrorLog + "Company Name is empty", \r\n; if(ui->lineEdit_Company_Owner->text().isEmpty()) ErrorLog = ErrorLog + "Company Owner is empty", \r\n; 回答1: You need to use operator+, push_back, append or some other means for appending when using std::string , QString and the like.