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 16:01:52 +0100
BTW, declaring a parameter const when it is passed by value is not useful. Is there a reference somewhere ?

Matthieu

Daniel Walz wrote:
Hi all,

but the compiler's problem is a different one:
In Qt 2.3 there is only a function defined as follows:
type* *first* <http://doc.trolltech.com/2.3/qlist.html#e625f9> ()
So the QList in 2.3 is actually a pointer of the list type (other than in current 4.x). But this function is not a const function (because the reference returned might change the list item, which is prohibited by the const qualifier.

Regards,
Daniel


Falko Buttler schrieb:

Hello Oliver,

you are trying to put a QNetworkOperation object into a QNetworkOperation pointer! That is not possible ;-)

The right code could be look like that:

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

Regards,
Falko



Oliver Elphick schrieb:

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


--
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>