[Qt-interest] Signals and child classes
Frederic Tingaud
tingaud at gostai.com
Mon Mar 22 15:56:48 CET 2010
Marcello Romani a écrit :
> 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.
>
>
Hi,
You probably forgot the Q_OBJECT macro, didn't you ?
--
-------------------------------------------------------------------------------
Frederic TINGAUD
More information about the Qt-interest-old
mailing list