What should I do to be able to send signals to slots with QVector
of my custom class objects as an argument?
struct LicenseInfo
{
QString company_name;
QString server_name;
QString product_name;
int product_version;
QString license_end;
QString last_update;
QString comment;
};
Usage
connect(_worker, SIGNAL(newLicensesActivated(QVector<LicenseInfo>)),
this, SLOT(newLicensesActivated(QVector<LicenseInfo>)));
It is ok to do the following?
#include "licenseinfo.h"
Q_DECLARE_METATYPE(LicenseInfo)
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qRegisterMetaType<QVector<LicenseInfo>>();
MainWindow w;
w.show();
return a.exec();
}
Should I use both Q_DECLARE_METATYPE
macro and qRegisterMetaType
function in this case?