views:

200

answers:

1

The title describes my problem quite well.

The offending line of code:

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

I can think of no reason why that signal is not valid. I googled around, and found a couple people with the same problem, but the solutions posed there don't work.

I'm using Qt 4.5.2 on Ubuntu Karmic, g++.

Anyone know what I am doing wrong? Trolltech's documentation regarding cellChanged() doesn't mention any special requirements.

I'm at a loss.

Thanks for any advice!

+4  A: 

Hi Dane,

it seems for me that you don't understand Qt's Signals and Slots concepts. The SIGNAL & SLOT macro take an interface. Something like

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

might work but you need to have same argument count in your slot, to make it work like you expect:

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

Slot should look something like this:

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. =)
}
kemiisto
Ahh! I saw that exact advice earlier, but now it all makes sense. Ahh to be naive. Thanks kemiisto.
Dane Larsen