[Qt-interest] Runtime Error :- connect: No such slot (Update)
Wm. G. Urquhart
wgu at wurquhart.co.uk
Sat Feb 20 09:41:21 CET 2010
Well this get weirder and weirder. In my code I have an existing slot
declared as:
void typeChanged(int) ;
when I 're-wire' my connect(...) to this slot it works, however; if I
change the code to use setLegendIndex(int) the connect(...) fails!
Object::connect: No such slot MyApp::setLegendIndex(int) in myapp.cpp:302
Object::connect: (receiver name: 'MyApp')
With setLegendIndex being declared thus:
void setLegendIndex(int msg) ;
and implemented using this:
void MyApp::setLegendIndex(int msg)
{
::QMessageBox::information(this, "Set Legend", tr("Value is
%1").arg(msg)) ;
}
It was suspected that setLegendIndex was getting 'optimised' out but as
I use an if (...) to connect the signal I call the function when it fails:
pTest = new SignalTest() ;
if (connect(pTest, SIGNAL(Boo(int)), this, SLOT(setLegendIndex(int)),
Qt::ConnectionType::QueuedConnection))
{
pTest->Start() ;
}
else
{
setLegendIndex(5) ;
}
If I could be any more confused I would be, does anyone have any
suggestions here?
I know what I am trying to do works as my test application verifies
this, but there must be something subtle that is 'poisoning' my real
application.
--
Thanks
William
More information about the Qt-interest-old
mailing list