Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use GUI in a DLL file by QT5.3.1

How to use GUI in a DLL file by QT5.3.1

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 1 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.
  • C Offline
    C Offline
    cawlfj
    wrote on last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • C Offline
      C Offline
      chrisaverage
      wrote on last edited by
      #2

      It's not that simple. This scenario (running Qt UI as a plugin in non-Qt program) is a lot more challenging than simply calling show on a widget.

      First of all you need to make sure that your app can find and load all the necessary Qt dlls including core stuff, platform plugins, image plugins etc. If it can't it will just crash.

      Second - Qt needs a valid QApplication instance existing in the main thread throughout the life of all the widgets. As a main thread I mean the thread the UI is going to run in.

      Next - Qt types need a running event loop to properly dispatch events and signal/slot connections. This generates a problem, because if you simply start an event loop it ill allow Qt types to work but will effectively freeze the rest (non-Qt) of the app untill you exit the loop. This bring us to the final point.

      Last but not least - to make this all work and not to block your main app you need to run the Qt part in a separate thread and manage it properly.

      This topic has been discussed several times in this forum so for more details you might want to use the search.

      C 1 Reply Last reply
      0
      • C chrisaverage

        It's not that simple. This scenario (running Qt UI as a plugin in non-Qt program) is a lot more challenging than simply calling show on a widget.

        First of all you need to make sure that your app can find and load all the necessary Qt dlls including core stuff, platform plugins, image plugins etc. If it can't it will just crash.

        Second - Qt needs a valid QApplication instance existing in the main thread throughout the life of all the widgets. As a main thread I mean the thread the UI is going to run in.

        Next - Qt types need a running event loop to properly dispatch events and signal/slot connections. This generates a problem, because if you simply start an event loop it ill allow Qt types to work but will effectively freeze the rest (non-Qt) of the app untill you exit the loop. This bring us to the final point.

        Last but not least - to make this all work and not to block your main app you need to run the Qt part in a separate thread and manage it properly.

        This topic has been discussed several times in this forum so for more details you might want to use the search.

        C Offline
        C Offline
        cawlfj
        wrote on last edited by
        #3
        This post is deleted!
        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