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 6896291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:01:07+00:00 2026-05-27T07:01:07+00:00

I want QNetworkAccessManager to run HTTP requests in seperate thread. Currently in QT4.6 it

  • 0

I want QNetworkAccessManager to run HTTP requests in seperate thread. Currently in QT4.6 it is running in the same thread and it causes my browser to hang.
This feature is recently introduced in QT 4.8 but now I cant switch to QT 4.8. therefore I want to implement this in QT 4.6 for QNetworkAccessManager .

Can anyone help me on this?

  • 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-05-27T07:01:08+00:00Added an answer on May 27, 2026 at 7:01 am

    There are more than a couple ways to accomplish what you desire.

    First, make sure you are using the QNetworkAccessManager correctly. By default HTTP requests, such as:

    QNetworkAccessManager *manager= new QNetworkAccessManager(this);
    manager->post(QNetworkRequest(QUrl("http://www.example.com/")));
    

    are made asynchronously, but this does not necessarily mean they are in their own thread. If you make a bunch of these calls, you could slow down the containing thread.

    Now, one way that I use to ensure requests are made in separate threads is to create an entire QObject/QWidget for my QNetworkAccessManager like this:

    (Header)

    class Manager : public QWidget
    {
        Q_OBJECT
    
    public:
        Manager(QWidget *parent=0);
        QNetworkAccessManager *manager;
    private slots:
        void replyFinished(QNetworkReply* data);
    };
    
    //... ... ...
    //Later in the main thread declaration
    //... ... ...
    
    class MainBrowserWindow : public QWidget
    {
         //.... ... .. .. 
         //Other stuff for the main window
    
         Manager managingWidget;
         //this ensures that a new thread will be created and initialized
         //alongside our MainBrowserWindow object (which is initialized in main.cpp)
    
    };
    

    (Implementation)

    Manager::Manager(QWidget *parent): QWidget (parent){
        //Initialize the widget here, set the geometry title and add other widgets
        //I usually make this a QWidget so that it can double as a
        //pop-up progress bar.
    
        manager = new QNetworkAccessManager(this);
        connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));
    }
    

    Now you can make calls to your manager object from your main window’s implementation with calls like:

    managingWidget.manager->post()
    

    Once again, this is only one of the many methods you may use, and in some instances the QNetworkAccessManager will automatically place requests in their own thread. But this should force the operating system to place all of your requests in a thread separate from your main thread.

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

Sidebar

Related Questions

Want to verify that my understanding of how this works. Have a C++ Class
Want to just confirm on following. Please verify if this is correct: 1. As
Want to make a vocabulary list in HTML & CSS that looks like this:
Want to know which CSS styles are currently being used on a web page.
want to drag element to specific div and if not dragged to this div
This is driving me crazy. I want to show in a QWebPage an url,
Want to check if this a good example for representing the abstract factory pattern.
Want to do a checkboxes for has_many :through. Railscast in 2007 recommends this: check_box_tag
Want to do this: (EDIT: bad sample code, ignore and skip below) struct RECORD
Want to know what the stackoverflow community feels about the various free and non-free

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.