Insert a Qt Gui into an existing C++ project



  • hi all,
    i have a c++ project developed with Visual Studio2010 and now i need to create a gui finally.
    the problem is, that at the end i should only have one dll!
    how can i start my Qt gui from my c++ project?
    maybe i'm thinking to complicated but i hope someone can help
    br



  • Hi,

    this is a big vague....

    First of all, I expect an application to be an executable, not a dll. How should that dll be used?
    Qt comes with several dlls. If you want to create only one binary, you must link it statically, which means you must create a GPL app or use a commercial license.



  • ok, more info
    i have a program, let's call it bigdog.exe that uses my dll to calculate something! and now i want to open a new small gui for this calculator! the programmer of bigdog only allow me to include one dll.

    i hope now it's better to understand why i need this



  • So, some more questions:

    Who is spinning an event loop? Is the dll used in the main thread? This is a must for a UI. Is the dll used synchronous or asynchronously?
    How is bigdog implemented? This will have influence on how you build your UI.



  • [quote author="Gerolf" date="1335275573"]So, some more questions:

    Who is spinning an event loop?[/quote]
    if i understand you right, this is one of my main question. how can i get my gui started from my c++ project

    [quote author="Gerolf" date="1335275573"]
    Is the dll used in the main thread? This is a must for a UI. Is the dll used synchronous or asynchronously?
    How is bigdog implemented? This will have influence on how you build your UI.[/quote]
    yes my dll uses the main thread.

    ps. i'm not really used to program gui's so sry when some things are not clearly explained.

    br



  • Usually a Qt-based GUI application will create a QApplication object and call QApplication::exec().

    This will run the the "Even Loop" and do all the event processing.

    Normally you do this in the main() function of your application and not in some DLL though.

    But I think as long as the "main" application doesn't run an event loop yet, you can create your own in the DLL.

    However I think this will only work properly, if the "main" application calls your DLL function from its main thread...



  • thx
    i'll give it a try!



  • [quote author="MuldeR" date="1335282076"]...
    But I think as long as the "main" application doesn't run an event loop yet, you can create your own in the DLL.
    However I think this will only work properly, if the "main" application calls your DLL function from its main thread...[/quote]

    But this will block the main function of the app. QApplication::exec blocks till the event loop should be stoppped, which means, the last UIs are closed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.