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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:53:34+00:00 2026-06-05T06:53:34+00:00

I am trying to use Qt as a library (similar to this ), because

  • 0

I am trying to use Qt as a library (similar to this), because I want to reuse Qt classes in some currently non-Qt applications, and in shared libraries as cross-platform glue. Everything is non-GUI.

Some problems are easily avoided by DirectConnection, some can be solved with private event loops, even one can run a fake QCoreApplication in a thread and it works (last resort).

I want to know what modules rely on a running instance of QCoreApplication and cannot work without it.

Some of the Qt modules (in QtCore) do need an instance of QCoreApplication to run properly. For example QTimer relies on QCoreApplication to dispatch timer events.
I was reading the documentation for QtConcurrentRun and it seems to be relying on a global instance of QThreadPool, I am about to try and see if the application execution is vital, or maybe the instance is created on first access, or maybe not.

I am going to study QCoreApplicationPrivate source (Windows and Linux for now) but any hints in the right direction is greatly appreciated.

What are other functionality dependencies to the core application? Note that it might depend on the OS.

Edit1: Thanks to Kuba’s answer, It seems QCoreApplication event loop is not necessary for timer and socket events to be dispatched. So some QtCore modules require and instance of QCoreApplication, but there is no need to have a running application event loop.

  • 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-05T06:53:36+00:00Added an answer on June 5, 2026 at 6:53 am

    You are conflating the existence of a QCoreApplication with a running event loop. Those two are separate concepts. You may well need the former for the latter, but the latter doesn’t have to run in the same thread as the former.

    Most notably, you don’t really have to call qApp->exec() if you don’t have any events to dispatch in the thread where you constructed QCoreApplication.

    The existence of a QCoreApplication is, as it were, a non-issue. Things get hairier with QApplication — you can start it in a non-gui thread, but it’s not portable and won’t work on OS X. I’m trying to figure out why it doesn’t work, but I don’t have much time now to offer a satisfactory solution — not yet.

    It is also a misconception that QCoreApplication’s event loop needs to be running for socket notifications and timer events to be dispatched to other threads. A QCoreApplication’s event loop is nothing special. There is a platform-specific instance of QAbstractEventDispatcher that gets created for a thread when you instantiate the first QEventLoop in that thread. The QEventLoop doesn’t know anything specific about the platform.

    QCoreApplication’s exec() method is quite simple and creates an instance of QEventLoop, and thus will create an instance of platform-specific QAbstractEventDispatcher. This instance is not special in any way. It’s the same as any other event dispatcher created in any other thread, as far as my code reading tells so far.

    If all underlying window systems would support it, it’d be in fact possible to make Qt GUI code multithreaded — the per-thread event reception and dispatch is already there as a small first step. The big obstacle, probably the only one, would be the X library and its display lock. The display lock would be an obvious matter of contention between threads. You’d need each thread that wants to talk to the GUI open up a separate connection to the X server, and I don’t know if there’s a supported way of doing that from Xlib.

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

Sidebar

Related Questions

I'm trying to use this library (which looks very nice) but I'm having difficulty
I am currently developing an Android-App in Eclipse and trying to use a Library
I am trying to use FileHelper library for parsing a text file. Ultimately the
I have a problem. I'm trying to use urllib library in python. but, I
I'm trying to use curses.h library for the first time, but no matter which
I'm trying to use the curses library on Microsoft's Visual Studio C++. I downloaded
I'm trying to use a C++ library (CLucene) from my Cocoa Touch iPhone application
i am trying to use php-openid library for implementing openID in my site. the
I'm trying to use the librsync library in my java program trough the JNA.
I am trying to use Pixastic JavaScript library for image manipulation in Windows 8

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.