I have a slot that is triggered by a QFutureWatcher. I'm trying to cast the sender to get the results
QFutureWatcher<QPair<QImage,QString>>* QFW = qobject_cast<QFutureWatcher<QPair<QImage,QString>>*>(sender());
but keep getting
error: static assertion failed: qobject_cast requires the type to have a Q_OBJECT macro
I'm not really sure what's wrong here, these are all Qt built-in types, so what am I doing wrong?
You have to put Q_OBJECT in the Class Definition, like this:
class MyClass : public QObject
{
Q_OBJECT
// ^^^^^^^^^^
public:
MyClass();
/*...*/
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With