error: static assertion failed: Signal and slot arguments are not compatible.

简介: error: static assertion failed: Signal and slot arguments are not compatible.

编译错误

/usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:314: error: static assertion failed: Signal and slot arguments are not compatible.
  314 |         Q_STATIC_ASSERT_X((FunctorArgumentCount >= 0),
      |         ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:367: error: request for member ‘operator()’ in ‘QtPrivate::FunctorReturnType<const char*, QtPrivate::List<> >::dummy<const char*>()’, which is of non-class type ‘const char*’
  367 |         typedef decltype(dummy<Functor>().operator()((dummy<ArgList>())...)) Value;
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~^

1.png


错误原因:


信号和插槽参数不兼容。


通俗的说,就是信号用的一种形式(如&QTimer::),槽用了另一种形式连接(SLOT)。


修改前:

connect(&timer,&QTimer::timeout,this,SLOT(timeout()));

修改后:

connect(&timer,&QTimer::timeout,this,&Http::timeout);

再次编译,错误就没有了

相关文章
成功解决:Error in created hook: “ReferenceError: params is not defined“
该博客文章描述了作者解决"ReferenceError: params is not defined"错误的过程,原因是路由传递的params参数与调用方法中的参数名称冲突,最终通过检查接口参数解决了问题。
成功解决:Error in created hook: “ReferenceError: params is not defined“
|
4月前
|
存储 缓存 自然语言处理
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
38 1
|
5月前
|
JavaScript 安全 网络安全
Node: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]异常处理
Node: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]异常处理
2016 0
|
Java Maven Android开发
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
107 0
|
5月前
|
Perl
报错:error Parsing error: x-invalid-end-tag
报错:error Parsing error: x-invalid-end-tag
105 0
error : Class declarations lacks Q_OBJECT macro
error : Class declarations lacks Q_OBJECT macro
|
关系型数据库 MySQL C++
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
161 0
|
Java Android开发
Bad method handle type 7异常解决
在利用androidx版本写demo时,在添加了一些依赖后,遇到了`java.lang.ClassNotFoundException`bug,这就很奇怪了,我就添加rxjava3的依赖,就给我报这个错误。