Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.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 5.5_C++_Qt - Fatal编程技术网

C++ 没有用于连接调用的匹配函数-Qt 5.5

C++ 没有用于连接调用的匹配函数-Qt 5.5,c++,qt,C++,Qt,当更新信号/插槽函数时,我们会遇到未定义的问题。 这是我们收到的错误: 这是以前的情况,工作正常,没有问题: Mainwindow.cpp connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged); connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);

当更新信号/插槽函数时,我们会遇到未定义的问题。 这是我们收到的错误:


这是以前的情况,工作正常,没有问题:

Mainwindow.cpp

connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);
connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);
Mainwindow.h:

private slots:
void onWindowChanged(QDateTime current, QString processName, QString windowTitle, QString url, long prevPID, long currPID);
private slots:
void onWindowChanged(QDateTime current, QString processName, QString windowTitle, QString url, long prevPID, long currPID, bool whitelisted);
记录h:

public slots:
void onWindowChanged(QDateTime time, QString processName, QString windowTitle, QString url, long prevPID, long currPid);
public slots:
void onWindowChanged(QDateTime time, QString processName, QString windowTitle, QString url, long prevPID, long currPid, bool whitelisted);
B.h:

signals:
void windowChanged(QDateTime time, QString processName, QString windowTitle, QString url = "", long prevPID = -1, long currPid = -1);
signals:
void windowChanged(QDateTime time, QString processName, QString windowTitle, QString url = "", long prevPID = -1, long currPid = -1, bool whitelisted = false);

更改后的数据:

Mainwindow.cpp

connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);
connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);
Mainwindow.h:

private slots:
void onWindowChanged(QDateTime current, QString processName, QString windowTitle, QString url, long prevPID, long currPID);
private slots:
void onWindowChanged(QDateTime current, QString processName, QString windowTitle, QString url, long prevPID, long currPID, bool whitelisted);
记录h:

public slots:
void onWindowChanged(QDateTime time, QString processName, QString windowTitle, QString url, long prevPID, long currPid);
public slots:
void onWindowChanged(QDateTime time, QString processName, QString windowTitle, QString url, long prevPID, long currPid, bool whitelisted);
B.h:

signals:
void windowChanged(QDateTime time, QString processName, QString windowTitle, QString url = "", long prevPID = -1, long currPid = -1);
signals:
void windowChanged(QDateTime time, QString processName, QString windowTitle, QString url = "", long prevPID = -1, long currPid = -1, bool whitelisted = false);

出现错误:

\mainwindow.cpp:84:91: error: no matching function for call to 'MainWindow::connect(Restrict*&, void (Restrict::*)(QDateTime, QString, QString, QString, long int, long int, bool), Record*&, void (Record::*)(QDateTime, QString, QString, QString, long int, long int, bool))'
             connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);
                                                                                           ^
\mainwindow.cpp:84:91: note: candidates are:
In file included from \Qt\5.5\mingw492_32\include/QtCore/qabstractanimation.h:37:0,
                 from \Qt\5.5\mingw492_32\include/QtCore/QtCore:4,
                 from \Qt\5.5\mingw492_32\include/QtWidgets/QtWidgetsDepends:3,
                 from \Qt\5.5\mingw492_32\include\QtWidgets/QtWidgets:3,
                 from \mainwindow.cpp:1:
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:196:36: note: static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
     static QMetaObject::Connection connect(const QObject *sender, const char *signal,
                                    ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:196:36: note:   no known conversion for argument 2 from 'void (Restrict::*)(QDateTime, QString, QString, QString, long int, long int, bool)' to 'const char*'
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:199:36: note: static QMetaObject::Connection QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType)
     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
                                    ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:199:36: note:   no known conversion for argument 2 from 'void (Restrict::*)(QDateTime, QString, QString, QString, long int, long int, bool)' to 'const QMetaMethod&'
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:475:32: note: QMetaObject::Connection QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
 inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
                                ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:475:32: note:   no known conversion for argument 2 from 'void (Restrict::*)(QDateTime, QString, QString, QString, long int, long int, bool)' to 'const char*'
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:213:43: note: template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType)
     static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
                                           ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:213:43: note:   template argument deduction/substitution failed:
\Qt\5.5\mingw492_32\include/QtCore/qobject.h: In substitution of 'template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType) [with Func1 = void (Restrict::*)(QDateTime, QString, QString, QString, long int, long int, bool); Func2 = void (Record::*)(QDateTime, QString, QString, QString, long int, long int, bool)]':
\mainwindow.cpp:84:91:   required from here
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:213:43: error: no type named 'Object' in 'struct QtPrivate::FunctionPointer<void (Record::*)(QDateTime, QString, QString, QString, long int, long int, bool)>'
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:245:13: note: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)
             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
             ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:245:13: note:   template argument deduction/substitution failed:
\mainwindow.cpp:84:91: note:   candidate expects 3 arguments, 4 provided
             connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);
                                                                                           ^
In file included from \Qt\5.5\mingw492_32\include/QtCore/qabstractanimation.h:37:0,
                 from \Qt\5.5\mingw492_32\include/QtCore/QtCore:4,
                 from \Qt\5.5\mingw492_32\include/QtWidgets/QtWidgetsDepends:3,
                 from \Qt\5.5\mingw492_32\include\QtWidgets/QtWidgets:3,
                 from \mainwindow.cpp:1:
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:254:13: note: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0) && (! QtPrivate::FunctionPointer<Func2>::IsPointerToMemberFunction)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType)
             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
             ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:254:13: note:   template argument deduction/substitution failed:
\Qt\5.5\mingw492_32\include/QtCore/qobject.h: In substitution of 'template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0) && (! QtPrivate::FunctionPointer<Func2>::IsPointerToMemberFunction)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType) [with Func1 = void (Restrict::*)(QDateTime, QString, QString, QString, long int, long int, bool); Func2 = void (Record::*)(QDateTime, QString, QString, QString, long int, long int, bool)]':
\mainwindow.cpp:84:91:   required from here
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:254:13: error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
In file included from \Qt\5.5\mingw492_32\include/QtCore/qnamespace.h:37:0,
                 from \Qt\5.5\mingw492_32\include/QtCore/qobjectdefs.h:41,
                 from \Qt\5.5\mingw492_32\include/QtCore/qobject.h:40,
                 from \Qt\5.5\mingw492_32\include/QtCore/qabstractanimation.h:37,
                 from \Qt\5.5\mingw492_32\include/QtCore/QtCore:4,
                 from \Qt\5.5\mingw492_32\include/QtWidgets/QtWidgetsDepends:3,
                 from \Qt\5.5\mingw492_32\include\QtWidgets/QtWidgets:3,
                 from \mainwindow.cpp:1:
\Qt\5.5\mingw492_32\include/QtCore/qglobal.h:1073:45: error: declaration of 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
 template <bool B, typename T = void> struct QEnableIf;
                                             ^
In file included from \Qt\5.5\mingw492_32\include/QtCore/qabstractanimation.h:37:0,
                 from \Qt\5.5\mingw492_32\include/QtCore/QtCore:4,
                 from \Qt\5.5\mingw492_32\include/QtWidgets/QtWidgetsDepends:3,
                 from \Qt\5.5\mingw492_32\include\QtWidgets/QtWidgets:3,
                 from \mainwindow.cpp:1:
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:285:13: note: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)
             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
             ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:285:13: note:   template argument deduction/substitution failed:
\mainwindow.cpp:84:91: note:   candidate expects 3 arguments, 4 provided
             connect(_restrict, &Restrict::windowChanged, _record, &Record::onWindowChanged);
                                                                                           ^
In file included from \Qt\5.5\mingw492_32\include/QtCore/qabstractanimation.h:37:0,
                 from \Qt\5.5\mingw492_32\include/QtCore/QtCore:4,
                 from \Qt\5.5\mingw492_32\include/QtWidgets/QtWidgetsDepends:3,
                 from \Qt\5.5\mingw492_32\include\QtWidgets/QtWidgets:3,
                 from \mainwindow.cpp:1:
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:293:13: note: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType)
             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
             ^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:293:13: note:   template argument deduction/substitution failed:
\Qt\5.5\mingw492_32\include/QtCore/qobject.h: In substitution of 'template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType) [with Func1 = void (Restrict::*)(QDateTime, QString, QString, QString, long int, long int, bool); Func2 = void (Record::*)(QDateTime, QString, QString, QString, long int, long int, bool)]':
\mainwindow.cpp:84:91:   required from here
\mainwindow.cpp:84:91:错误:调用“mainwindow::connect(Restrict*&,void(Restrict:*)(QDateTime,QString,QString,QString,long int,long int,bool),Record*&,void(Record:*)(QDateTime,QString,QString,long int,long int,bool))没有匹配的函数
连接(_restrict,&restrict::windowChanged,_record,&record::onWindowChanged);
^
\mainwindow.cpp:84:91:注:候选人包括:
在\Qt\5.5\mingw492\u 32\include/QtCore/qabstractanimation.h:37:0中包含的文件中,
从\Qt\5.5\mingw492\u 32\include/QtCore/QtCore:4,
从\Qt\5.5\mingw492_32\include/QtWidgets/QtWidgetsDepends:3,
从\Qt\5.5\mingw492\u 32\include\qtwidts/qtwidts:3,
从\mainwindow.cpp:1:
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:196:36:注意:静态QMetaObject::Connection qobject::connect(const qobject*,const char*,const qobject*,const char*,Qt::ConnectionType)
静态QMetaObject::连接连接(常量QObject*发送方,常量字符*信号,
^
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:196:36:注意:参数2没有已知的从“void(Restrict:*)(QDateTime,QString,QString,QString,long int,bool)”到“const char*”的转换
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:199:36:注意:静态QMetaObject::Connection qobject::connect(const qobject*,const QMetaMethod&,const qobject*,const QMetaMethod&,Qt::ConnectionType)
静态QMetaObject::连接连接(const QObject*发送方,const QMetaMethod&signal,
^
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:199:36:注意:参数2没有已知的从“void(Restrict:*)(QDateTime,QString,QString,QString,long int,bool)”到“const QMetaMethod&”的转换
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:475:32:注意:QMetaObject::Connection qobject::Connection(const qobject*,const char*,const char*,Qt::ConnectionType)const
内联QMetaObject::Connection QObject::connect(const QObject*asender,const char*asignal,
^
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:475:32:注意:参数2没有已知的从“void(Restrict:*)(QDateTime,QString,QString,QString,long int,bool)”到“const char*”的转换
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:213:43:注意:模板静态QMetaObject::Connection qobject::connect(常量类型名QtPrivate::FunctionPointer::Object*,Func1,常量类型名QtPrivate::FunctionPointer::Object*,Func2,Qt::ConnectionType)
静态内联QMetaObject::连接连接(const typename QtPrivate::FunctionPointer::Object*sender,Func1信号,
^
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:213:43:注意:模板参数推导/替换失败:
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:替换“模板静态QMetaObject::Connection qobject::connect(常量类型名QtPrivate::FunctionPointer::Object*,Func1,常量类型名QtPrivate::FunctionPointer::Object*,Func2,Qt::ConnectionType)[与Func1=void(Restrict:*)(QDateTime,QString,QString,QString,long int,long int,bool);Func2=void(记录::*)(QDateTime,QString,QString,QString,long int,long int,bool)]:
\mainwindow.cpp:84:91:从此处开始需要
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:213:43:错误:“struct QtPrivate::FunctionPointer”中没有名为“Object”的类型
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:245:13:注意:模板静态类型名QtPrivate::QEnableIf=0),QMetaObject::Connection>::类型qobject::connect(const类型名QtPrivate::FunctionPointer::Object*,Func1,Func2)
connect(常量类型名QtPrivate::函数指针::对象*发送方,Func1信号,Func2插槽)
^
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:245:13:注意:模板参数推导/替换失败:
\mainwindow.cpp:84:91:注意:候选者需要3个参数,提供4个参数
连接(_restrict,&restrict::windowChanged,_record,&record::onWindowChanged);
^
在\Qt\5.5\mingw492\u 32\include/QtCore/qabstractanimation.h:37:0中包含的文件中,
从\Qt\5.5\mingw492\u 32\include/QtCore/QtCore:4,
从\Qt\5.5\mingw492_32\include/QtWidgets/QtWidgetsDepends:3,
从\Qt\5.5\mingw492\u 32\include\qtwidts/qtwidts:3,
从\mainwindow.cpp:1:
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:254:13:注意:模板静态类型名QtPrivate::QEnableIf=0)和(!QtPrivate::FunctionPointer::ispointertomberfunction)),QMetaObject::Connection>::类型qobject::connect(常量类型名QtPrivate::FunctionPointer::Object*,Func1,常量qobject*,Func2,Qt::ConnectionType)
connect(常量类型名称QtPrivate::FunctionPointer::Object*发送方,Func1信号,常量QObject*上下文,Func2插槽,
^
\Qt\5.5\mingw492_32\include/QtCore/qobject.h:254:13:注意:模板参数推导/替换失败:
\Qt\5.5\mingw492\u 32\include/QtCore/qobject.h:用Func1替换“模板静态类型名QtPrivate::QEnableIf=0”&(!QtPrivate::FunctionPointer::IsPointerToMemberFunction)),QMetaObject::Connection>:类型qobject::connect(常量类型名QtPrivate::FunctionPointer::Object*,Func1,常量qobject*,Func2,Qt::ConnectionType)[=