<p>I'm about to start on a large Qt application, which is made up of smaller components (groups of classes that work together). For example, there might be a dialog that is used in the project, but should be developed on its own before being integrated into the project. Instead of working on it in another folder somewhere and then copying it into the main project folder, can I create a sub-folder which is dedicated to that dialog, and then somehow incorporate it into the main project?</p>

[{'answer_id': 61423, 'author': 'kokos', 'author_id': 1065, 'author_profile': 'https://Stackoverflow.com/users/1065', 'pm_score': 0, 'selected': False, 'text': "<p>For Qt on Windows you can create DLLs for every subproject you want. No problem with using them from the main project (exe) after that. You'll have to take care of dependencies but it's not very difficult.</p>\n"}, {'answer_id': 61427, 'author': 'Nick', 'author_id': 4949, 'author_profile': 'https://Stackoverflow.com/users/4949', 'pm_score': 1, 'selected': False, 'text': '<p>Yes, you can edit your main project (.pro) file to include your sub project\'s project file.</p>\n\n<p><a href="http://doc.qt.io/qt-4.8/qmake-project-files.html" rel="nofollow noreferrer">See here</a></p>\n'}, {'answer_id': 62009, 'author': 'Jérôme', 'author_id': 2796, 'author_profile': 'https://Stackoverflow.com/users/2796', 'pm_score': 6, 'selected': True, 'text': '<p>Here is what I would do. Let\'s say I want the following folder hierarchy :</p>\n\n<pre><code>/MyWholeApp\n</code></pre>\n\n<p>will contain the files for the whole application.</p>\n\n<pre><code>/MyWholeApp/DummyDlg/\n</code></pre>\n\n<p>will contain the files for the standalone dialogbox which will be eventually part of the whole application.</p>\n\n<p>I would develop the standalone dialog box and the related classes. I would create a Qt-project file which is going to be included. It will contain only the forms and files which will eventually be part of the whole application.</p>\n\n<p>File DummyDlg.pri, in /MyWholeApp/DummyDlg/ :</p>\n\n<pre><code># Input\nFORMS += dummydlg.ui\nHEADERS += dummydlg.h\nSOURCES += dummydlg.cpp\n</code></pre>\n\n<p>The above example is very simple. You could add other classes if needed.</p>\n\n<p>To develop the standalone dialog box, I would then create a Qt project file dedicated to this dialog :</p>\n\n<p>File DummyDlg.pro, in /MyWholeApp/DummyDlg/ :</p>\n\n<pre><code>TEMPLATE = app\nDEPENDPATH += .\nINCLUDEPATH += .\n\ninclude(DummyDlg.pri)\n\n# Input\nSOURCES += main.cpp\n</code></pre>\n\n<p>As you can see, this PRO file is including the PRI file created above, and is adding an additional file (main.cpp) which will contain the basic code for running the dialog box as a standalone :</p>\n\n<pre><code>#include &lt;QApplication&gt;\n#include "dummydlg.h"\n\nint main(int argc, char* argv[])\n{\n    QApplication MyApp(argc, argv);\n\n    DummyDlg MyDlg;\n    MyDlg.show();\n    return MyApp.exec();\n}\n</code></pre>\n\n<p>Then, to include this dialog box to the whole application you need to create a Qt-Project file :</p>\n\n<p>file WholeApp.pro, in /MyWholeApp/ :</p>\n\n<pre><code>TEMPLATE = app\nDEPENDPATH += . DummyDlg\nINCLUDEPATH += . DummyDlg\n\ninclude(DummyDlg/DummyDlg.pri)\n\n# Input\nFORMS += OtherDlg.ui\nHEADERS += OtherDlg.h\nSOURCES += OtherDlg.cpp WholeApp.cpp\n</code></pre>\n\n<p>Of course, the Qt-Project file above is very simplistic, but shows how I included the stand-alone dialog box.</p>\n'}]
['https://Stackoverflow.com/questions/61405', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1585/']