[Qt-interest] Strange compilation error

Ian Thomson Ian.Thomson at iongeo.com
Mon Jan 19 09:49:49 CET 2009


Hi,

You can connect a SIGNAL to a SIGNAL if you want.

It seems like he has not included the header for QAbstractItemModel and 
only forward declared it, so the compiler can't tell that it is a QObject.

Cheers,
Ian.

Witteveen, Arnt wrote:
> You need to connect a SIGNAL to a SLOT, not to another SIGNAL.
> Arnt
> 
>     ------------------------------------------------------------------------
>     *From:* qt-interest-bounces at trolltech.com
>     [mailto:qt-interest-bounces at trolltech.com] *On Behalf Of *Etienne
>     Sandré-Chardonnal
>     *Sent:* donderdag 15 januari 2009 15:16
>     *To:* qt-interest at trolltech.com
>     *Subject:* [Qt-interest] Strange compilation error
> 
>     Dear all,
> 
>     I am using this line of code in a QObject subclass:
>     connect(getVariablesModel(), SIGNAL(dataChanged()), this,
>     SIGNAL(functionChanged()));
> 
>     I get this error:
>     no matching function for call to
>     `Material::connect(QAbstractItemModel*, const char[15], Material*
>     const, const char[29])'
> 
>     This is rather strange, as everything seems fine :
>      - QAbstractItemModel is a Qt subclass of QObject
>      - The Material class derives from QObject, and I did not forgot the
>     Q_OBJECT macro. Moreover, I use other connects with Material*
>     pointers without error.
> 
>     More and more strange, if I replace the line by:
>     connect((QObject*)getVariablesModel(), SIGNAL(dataChanged()), this,
>     SIGNAL(functionChanged()));
>     Everything works fine! That means the compiler does not convert
>     QAbstractItemModel* into QObject*
> 
>     I am using MinGW gcc 3.4.2 shipped with Qt
> 
>     If someone could help me to understand this...
> 
>     Thanks!
> 
>     Etienne
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed.  If you are not the original recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error, and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you received this email in error, please immediately notify the sender and delete the original.






More information about the Qt-interest-old mailing list