[Gelöst] Umstellung Qt4 zu Qt5 operator Problem
Verfasst: 4. September 2013 18:57
Hey Leute, ich stelle gerade unser riesen Projekt auf Qt5 um. Jetzt komme ich aber endgültig nicht mehr weiter.
Eine meiner Klassen kompiliert nicht mehr und ich sehe einfach nicht den "wahren" Grund.
Eine meiner Klassen kompiliert nicht mehr und ich sehe einfach nicht den "wahren" Grund.
Code: Alles auswählen
#pragma once
#include <QDebug>
class phonenumber
{
public:
phonenumber();
int type;
QString iac;
QString number;
static QString getTypeName(int type);
QString getDisplayString();
static bool isMobile(QString);
friend QDataStream & operator << ( QDataStream & stream, const phonenumber& what )
{
stream << what.type << what.iac << what.number;
return stream;
};
friend QDataStream & operator >> ( QDataStream & stream, phonenumber & what )
{
stream >> what.type >> what.iac >> what.number ;
return stream;
};
friend bool operator==(const phonenumber& a, const phonenumber& b)
{
return (a.type == b.type && a.iac == b.iac && a.number == b.number);
};
friend QDebug operator<<(QDebug dbg, const phonenumber & a)
{
dbg.nospace() << "[phonenumber " << getTypeName(a.type) <<" " <<a.iac <<" " << a.number<<"]";
return dbg.space();
};
static QList<phonenumber> fromSQLArray(QVariant v);
};
Ich verstehe nicht, warum das nicht gehen soll...In file included from phonenumber.cpp:1:0:
In function ‘QDataStream& operator<<(QDataStream&, const phonenumber&)’:
phonenumber.h:17:18: error: ambiguous overload for ‘operator<<’ in ‘stream << what.phonenumber::type’
phonenumber.h:17:18: note: candidates are:
In file included from /usr/include/qt5/QtCore/qlocale.h:45:0,
from /usr/include/qt5/QtCore/qtextstream.h:48,
from /usr/include/qt5/QtCore/qdebug.h:50,
from /usr/include/qt5/QtCore/QDebug:1,
from phonenumber.h:2,
from phonenumber.cpp:1: