[Qt-interest] Runtime Error :- connect: No such slot ...
Wm. G. Urquhart
wgu at wurquhart.co.uk
Fri Feb 19 13:33:05 CET 2010
Andreas Pakulat wrote:
> If you look at the API docs you'll notice that setText is not a slot,
> its a normal member function. Hence QObject::connect is correct.
>
Ouch! Yes of course, and by adding / changing SigTest :
private slots:
void setLegend(const QString &) ;
if (connect(pTest, SIGNAL(Boo(const QString &)), this,
SLOT(setLegend(const QString &)), Qt::QueuedConnection))
void SigTest::setLegend(const QString & msg)
{
ui.pushButton->setText(msg) ;
}
Success.
But with that said my original submission still stands, it still doesn't
work even though the slots have been defined in the main UI header and
implemented in source.
I can see why the original test doesn't work, after all it is a bit of a
screamer, but why my original doesn't is beyond me.
I have since included the SignalTest class and the slot definition and
implementation from SigTest in to my original application and it still
doesn't work.
private slots:
void setLegend(const QString &) ;
void MyApp::setLegend(const QString & msg)
{
ui->statusBar->showMessage(msg, 0) ;
}
pTest = new SignalTest() ;
if (connect(pTest, SIGNAL(Boo(const QString &)), this,
SLOT(setLegend(const QString &)), Qt::QueuedConnection))
{
pTest->Start() ;
}
Object::connect: No such slot MyApp::setLegend(const QString &) in
MyApp.cpp:268
Object::connect: (receiver name: 'MyApp')
Anyone?
More information about the Qt-interest-old
mailing list