没有匹配的成员函数来调用"连接" - 使用"this"时
No Matching Member Function to Call 'connect' - When Using 'this'
我的程序运行良好,但我想在其中添加一个额外的信号来显示更新的值。这是第一次信号实际上来自类本身,所以我决定使用this
,正如您将看到的那样。
程序
在我的头文件中,像往常一样,我声明我的信号:
signals:
void NotifyStatusUpdated(const QString& value);
private:
SetupTab& m_setupTab;
Instrument& m_instrument;
在.cpp中,最后构造的是信号:
WireMessages();
emit NotifyStatusUpdated(tr("Long wait time (Ms) updated : %1 ").arg(long_wait));
然后在下面我有这个:
void SetupViewManager::WireMessages()
{
connect(&m_instrument, &Instrument::NotifyErrorDetected,
&m_setupTab, &SetupTab::onStatusUpdated); //this works
connect(&m_instrument, &Instrument::NotifyStatusUpdated,
&m_setupTab, &SetupTab::onStatusUpdated); //this works
connect(this, &Instrument::NotifyStatusUpdated, //this does not work (it doesn't build)!
&m_setupTab, &SetupTab::onStatusUpdated);
}
所以在我的类引用m_instrument
中,我有另一个同名的信号。所以这里我想调用来自this
类的信号。
错误
error: no matching member function for call to 'connect'
connect(this, &Instrument::NotifyStatusUpdated,
^~~~~~~
这在我看来是不对的?我犯了什么愚蠢的错误?
this
指针属于代码中的SetupViewManager
类:
connect(this, &SetupViewManager::NotifyStatusUpdated, ...
// ^^^^^^^^^^^^^^^^
相关文章:
- 无法在windows上使用mingw将sqlite3与c连接
- 使用 bfs 解决连接组件问题时得到错误的答案
- 套接字连接"Operation not permitted"错误,甚至使用升压/平发器根.cpp
- 无法使用 ESP32 连接家庭 WiFi?
- 如何使用connect将qml按钮与同一类的cpp函数连接起来
- 计算出有多少客户端可以连接到我正在使用的一些tcp服务器代码
- 如何使用 winsock2 实现与 c++ 的多个并行连接?
- 读取 TCP 标头并使用RAW_SOCKET管理 TCP 连接
- 如果两个线程相互依赖,则 cpp 线程连接应使用连接导致死锁
- 如何在使用 getch 后在另一个字符串的末尾连接一个字符串
- 如何使用新语法QT5将信号连接到信号?
- Qt5:连接:如果插槽的参数少于信号,如何使用"连接"
- 使用 ssh 重新连接到远程 Ubuntu 机器后,如何继续使用 gdb 调试 c++ 代码?
- 无法使用 azure-iot-arduino 库将 azure IoT 中心与 esp8266 连接
- QT连接:使用lambda表达式重置通过了int变量(怪异)
- 如何在Windows 7桌面上接受传入的蓝牙连接(使用c++或c#程序)
- 我应该为多个连接使用单个ODBC环境吗
- MongoDB C++驱动程序中关于通过游标间接连接使用的线程安全性
- 没有匹配的成员函数来调用"连接" - 使用"this"时
- boost::asio 和多个客户端连接使用异步