Question

I have defined my slot like this:

void choixPoints:: prendpixel1(Pixel depart)
{
//...
}

and I want to execute the following sentence:

Pixel depart= picmou->define(); //definition of a pixel, well defined 
connect(chp3, SIGNAL(clicked()), this, SLOT(prendpixel1(Pixel depart)));

However when I execute I obtain:

QObject::connect: No such slot choixPoints::prendpixel1(Pixel depart)

Why doesn't my slot work?

Was it helpful?

Solution

I think the problem is that in your SLOT definition you put a variable name "depart" in, which is not correct. The SLOT and SIGNAL definitions must only have the function name and types. So:

connect(chp3, SIGNAL(clicked()), this, SLOT(prendpixel1(Pixel)));

BTW I think it is also space sensitive, so SLOT(anotherfn(Pixel, Pixel)) would also be wrong.

HTH,Ruth

OTHER TIPS

Did you declare void choixPoints:: prendpixel1(Pixel depart) as a public slot in the header? http://qt-project.org/doc/qt-4.8/signalsandslots.html#a-small-example

You also have to register your data type (here: "Pixel"): http://www.developer.nokia.com/Community/Wiki/Qt_Signal/Slot_with_custom_data_types

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top