qt-interest@trolltech.com
[Top] [All Lists]

Re: I don't understand this error

Subject: Re: I don't understand this error
From: Matthieu Brucher
Date: Mon, 27 Feb 2006 15:52:42 +0100
Oliver Elphick wrote:
Here is the code that is failing:

235   void VanConnect::upload_copy_started(const QList<QNetworkOperation> l)
236   {
237     QNetworkOperation* op = l.first();
        ...
      }

and the error:
vanconnect.cpp: In method `void
VanConnect::upload_copy_started(QList<QNetworkOperation>)':
vanconnect.cpp:237: passing `const QList<QNetworkOperation>' as `this'
argument of `class QNetworkOperation *
QList<QNetworkOperation>::first()' discards qualifiers


The compiler is claiming the method takes an argument of type
QList<QNetworkOperation> whereas the actual argument is
const QList<QNetworkOperation>


Compiler is g++ 2.95
Qt 2.3.10

The list is a constant list, so getting a non-const pointer to the first element is not possible. You must pass a QList instead or not modify QList by declaring op to be const.

Matthieu

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>