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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:24:01+00:00 2026-06-13T05:24:01+00:00

I have an application in which each thread (except the main thread) needs to

  • 0

I have an application in which each thread (except the main thread) needs to create its own window. I tried creating a thread and then calling this->exec() in the run function. However, I get an error before I even get to that call: ASSERT failure in QWidget: "Widgets must be created in the GUI thread."

I want to popup a message window. The problem is that the source has multiple threads each of which may need to popup its own message.

  • 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-13T05:24:03+00:00Added an answer on June 13, 2026 at 5:24 am

    If you need to create QWidget(or some other gui component(s)) in different(non-main) thread(s) you can implement it in such way:

    • Create simple wrapper which holds gui component:

      // gui component holder which will be moved to main thread
      class gui_launcher : public QObject
      {
        QWidget *w;
        // other components
        //..
      public:
        virtual bool event( QEvent *ev )
        {   
          if( ev->type() == QEvent::User )
          {
            w = new QWidget;
            w->show();
            return true;
          }
          return false;
        }
      };
      
    • create QApplication object in main thread

    • another thread body:

      ..
        // create holder
        gui_launcher gl;
        // move it to main thread
        gl.moveToThread( QApplication::instance()->thread() );
        // send it event which will be posted from main thread
        QCoreApplication::postEvent( &gl, new QEvent( QEvent::User ) );
      ..
      
    • be happy, 🙂

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

Sidebar

Related Questions

I have an application which runs some multi-threading process. In each thread I'm sharing
I have an application which is receiving data for thousands (say 50,000) subjects. Each
I have an application which performs 30 independent tasks simultaneously using multithreading, each task
We have a Flex application which has several 'pages' worth of content. Each time
i'm building an android application which have a chat. in this chat i each
I have a ASP.NET web application which has more than 100 pages. Each page
In .Net/C# Application, I have data structures which have references to each other. When
I have application which needs to use a dll (also written by me) which
I have my application in which in three datagridview independently in three thread load
I have an application that runs many threads. Each thread should have a timer

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.