QtMqtt 错误QMQTT::ClientError转 QString

QString QtMqttClient::Mqtt_Error_2_Str(const QMQTT::ClientError error) {
QString err_str;

switch (error) {
case QMQTT::ClientError::UnknownError : err_str = "未知的错误";
break;
case QMQTT::ClientError::SocketConnectionRefusedError : err_str = "连接拒绝错误";
break;
case QMQTT::ClientError::SocketRemoteHostClosedError : err_str = "远程主机关闭错误";
break;
case QMQTT::ClientError::SocketHostNotFoundError : err_str = "主机未找到错误";
break;
case QMQTT::ClientError::SocketAccessError : err_str = "访问错误";
break;
case QMQTT::ClientError::SocketResourceError : err_str = "资源错误";
break;
case QMQTT::ClientError::SocketTimeoutError : err_str = "超时错误";
break;
case QMQTT::ClientError::SocketDatagramTooLargeError : err_str = "数据报太大错误";
break;
case QMQTT::ClientError::SocketNetworkError : err_str = "网络错误";
break;
case QMQTT::ClientError::SocketAddressInUseError : err_str = "地址使用错误";
break;
case QMQTT::ClientError::SocketAddressNotAvailableError : err_str = "地址不可用错误";
break;
case QMQTT::ClientError::SocketUnsupportedSocketOperationError : err_str = "不支持的套接字操作错误";
break;
case QMQTT::ClientError::SocketUnfinishedSocketOperationError : err_str = "操作未完成错误";
break;
case QMQTT::ClientError::SocketProxyAuthenticationRequiredError : err_str = "代理验证要求错误";
break;
case QMQTT::ClientError::SocketSslHandshakeFailedError : err_str = "Ssl握手失败错误";
break;
case QMQTT::ClientError::SocketProxyConnectionRefusedError : err_str = "代理连接拒绝错误";
break;
case QMQTT::ClientError::SocketProxyConnectionClosedError : err_str = "代理连接关闭错误";
break;
case QMQTT::ClientError::SocketProxyConnectionTimeoutError : err_str = "代理连接超时错误";
break;
case QMQTT::ClientError::SocketProxyNotFoundError : err_str = "代理未找到错误";
break;
case QMQTT::ClientError::SocketProxyProtocolError : err_str = "代理协议错误";
break;
case QMQTT::ClientError::SocketOperationError : err_str = "套接字操作错误";
break;
case QMQTT::ClientError::SocketSslInternalError : err_str = "Ssl内部错误";
break;
case QMQTT::ClientError::SocketSslInvalidUserDataError : err_str = "Ssl无效用户数据错误";
break;
case QMQTT::ClientError::SocketTemporaryError : err_str = "暂时的错误";
break;
case QMQTT::ClientError::MqttUnacceptableProtocolVersionError : err_str = "Mqtt不可接受协议版本";
break;
case QMQTT::ClientError::MqttIdentifierRejectedError : err_str = "Mqtt标识符被拒绝";
break;
case QMQTT::ClientError::MqttServerUnavailableError : err_str = "Mqtt服务器不可用";
break;
case QMQTT::ClientError::MqttBadUserNameOrPasswordError : err_str = "Mqtt错误的用户名或密码";
break;
case QMQTT::ClientError::MqttNotAuthorizedError : err_str = "Mqtt未授权";
break;
case QMQTT::ClientError::MqttNoPingResponse : err_str = "Mqtt无Ping响应";
break;
}
return err_str;
}