当前位置: 首页>>代码示例>>C++>>正文


C++ QNetworkReply::manager方法代码示例

本文整理汇总了C++中QNetworkReply::manager方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkReply::manager方法的具体用法?C++ QNetworkReply::manager怎么用?C++ QNetworkReply::manager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QNetworkReply的用法示例。


在下文中一共展示了QNetworkReply::manager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

QNetworkAccessManager *QNetworkReplyProto::manager() const
{
  QNetworkReply *item = qscriptvalue_cast<QNetworkReply*>(thisObject());
  if (item)
    return item->manager();
  return 0;
}
开发者ID:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:7,代码来源:qnetworkreplyproto.cpp

示例2: OnLoggedIn

void LoginDialog::OnLoggedIn() {
    QNetworkReply *reply = qobject_cast<QNetworkReply *>(QObject::sender());
    QByteArray bytes = reply->readAll();
    int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    if (status != 302) {
        DisplayError("Failed to log in (invalid password or expired session ID? try re-logging with email/password pair or via steam)");
        return;
    }

    QList<QNetworkCookie> cookies = reply->manager()->cookieJar()->cookiesForUrl(QUrl(POE_MAIN_PAGE));
    for (auto &cookie : cookies)
        if (QString(cookie.name()) == POE_COOKIE_NAME)
            session_id_ = cookie.value();

    // we need one more request to get account name
    QNetworkReply *main_page = login_manager_->get(QNetworkRequest(QUrl(POE_MY_ACCOUNT)));
    connect(main_page, SIGNAL(finished()), this, SLOT(OnMainPageFinished()));
}
开发者ID:Kashbel,项目名称:acquisition,代码行数:18,代码来源:logindialog.cpp

示例3: loginResult

void Session::Request::onLoginPageResult() {
    QNetworkReply *reply = qobject_cast<QNetworkReply*>(QObject::sender());
    int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    if (status != 302) {
        emit loginResult(0x01, "Failed to log in (invalid password or expired session ID).");
    }
    else {
        QList<QNetworkCookie> cookies = reply->manager()->cookieJar()->cookiesForUrl(MainUrl());
        for (auto &cookie : cookies) {
            if (QString(cookie.name()) == SessionIdCookie()) {
                _sessionId = cookie.value();
                emit loginResult(0x00, "Logged in!");
                break;
            }
        }

        QNetworkRequest request = createRequest(AccountUrl());
        QNetworkReply *r = _manager->get(request);

        connect(r, &QNetworkReply::finished, this, &Session::Request::Request::onAccountPageResult);
    }
    reply->deleteLater();
}
开发者ID:Novynn,项目名称:Adamant,代码行数:23,代码来源:sessionrequest.cpp


注:本文中的QNetworkReply::manager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。