c – 用qt信号发出std :: string

我试图用qt信号发出标准字符串.信号将被排队等待.我用qRegisterMetaType注册了类型,就像在qt文档中说的那样,但没有运气.我正在注册
qRegisterMetaType<的std :: string&GT( “的std :: string”)

解决方法

你也应该做:
Q_DECLARE_MetaTYPE (std::string)

报价Qt Doc

Adding a Q_DECLARE_MetaTYPE() makes the type kNown to all template
based functions,including QVariant. Note that if you intend to use
the type in queued signal and slot connections
or in QObject’s
property system,you also have to call qRegisterMetaType() since the names are resolved at runtime.

相关文章

对象的传值与返回说起函数,就不免要谈谈函数的参数和返回值...
从实现装饰者模式中思考C++指针和引用的选择最近在看...
关于vtordisp知多少?我相信不少人看到这篇文章,多半是来自...
那些陌生的C++关键字学过程序语言的人相信对关键字并...
命令行下的树形打印最近在处理代码分析问题时,需要将代码的...
虚函数与虚继承寻踪封装、继承、多态是面向对象语言的三大特...