[Qt-interest] Strange compilation error

Etienne Sandré-Chardonnal etienne.sandre at polytechnique.org
Thu Jan 15 15:16:19 CET 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090115/96abccd6/attachment.html 


More information about the Qt-interest-old mailing list