2010-01-30 133 views
1

标题很好地描述了我的问题。没有这样的信号QTableWidget :: cellChanged(int,int)

问题的代码行:

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

我能想到的任何理由认为信号是无效的。我搜索了一下,发现了几个有同样问题的人,但是摆在那里的解决方案并不奏效。

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

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

我不知所措。

感谢您的任何建议!

+0

添加了更多通用标签“qt”。 – Wildcat 2010-01-30 11:05:55

+0

该标签更具体..不一般。不管怎么说,还是要谢谢你。 – 2012-04-09 23:01:19

回答

6

似乎对我说,你不明白Qt's Signals and Slots concepts.信号& 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. =) 
} 
+0

啊!我早先看到了确切的建议,但现在这一切都有道理。呃天真。感谢kemiisto。 – 2010-01-30 13:11:25

相关问题