Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8462435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:09:58+00:00 2026-06-10T14:09:58+00:00

I have two http get methods. First is getting UserID and second is getting

  • 0

I have two http get methods.

First is getting UserID and second is getting full information about current user;

I want to handle finished signlas with different slots

handle GetUserID finished with GetUserIDCompleted and handle GetUserDetails with GetUserDetailsCompleted

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    nam = new QNetworkAccessManager(this);

    GetUserID();
    connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(GetUserIDCompleted(QNetworkReply*)));

    GetUserDetails();
    connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(GetUserDetailsCompleted(QNetworkReply*)));
}

does it possible to get QNetworkReplay in different SLOTS?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:10:00+00:00Added an answer on June 10, 2026 at 2:10 pm

    maybe you can do something like this: having an enum of the different methods

    enum GetMethod
    {
        getUserId,
        getUserDetails
    };
    

    And you keep a hash of the reply and the corresponding method:

    QHash<QNetworkReply*, GetMethod> hash;
    
    QNetworkReply *reply1 = nam->post(requestUserId, data);
    hash[reply1] = GetMethod::getUserId;
    
    QNetworkReply *reply2 = nam->post(requestUserDetails, data);
    hash[reply2] = GetMethod::getUserDetails;
    
    connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(finished(QNetworkReply*)));
    

    And have one slot that calls the right function

    void MainWindow::finished(QNetworkReply *reply)
    {
        switch(hash[reply])
        {
        case GetMethod::getUserId:
            GetUserIDCompleted(reply);
            break;
        case GetMethod::getUserDetails:
            GetUserDetailsCompleted(reply);
            break;
        }
    
        hash.remove(reply);
    }
    

    I haven’t tried it and took some shortcuts but you get the spirit of it =) . It seems that you can retrieve the request with the answer, but I think it is easier with the enum.

    Hope it helped

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions. The first is about updating the UI, the second is
I have two models: User and Base. User model: http://pastebin.com/WdLzBkHJ Base model: http://pastebin.com/tQrEUaSu At
I have two websites: http://example.com http://example.com/sub I have a page, let's say: http://example.com/sub/page1 Is
I have a two column layout: http://jsfiddle.net/KqQ42/1/ Now I would like that the left
I have two URLs: One is the application URL = http://domain.com/app One is the
I have two pairs of drag/drop/sortable lists using JqueryUI.http://jqueryui.com/demos/sortable/ My problem is that I
I have two files and the content is as follows: alt text http://img144.imageshack.us/img144/4423/screencapture2b.png alt
I have two similar wordpress websites. http://site.com/ and http://site.com/en/ When I try to load
I have this script http://jsfiddle.net/gphp/ZMmRv/4/ I have two events: 1 - the div is
I have two requests in tomcat. One HTTP request will create a thread. Client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.