我设置了一个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模板网!
如何在 C++ 中读取和操作 CSV 文件数据?How can I read and manipulate CSV file data in C++?(如何在 C++ 中读取和操作 CSV 文件数据?)
在 C++ 中,为什么我不能像这样编写 for() 循环:In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,为什么我不能像这样编写 for() 循环: for(
OpenMP 如何处理嵌套循环?How does OpenMP handle nested loops?(OpenMP 如何处理嵌套循环?)
在循环 C++ 中重用线程Reusing thread in loop c++(在循环 C++ 中重用线程)
需要精确的线程睡眠.最大 1ms 误差Precise thread sleep needed. Max 1ms error(需要精确的线程睡眠.最大 1ms 误差)
是否需要“do {...} while ()"?环形?Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?环形?)