You must dereference the NameAsDefault
variable
void ProfileManager::revertName(){
lineditPlayerName->setText(*NameAsDefault);
// ^ Here I dereferenced the pointer
btnRevertName->setEnabled(false);
}
The type of nameAsDefault
is pointer to a QString
. However QLineEdit::setText
expects a QString
object, not a pointer. Therefore the compiler tells you that there is no function which expects a pointer.
I did not see your declaration of the nameAsDefault
variable, but since
nameAsDefault = new QString(lineditPlayerName->text());
compiles and new
returns a pointer, I suppose it is a pointer.
Also, what is probably more important is that you should almost never allocate objects using new
. Especially not objects from the Qt
library, which are implicitly shared.