Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/161.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 新的Qt信号语法错误,带重载,不带此_C++_Qt_Qt5_Signals Slots - Fatal编程技术网

C++ 新的Qt信号语法错误,带重载,不带此

C++ 新的Qt信号语法错误,带重载,不带此,c++,qt,qt5,signals-slots,C++,Qt,Qt5,Signals Slots,当我写的像 connect(m_someClasspointer, &SomeClassName::SignalA, &CurrentClass::slotMethod); 我出错了 error: no matching function for call to 'QtPrivate::FunctionPointer<void (CurrentClass::*)()>::call(void (CurrentClass::*&)(), QObject*&am

当我写的像

 connect(m_someClasspointer, &SomeClassName::SignalA, &CurrentClass::slotMethod);
我出错了

error: no matching function for call to 'QtPrivate::FunctionPointer<void (CurrentClass::*)()>::call(void (CurrentClass::*&)(), QObject*&, void**&)'
             FuncType::template call<Args, R>(static_cast<QStaticSlotObject*>(this_)->function, r, a);
一切都好。但QObject中存在过载

inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
                                        const char *amember, Qt::ConnectionType atype) const

所以我完全不明白为什么第一个变量不起作用。

您正在尝试传递直接函数指针,而您引用的重载采用
const char*
。如果您查看一下,您会发现传递直接函数指针是由模板支持的,并且该模板没有非静态形式


对于使用
const char*
的重载,请使用宏信号和插槽,例如
SIGNAL(SignalA())
SLOT(slotMethod())
您尝试传递直接函数指针,而您引用的重载采用
const char*
。如果您查看一下,您会发现传递直接函数指针是由模板支持的,并且该模板没有非静态形式


对于使用
const char*
的重载,请使用宏信号和插槽,例如
SIGNAL(SignalA())
SLOT(slotMethod())
您尝试传递直接函数指针,而您引用的重载采用
const char*
。如果您查看一下,您会发现传递直接函数指针是由模板支持的,并且该模板没有非静态形式


对于使用
const char*
的重载,请使用宏信号和插槽,例如
SIGNAL(SignalA())
SLOT(slotMethod())
您尝试传递直接函数指针,而您引用的重载采用
const char*
。如果您查看一下,您会发现传递直接函数指针是由模板支持的,并且该模板没有非静态形式

对于使用
const char*
的重载,请使用宏信号和插槽,例如
SIGNAL(SignalA())
SLOT(slotMethod())

inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
                                        const char *amember, Qt::ConnectionType atype) const