Qt - QCheckBox不会发出stateChanged(int state)信号

3
我遇到了以下信号槽的问题。
QCheckBox *hasNotify = new QCheckBox;
connect(hasNotify, SIGNAL(stateChanged(int state)), this, SLOT(showhideNotify(int state)));

我在应用程序输出中获取到了这个信息。
QObject::connect: No such signal QCheckBox::stateChanged(int state)

但是在这里http://qt-project.org/doc/qt-5/qcheckbox.html#stateChanged,他们说这个信号已经包含在QCheckBox中了,所以我对问题感到困惑。
1个回答

5

信号和槽参数不能包含任何变量名,因此您应该编写:

connect(hasNotify, SIGNAL(stateChanged(int)), this, SLOT(showhideNotify(int)));

请参阅此处的文档:这里

谢谢,这确实解决了我的问题,我还是Qt的新手,谢谢 :) - Dennis

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接