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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:07:12+00:00 2026-06-14T03:07:12+00:00

I have a CLI application that I’m expanding to have a user interface to

  • 0

I have a CLI application that I’m expanding to have a user interface to aid in, well, usability, and am using Qt-4.8.3.

The application connects to an IRC server, and each connection resides in its own thread receiving data. A parser, running in a different thread, then processes the data and reacts accordingly – creating a channel, adding a user, etc.

I’ve been looking through the documentation and just can’t decide (or really see) what would be the most useful method to update the UI in my instance – should I create a class inheriting from QThread and run that, do some trickery with QFuture and QtConcurrent, create a custom struct and pass it populated to the UI thread, use a customEvent(), or is there a better way overall? Code legibility and performance are top requirements.

The code I have at the moment runs perfectly, but naturally creating a new QWidget inside the parser thread instantly breaks with the notification that it’s not the UI thread.

There is only a single class (at the moment, which inherits QObject and provides signals + slots capability) that I’m using to run exec on the QApplication, and also holds the creation functions for the server, channel, user, etc.

I can post some code if needed, but there’s a lot of it, and I’m not sure it would really be relevant.

  • 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-14T03:07:13+00:00Added an answer on June 14, 2026 at 3:07 am

    The canonical way of doing this is to create QObject/QThread pairs (or multiple QObjects and a single QThread, if you want multiple functions to run in the same thread.) Instead of subclassing QThread, you subclass QObject, create a QThread and move your QObject subclass instance to that thread with moveToThread(). The intended use of QThread is as an interface to the operating system’s threading functionality, not as a container that runs your code. (See http://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation).

    All communication with the GUI has of course to happen using signals and slots.

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

Sidebar

Related Questions

I have a cli application that doesn't like the usage of wildcards. In this
This is a .NET application on Windows forms using C++/CLI. I have a JPEG
I have a Java application using a SSH connection, remotely running CLI commands. For
I have a C++/CLI project that wraps a native C++ application, which I use
Using the GitHub application on Mac (not the cli), I have this error which
Let's assume I have some method that executes CLI application. For example: public string
I have an application written in C++/CLI that uses a library written in C#.
Good day, I am writing a simple CLI (command-line interface) application that provides a
I have a C++/CLI based install application which needs to close another app I've
I have a C++/CLI project that wraps around an unmanaged C compression library, and

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.