User Tools

Site Tools


qt:project_structure

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
qt:project_structure [2010/12/08 19:38] – [Resources] mithatqt:project_structure [2011/04/01 11:01] – [Source files] mithat
Line 1: Line 1:
 ====== Project structure ====== ====== Project structure ======
  
-There are two views we can take toward how Qt projects are structured: the file view and the workflow view. Depending on how your brain works and/or the issue you are trying to understand, one of these will work better than the other. In all probability, both will be useful at some point.+There are two views you can take toward how Qt projects are structured: the file view and the workflow view. Depending on how your brain works and/or the issue you are trying to understand, one of these will work better than the other. In all probability, both will be useful at some point.
  
 ===== The file view ===== ===== The file view =====
-A Qt project is a collection of project description files, source code files, resource files, and binary output files. These are discussed below.+A Qt project is a collection of project description files, source code files, resource files, and binary output files. Some of these files must be explicitly generated using a text editor or similar tool, others are automatically generated by the build process.((The explicit/automatic dichotomy holds true whether you are using an IDE or a simple command line based environment. However, an IDE will typically manage the explicit generation of may of the files for you (e.g., *.pro files).))
  
 ==== Project description files ==== ==== Project description files ====
-    * **''[[pro files|{directory-name}.pro]]''** +=== Explicitly generated === 
-      * The Qt project description file.+    * **''{directory-name}.pro''** 
 +      * The [[qt:pro_files|Qt project description file]].
       * Created by running <code bash>qmake -project</code>       * Created by running <code bash>qmake -project</code>
       * May require hand editing (e.g. to add/remove source files, specify whether debug and/or release build should be available, etc.).       * May require hand editing (e.g. to add/remove source files, specify whether debug and/or release build should be available, etc.).
Line 17: Line 18:
  
 ==== Source files ==== ==== Source files ====
 +=== Explicitly generated ===
   * **''main.cpp''**   * **''main.cpp''**
-    * The project's main C++ file containing the main function.+    * The project's main C++ file containing the ''main'' function.
     * The name of this file is a convention, not a requirement.     * The name of this file is a convention, not a requirement.
   * **''{yourclass}.h''** and **''{yourclass}.cpp''**   * **''{yourclass}.h''** and **''{yourclass}.cpp''**
     * C++ class header and implementation files for a class that you derived from QObject (if needed).     * C++ class header and implementation files for a class that you derived from QObject (if needed).
-    * May contain ''Q_OBJECT'', a Qt macro used to implement signals and slots.+    * Probably containd ''Q_OBJECT'', a Qt macro used to implement signals and slots.
     * There may be more than one of these.     * There may be more than one of these.
   * **''{yourdialog}.ui''**   * **''{yourdialog}.ui''**
Line 37: Line 39:
  
 ==== Resources ==== ==== Resources ====
 +=== Explicitly generated ===
   * **''{resources}.qrc''**   * **''{resources}.qrc''**
-    * A Qt [[http://doc.qt.nokia.com/stable/resources.html|resources file]]+    * A Qt [[http://doc.qt.nokia.com/stable/resources.html|resource collection file]] specifying the location of icons and other resources for your project.
-      * An XML file that specifies the location of icons and other resources for your project.+
     * You can have more than one of these.     * You can have more than one of these.
-    * Automatically processed by ''[[rcc]] (the Qt resources compiler)''+    * Automatically processed by ''[[rcc]]'' (the Qt resources compiler) if mentioned in [[pro files|{directory-name}.pro]]. 
 +=== Automatically generated === 
 +  * **''qrc_{resources}.cpp''** 
 +    * cpp file that contains data for the resources mentioned in ''{resources}.qrc'' as static C++ arrays of compressed binary data. 
 +    * Automatically generated and linked to the project when [[qmake]] is run (assuming it's mentioned in the *.pro file).
  
 ==== Binary output ==== ==== Binary output ====
Line 48: Line 54:
  
 ===== The workflow view ===== ===== The workflow view =====
-The typical Qt project workflow consists of the following major phases: creating a project, adding files to a project, building and testing a project. These are discussed below.+The typical Qt project workflow consists of the following major phases: creating a project, adding files to a project, building and testing a project. These are discussed below.((These phases hold true whether you are using a IDE or a simple command line based environment. However, an IDE will typically manage many of these tasks for you.))
  
 ==== Creating a project ==== ==== Creating a project ====
Line 60: Line 66:
  
 ==== Adding files ==== ==== Adding files ====
-  - Create the desired *.h, *.cpp, and *.ui source files in the project directory and edit to your heart's content.+  - Create the desired *.h, *.cpp, *.ui, and *.qrc source files in the project directory and edit to your heart's content.
   - Edit ''[[pro files|{directory-name}.pro]]'' to reflect the added files.   - Edit ''[[pro files|{directory-name}.pro]]'' to reflect the added files.
-  - Run  <code bash>qmake</code> to generate a new Makefile and ''debug'' and ''release'' sub-directories (if needed).+  - Run  <code bash>qmake</code> to generate a new Makefile''debug'' and ''release'' sub-directories (if needed), and and other support files.
  
 Notes: Notes:
-  * Repeat the above as needed. Whenever you add new files, be sure to reflect those changes into the *.pro file and regenerate the Makefile before building.+  * Repeat the above as needed. 
 +  * Whenever you add new files, be sure to reflect those changes into the *.pro file and rerun ''qmake'' before running building and testing.
   * Assuming {directory-name}.pro is correctly configured, the Makefile generated by ''[[qmake]]'' will automagically be configured to call [[moc]] and [[uic]] as needed.    * Assuming {directory-name}.pro is correctly configured, the Makefile generated by ''[[qmake]]'' will automagically be configured to call [[moc]] and [[uic]] as needed. 
  
qt/project_structure.txt · Last modified: 2011/04/01 11:01 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki