Important: Please read the Qt Code of Conduct -

Qt GUI on Shared Object

  • Hello,
    I'm working on Ubuntu Linux and trying to implement following configuration:
    Main non-Qt C++ project on Netbeans IDE, let's say proj. A, that loads another C++ shared object (B), which can perform some operations, and in some condition it can load Qt Shared library with GUI (C) and communicate with the GUI.
    So far i tried to start the Qt GUI object by opening new thread on (B), but it crashes when i'm trying to instanciate the QApplication.
    What is the correct way to implement such chain ?

  • QApplication integrates with the underlying wşndowing system so that it can receive input events, update the UI etc. You should instantiate QApplication in the main thread and also call the the blocking QApplication::exec() if the user is supposed to interact with a custom UI. You can call QApplication::quit() when you are done with the QT-based UI component. Qt's UI classes based on QDialog can be used without calling QApplication::exec() (but you need to call QDİalog::exec in that case).

    To sum up, you need an event loop (QApplication/QDilaog::exec()) in the main thread so that Qt's UI classes can interact with windowing system.

Log in to reply