5
I’m trying to make a simple dialog box display my name. See the code.
Pessoa *p = new Pessoa("Ronald Araújo", "[email protected]", 23);
QMessageBox msg;
msg.setText(QString::fromUtf8(p->getNome()));
msg.exec();
But the code breaks in the setText() line with the following error:
error: no matching Function for call to 'Qstring::fromUtf8(Std::string)' msg.setText(Qstring::fromUtf8(p->getName));
Remembering that when I put for example msg.setText(Qstring::fromUtf8("Hi world")) the code runs normally.
Implementation to return the name:
string Pessoa::getNome(){ return this->nome; }
Someone can give me a light?
Just to confirm, you added the #include <Qstring> ?
– Giovani