So, I am trying to use the following code to pass an object to a function in Qt, then convert it to a QLabel for further processing (it's part of an animation sequence):
void myAnimation(QObject* label)
{
QLabel *lbl = qobject_cast<QLabel*>label;
//more code.....
}
Yet, whenever I try to compile, I get the following two errors:
error: C2440: 'initializing' : cannot convert from 'overloaded-function' to 'QLabel *' Context does not allow for disambiguation of overloaded function
and
error: C2146: syntax error : missing ';' before identifier 'label'
Why isn't my code working? Any help is appreciated. Thank you!
Try:
QLabel *lbl = qobject_cast<QLabel*>(label);
// ^ ^