Strange Error message
-
Just try clean once, run qmake and rebuild. If you still face the issue, drop me the code. I will check and revert quickly.
-
Tried that but still no change...
Thanks for taking a lookmy code:
https://www.dropbox.com/sh/qkujdbs0trjksvq/AADEV3y0xMyQ__WyP6IkzLOha?dl=0
-
Hi,
You can't copy QObject derived class so addToList should have a pointer to staff as parameter
-
Thanks a lot SGaist
I now get another error I don't understand...
error: expected unqualified-id before if'
At the code:
@
QFile file("staff.txt");if (!file.open(QIODevice:: WriteOnly | QIODevice:: Text))
return;
@ -
Is this code located in a function ?
-
No it's not could that be it?
-
You can't write code freely anywhere in a file in C/C++ It needs to be inside a function/method.
-
Thanks I moved it into a function. now i'm getting an error invalid conversion from int to char* in the following function @QString staff::toString() {
return QString("Name: %1 \n Birth Date: %2 \n Staff Type: %3 \n \n").arg(s_name).arg(s_birthDate.toString('yyyyMMdd').arg(getTypeString()));
}@there's no int in this function though? Could it be the enum s_type? I created a function getTypeString @
staff::getTypeString() {
return property("Type").toString();
}
that's supposed to return a QString... -
The only error I see currently is that you have a misplace arg. You attached your third parameter to the s_birthDate.toString call
-
So should the parameters start at %0?
-
Nop, that part is fine
-
which third parameter did I attach to s_birthDate.toString()?
-
@
QString("Name: %1 \n Birth Date: %2 \n Staff Type: %3 \n \n")
.arg(s_name) << correct
.arg(s_birthDate.toString('yyyyMMdd').arg(getTypeString() << arg of toString rather than arg for QString()
@