QMetaObject::connectSlotsByName: 没有匹配的信号

QMetaObject::connectSlotsByName: No matching signal(QMetaObject::connectSlotsByName: 没有匹配的信号)
本文介绍了QMetaObject::connectSlotsByName: 没有匹配的信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个QT菜单,它自动连接到动作函数on_actionOpen_triggered().后来我想将文件名字符串传递给这个函数,以便在特殊情况下手动调用这个函数.所以我将函数签名更改为 on_actionOpen_triggered( const char *filename_in ).修改后程序运行良好,但终端报错,

I set a QT menu, which is automatically connected with action function on_actionOpen_triggered(). Later I want to pass a filename string to this function in order to call this function manually in a special condition. So I changed the function signature to on_actionOpen_triggered( const char *filename_in ). After this change the program is running well, but there is a complain in terminal,

QMetaObject::connectSlotsByName: on_actionOpen_triggered(const char*) 没有匹配的信号

QMetaObject::connectSlotsByName: No matching signal for on_actionOpen_triggered(const char*)

我想知道发生了什么,以及如何为此菜单操作功能添加参数.

I am wondering what happened, and how I can add arguments for this menu action functions.

谢谢.

推荐答案

我遇到了同样的警告/错误 QMetaObject::connectSlotsByName: No matching signal for

并得到了简单的解决方案.例如:

And got simple solution. For Example:

问题:
QMetaObject::connectSlotsByName: on_actionOpen_triggered(const char*) 没有匹配的信号 警告您只需要更改 Slot

Problem :
QMetaObject::connectSlotsByName: No matching signal for on_actionOpen_triggered(const char*) Warning You just need to change the name of the Slot

解决方案
更改插槽名称,如 on_actionOpenTriggered,此警告消失.

提示
Qt 尝试理解其默认插槽,如 on__,因此如果您指定任何具有上述签名的插槽,Qt 将抛出警告.

Hint
Qt try to understand its default slot like on_<name_of_object>_<action>, So if you specify any slot with above signature, Qt will throw warning.

希望对大家有所帮助.

这篇关于QMetaObject::connectSlotsByName: 没有匹配的信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)