[Qt-interest] Strange compilation error

Witteveen, Arnt ArntW at enfocus.com
Mon Jan 19 09:43:39 CET 2009


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
	
	
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090119/839e6f58/attachment.html 


More information about the Qt-interest-old mailing list