mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
reverted commit:97dda0b because QMetaEnum is working fine, it just needed the Q_ENUMS macro too
made INetwork::connectionStatusToString a static method
This commit is contained in:
@@ -38,6 +38,7 @@ namespace BlackCore
|
||||
class INetwork : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(ConnectionStatus)
|
||||
|
||||
protected:
|
||||
/*!
|
||||
@@ -64,20 +65,11 @@ namespace BlackCore
|
||||
Connected
|
||||
};
|
||||
|
||||
static const QString connectionStatusToString(ConnectionStatus status)
|
||||
static QString connectionStatusToString(ConnectionStatus status)
|
||||
{
|
||||
// the version with metaObject, metaObject()->indexOfEnumerator does not work anymore
|
||||
// an interface cannot be used with Q_DECLAREMETATYPE
|
||||
switch (status)
|
||||
{
|
||||
case Disconnected: return "disconnected";
|
||||
case DisconnectedError: return "disconnectedError";
|
||||
case Connecting: return "connecting";
|
||||
case Connected: return "connected";
|
||||
default: break;
|
||||
}
|
||||
qFatal("Missing value");
|
||||
return ""; // just for compiler warning
|
||||
int index = staticMetaObject.indexOfEnumerator("ConnectionStatus");
|
||||
QMetaEnum metaEnum = staticMetaObject.enumerator(index);
|
||||
return metaEnum.valueToKey(status);
|
||||
}
|
||||
|
||||
virtual bool isConnected() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user