[Qt-interest] Runtime Error :- connect: No such slot (Update)
Andreas Pakulat
apaku at gmx.de
Sat Feb 20 10:36:57 CET 2010
On 20.02.10 08:41:21, Wm. G. Urquhart wrote:
> 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?
Is setLegendIndex also declared as a slot? Did you forget the Q_OBJECT
macro? If neither of these two is the problem please post a complete
example showing the problem.
Andreas
--
You're ugly and your mother dresses you funny.
More information about the Qt-interest-old
mailing list