Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qRegisterMetaType usage

Tags:

qt

  #include<QMetaType>

  typedef QList<int> IntList;

  qRegisterMetaType<IntList>("IntList");


error C2909: 'qRegisterMetaType': explicit instantiation of function template requires return type

C2909 says I need to define

 template int qRegisterMetaType<IntList>("IntList");

If I define like I mentioned above then I get the below error

 error C2059: syntax error : 'string'
 warning C4667: 'int qRegisterMetaType(void)' : no function template defined that matches forced instantiation

why do I get this error ?

like image 677
Srikan Avatar asked Jul 26 '12 23:07

Srikan


1 Answers

int metatype_id = qRegisterMetaType<IntList>("IntList");
like image 109
liuyi.luo Avatar answered Oct 27 '22 23:10

liuyi.luo