Hi ,
when I compile my code, i have error :
passing 'const QList<Element>' as 'this' argument of 'QList<T>& QList<T>::operator<<(const T&) [with T = Element]' discards qualifiers
passing 'const QList<Element>' as 'this' argument of 'QList<T>& QList<T>::operator<<(const T&) [with T = Element]' discards qualifiers
To copy to clipboard, switch view to plain text mode
My class "Element" :
class Element
{
public:
Element();
Element(QString Aleja,QString Numer,QString Strona);
QString Aleja;
QString Numer;
QString Strona;
};
class Element
{
public:
Element();
Element(QString Aleja,QString Numer,QString Strona);
QString Aleja;
QString Numer;
QString Strona;
};
To copy to clipboard, switch view to plain text mode
And class "Strona" :
class Strona
{
public:
Strona();
QList<Element> listElementow;
Element pobierzElement(QString NumerElementu);
Element pobierzElement(int Index);
void dodajElement(QString NrAleji,QString NrElementu,QString NrStrony) const;
};
class Strona
{
public:
Strona();
QList<Element> listElementow;
Element pobierzElement(QString NumerElementu);
Element pobierzElement(int Index);
void dodajElement(QString NrAleji,QString NrElementu,QString NrStrony) const;
};
To copy to clipboard, switch view to plain text mode
and function where i have arror:
Strona::dodajElement Code:
void Strona::dodajElement(QString NrAleji,QString NrElementu,QString NrStrony) const{
listElementow << Element(NrAleji,NrElementu,NrStrony);
}
void Strona::dodajElement(QString NrAleji,QString NrElementu,QString NrStrony) const{
listElementow << Element(NrAleji,NrElementu,NrStrony);
}
To copy to clipboard, switch view to plain text mode
So how a resolved this problem?
Bookmarks