我设置了一个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: 没有匹配的信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!