没有这样的信号QTableWidget :: cellChanged(int,int)

Dan*_*sen 1 qt signals qt4 qtablewidget

标题很好地描述了我的问题.

令人讨厌的代码行:

connect(table, SIGNAL(cellChanged(row, 5)), this, SLOT(updateSP()));
Run Code Online (Sandbox Code Playgroud)

我无法想到这个信号无效的原因.我google了一下,发现有几个人有同样的问题,但那里提出的解决方案不起作用.

我在Ubuntu Karmic上使用Qt 4.5.2,g ++.

谁知道我做错了什么?Trolltech关于cellChanged()的文档没有提到任何特殊要求.

我不知所措.

谢谢你的建议!

Wil*_*cat 6

对我来说,你似乎不了解Qt的信号和插槽概念.SIGNAL&SLOT宏采用接口.就像是

connect(table, SIGNAL(cellChanged(int, int)), this, SLOT(updateSP()));
Run Code Online (Sandbox Code Playgroud)

可能会工作,但你需要在你的插槽中有相同的参数计数,以使它像你期望的那样工作:

connect(table, SIGNAL(cellChanged(int, int)), this, SLOT(updateSP(int, int)));
Run Code Online (Sandbox Code Playgroud)

插槽应该看起来像这样:

void ClassFoo::updateSP(int row, int column)
{
  // row is the number of row that was clicked;
  // column is the number of column that was clicked;
  // Here we go! It's right place to do some actions. =)
}
Run Code Online (Sandbox Code Playgroud)