[Qt-interest] Signals and child classes

Marcello Romani mromani at ottotecnica.com
Mon Mar 22 15:53:36 CET 2010


Hi,
     I've written a simple log class which inherits from QTextEdit.
It just adds a public slot, logMessage(const QString&), which I'd like 
to connect another object to.
The error I get is:

Object::connect: No such slot QTextEdit::logMessage(const QString&)

The source line where this happens is:

connect(parser, SIGNAL(messageWaiting(const QString&)), logText, 
SLOT(logMessage(const QString&)));

logText is declared QtLogText*, and before I call connect it's 
initialized like this: logText = new QtLogText();

What I don't understand is why connect is referring to the base class, 
which obviously doesn't have the logMessage slot, instead of the child one.

Thanks in advance.

-- 
Marcello Romani



More information about the Qt-interest-old mailing list