Hi
Is there any way to pass structure as parameters for signals and slots
thanks,
vishwa.
Hi
Is there any way to pass structure as parameters for signals and slots
thanks,
vishwa.
Yes, Qt just has to be made aware of the type. See Q_DECLARE_METATYPE and qRegisterMetaType.
J-P Nurmi
here is my senario
I have a struct
struct SourceDoneParams_t
{
int eventType;
char* url;
};
Q_DECLARE_METATYPE(mmafwrapper::SourceDoneParams_t );
connected signal/slot something like this
connect(this, SIGNAL(applySourceDone(const mmafwrapper::SourceDoneParams_t)), this,
SLOT(onApplySourceDone(const mmafwrapper::SourceDoneParams_t)));
And I am getting error whenever signal is emmited
QObject::connect Cannot Queue arguments of type 'mmafwrapper::SourceDoneParams_t'
From Q_DECLARE_METATYPE:
Note that if you intend to use the type in queued signal and slot connections, you also have to call qRegisterMetaType() since such connections are resolved at runtime.
J-P Nurmi
vishwanath (22nd November 2006)
sunil.thaha (23rd November 2006)
Bookmarks