1

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

有问题的代码行:

connect(table, SIGNAL(cellChanged(row, 5)), this, SLOT(updateSP()));

我想不出那个信号无效的原因。我四处搜索,发现几个人有同样的问题,但那里提出的解决方案不起作用。

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

有人知道我在做什么错吗?奇趣科技关于 cellChanged() 的文档没有提及任何特殊要求。

我不知所措。

感谢您的任何建议!

4

1 回答 1

6

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

connect(table, SIGNAL(cellChanged(int, int)), this, SLOT(updateSP()));

可能有效,但您的插槽中需要有相同的参数计数,以使其按预期工作:

connect(table, SIGNAL(cellChanged(int, int)), this, SLOT(updateSP(int, int)));

插槽应如下所示:

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. =)
}
于 2010-01-30T10:55:29.297 回答