本文整理汇总了C++中Account::SetTrusted方法的典型用法代码示例。如果您正苦于以下问题:C++ Account::SetTrusted方法的具体用法?C++ Account::SetTrusted怎么用?C++ Account::SetTrusted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::SetTrusted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleRequestAuthTokenFinished
void AuthManager::handleRequestAuthTokenFinished ()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*> (sender ());
if (!reply)
return;
Account *acc = Reply2Account_.take (reply);
reply->deleteLater ();
const auto& res = Util::ParseJson (reply, Q_FUNC_INFO);
if (res.isNull ())
return;
const auto& map = res.toMap ();
if (map.contains ("error"))
return;
if (map.contains ("access_token"))
acc->SetAccessToken (map ["access_token"].toString ());
if (map.contains ("uid"))
acc->SetUserID (map ["uid"].toString ());
acc->SetTrusted (true);
emit authSuccess (acc);
}
示例2: handleRequestAuthTokenFinished
void AuthManager::handleRequestAuthTokenFinished ()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*> (sender ());
if (!reply)
return;
Account *acc = Reply2Account_.take (reply);
reply->deleteLater ();
QByteArray data = reply->readAll ();
bool ok = false;
QVariant res = QJson::Parser ().parse (data, &ok);
if (!ok)
return;
QVariantMap map = res.toMap ();
if (map.contains ("error"))
return;
if (map.contains ("access_token"))
acc->SetAccessToken (map ["access_token"].toString ());
if (map.contains ("refresh_token"))
acc->SetRefreshToken (map ["refresh_token"].toString ());
acc->SetTrusted (true);
emit authSuccess (acc);
}