我遇到以下信号槽问题
QCheckBox *hasNotify = new QCheckBox;
connect(hasNotify, SIGNAL(stateChanged(int state)), this, SLOT(showhideNotify(int state)));
Run Code Online (Sandbox Code Playgroud)
我在我的应用程序输出中得到了这个
QObject::connect: No such signal QCheckBox::stateChanged(int state)
Run Code Online (Sandbox Code Playgroud)
但在这里http://qt-project.org/doc/qt-5/qcheckbox.html#stateChanged他们说这个信号包含在 QCheckBox 中,所以我对问题是什么感到困惑。
信号和槽参数不能包含任何变量名,所以你应该写
connect(hasNotify, SIGNAL(stateChanged(int)), this, SLOT(showhideNotify(int)));
Run Code Online (Sandbox Code Playgroud)
在这里查看文档
| 归档时间: |
|
| 查看次数: |
3789 次 |
| 最近记录: |