Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Can Qt be launched as a thread in c application ?
Forum Updated to NodeBB v4.3 + New Features

Can Qt be launched as a thread in c application ?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 4 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • visiotV Offline
    visiotV Offline
    visiot
    wrote on last edited by
    #1

    I want qt to be as frontend of my application , for which i am launching it (qt) as a seperate thread of my multi threaded application . The other threads of my code is written in c. Is this approach feasible , for qt to work or am i missing something here ?
    Thanks

    kshegunovK 1 Reply Last reply
    0
    • M Offline
      M Offline
      mvuori
      wrote on last edited by
      #2

      If the Qt parts are the front end, the UI part, you don't "launch it as a separate thread", but have it as the main thread of the application, and launch the other functionality as separate threads as needed. The UI functions in Qt generally work only in the main thread.

      JKSHJ 1 Reply Last reply
      0
      • M mvuori

        If the Qt parts are the front end, the UI part, you don't "launch it as a separate thread", but have it as the main thread of the application, and launch the other functionality as separate threads as needed. The UI functions in Qt generally work only in the main thread.

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by JKSH
        #3

        @mvuori said:

        The UI functions in Qt generally work only in the main thread.

        Actually, the UI functions in Qt generally work only in the GUI thread (which is the thread that created QGuiApplication/QApplication)

        The GUI thread does not have to be the main thread. See http://stackoverflow.com/questions/22289423/how-to-avoid-qt-app-exec-blocking-main-thread

        @visiot said:

        I want qt to be as frontend of my application , for which i am launching it (qt) as a seperate thread of my multi threaded application . The other threads of my code is written in c. Is this approach feasible , for qt to work or am i missing something here ?
        Thanks

        It is feasible (see my answer in the link above), but you will need to create a wrapper to call C++ functions from C. See http://stackoverflow.com/questions/2744181/how-to-call-c-function-from-c

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • visiotV visiot

          I want qt to be as frontend of my application , for which i am launching it (qt) as a seperate thread of my multi threaded application . The other threads of my code is written in c. Is this approach feasible , for qt to work or am i missing something here ?
          Thanks

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @visiot

          See also this thread:
          https://forum.qt.io/topic/67285/ui-application-as-thread-cpu-load-almost-100/11

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved