Embed a project into another.



  • Hi. I have a main and a secondary qt project.
    The secondary project has a form created from main.cpp.
    Is there a way for embed the form of the second peoject into the main project?


  • Moderators

    Yes. Just include the header and add it to your QLayout in main. You can also use qmake subdirs template.



  • I'm not sure to have understood correctly. I have copied the sources of the secondary project in the folder of the main project.
    Can you explain step by step the right way to embed in a standard main qt project a secondary standard qt project?


  • Moderators

    There is no standard way, as such. Depends on what you want to achieve and how you want to achieve it.

    If what you want is to use a widget created in project A inside project B, then you need to add it to project B (add files to .pro, include headers in source code), instantiate the widget and add it to layout.

    If you want to have 2 projects grouped together (for example, a library and dependent application), you can use qmake subdirs template and specify path to subdirs in main .pro file.


Log in to reply
 

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