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

  • SEARCH
  • Home
  • 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 6622875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:27:48+00:00 2026-05-25T21:27:48+00:00

I am doing one web related project. Recently I hit on this situation. This

  • 0

I am doing one web related project. Recently I hit on this situation. This is just a stub

Class My_Class
{
public:
    My_Class();
    void start();
public slots():
    void after_Load_Function();
}

My_Class::My_Class()
{
    //Some initializations
    connect(WebPage,SIGNAL(finished()),this,SLOTS(after_Load_Function()));
}

void My_Class::start()
{
    WebPage->load();
}

void My_Class::after_Load_Function()
{
    //Do something with the finished WebPage
}

int main(int argc,char * argv[])
{
    //Some Qt things

    My_Class a;
    a.start();
}

“WebPage” emits the signal “finished” when it loaded fully.
Now the problem is before the “webPage” got loaded the “start” is returning. Thereby the control reaches the “main”. So, now the control should return from “start” only after “after_Load_Function” finishes it’s job. Thereby I want the below sequence,

  1. main creates the My_Class object A.
  2. main calls “start” from A.
  3. start calls load from “WebPage” and it waits untill the “WebPage” emits “finished”,
    and that emit in turn calls the “after_Load_Function”, and “after_Load_Function”
    finishes it’s job.
  4. now, the “start” returns
  5. main returns

But, I don’t know how to make this kind of wait condition. How can I go about it?

  • 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-25T21:27:49+00:00Added an answer on May 25, 2026 at 9:27 pm

    You can do this by running a local event loop, letting the components process network income and load the page. When they emit the signal, you execute a slot on the event loop to quit it.

    void My_Class::start()
    {
        QEventLoop qel;
        QObject::connect(WebPage, SIGNAL(finished()), &qel, SLOT(quit()));
    
        WebPage->load();
        qel.exec();
    }
    

    I’ve been using this before and it works fine. I don’t advice to use this too often though, because it will process events, including those that the caller of start might not be expecting to be processed during the call to start, so you need to document this to its callers. You can prevent the processing of some events by passing certain flags to QEventLoop::exec, like preventing to process user interface events.

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

Sidebar

Related Questions

We have a class hierarchy similar to this one: public class TestDereference { private
I am very new to grails.I am doing one sample project for image uploading
I'm about to start a project where I will be the only one doing
I can disable one and one by doing this: jQuery('#ListBoxA').attr('disabled','true'); But how can I
This one is a case of not doing your homework.:-) Apart from dynamic loading
One thing I've started doing more often recently is retrieving some data at the
This is a question related to how people are handling a situation in the
I am working on one web application. The project located on my linux box
I'm doing one research on video encoding tools for flv. I tested flvtool2 and
i am doing one small application , wheich have login functionality, in the user

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.