[Qt-interest] Runtime Error :- connect: No such slot ...

Wm. G. Urquhart wgu at wurquhart.co.uk
Fri Feb 19 14:44:53 CET 2010


Sean Harmer wrote:
> Look into the generated moc_sigtest.cpp file and check that the code 
> implementing the slot call is actually being generated by moc. If the example 
> works but your app doesn't work even with the same receiver then your app (or 
> the app's build system) must be doing something differently.

This I've done and I see this in the generated moc file from the not 
working version :

case 0: setLegend((*reinterpret_cast< const QString(*)>(_a[1]))); break;

And I see this :

case 0: setLegend((*reinterpret_cast< const QString(*)>(_a[1]))); break;

from the working version.

> Are you able to call the setLegend() function directly or do you get a linker 
> error when you try it? Just wondering if you are picking up a stale include 
> file from somewhere.

Yes, I can by adding :

if (connect(...))
...
else
{
	setLegend(tr("Set Legend")) ;
}

to the code and with the connect failing I see this text appear in a 
QMessageBox as directed.

The only thing that I can see here between the two projects is that the 
working SigTest is derived from QDialog whereas MyApp is derived from 
QMainWindow, or am I just getting desperate?

I really don't see this being a Qtism I suspect the fault is between the 
seat and the keyboard but for the life of me I can't see where or why.





More information about the Qt-interest-old mailing list