<p>We'll start with a general description of how to subclass a form and follow with a short example. Note that subclassing has some disadvantages compared with putting your code into a form directly; see <ahref="designer-manual-5.html#3">Extending the functionality of a form</a> in <ahref="designer-manual-5.html#the-designer-approach">The Designer Approach</a> chapter for details.</p>
<p>We'll start with a general description of how to subclass a form and follow with a short example. Note that subclassing has some disadvantages compared with putting your code into a form directly; see <ahref="designer-manual-5.html#3">Extending the functionality of a form</a> in <ahref="designer-manual-5.html#the-designer-approach">The Designer Approach</a> chapter for details.</p>
<h4><aname="1-1"></a>Generating Source Code from <em>TQt Designer</em> .ui Files</h4>
<h4><aname="1-1"></a>Generating Source Code from <em>TQt Designer</em> .ui Files</h4>
<p><em>TQt Designer</em> reads and writes <tt>qmake</tt><!-- index .pro --><tt>.pro</tt> (project) files which are used to record the files used to build the application and from which Makefiles are generated. <em>TQt Designer</em> also reads and writes<!-- index .ui --><tt>.ui</tt> (user interface) files. These are XML files that record the widgets, layouts, source code and settings you've used for a form. Every<!-- index .ui --><tt>.ui</tt> file is converted by the <tt>uic</tt> (user interface compiler) into a C++<!-- index .h --><tt>.h</tt> file and a C++<!-- index .cpp --><tt>.cpp</tt> file. These C++ files are then read by <tt>moc</tt> (meta object compiler), and finally compiled by your compiler into a working application.</p>
<p><em>TQt Designer</em> reads and writes <tt>qmake</tt><!-- index .pro --><tt>.pro</tt> (project) files which are used to record the files used to build the application and from which Makefiles are generated. <em>TQt Designer</em> also reads and writes<!-- index .ui --><tt>.ui</tt> (user interface) files. These are XML files that record the widgets, layouts, source code and settings you've used for a form. Every<!-- index .ui --><tt>.ui</tt> file is converted by the <tt>uic</tt> (user interface compiler) into a C++<!-- index .h --><tt>.h</tt> file and a C++<!-- index .cpp --><tt>.cpp</tt> file. These C++ files are then read by <tt>tqmoc</tt> (meta object compiler), and finally compiled by your compiler into a working application.</p>
<!-- index Makefiles --><!-- index Projects!Adding Files --><!-- index Adding!Files to Projects --><p>If you create applications wholly within <em>TQt Designer</em> you only need to create a<!-- index main.cpp --><tt>main.cpp</tt>.</p>
<!-- index Makefiles --><!-- index Projects!Adding Files --><!-- index Adding!Files to Projects --><p>If you create applications wholly within <em>TQt Designer</em> you only need to create a<!-- index main.cpp --><tt>main.cpp</tt>.</p>
<p>If you create the <tt>main.cpp</tt> file within <em>TQt Designer</em>, it will automatically be added to your project file by <em>TQt Designer</em>. If you create the <tt>main.cpp</tt> file outside of <em>TQt Designer</em> you must add it to the project file manually by adding the following line at the end of your project's<!-- index .pro --><tt>.pro</tt> file:</p>
<p>If you create the <tt>main.cpp</tt> file within <em>TQt Designer</em>, it will automatically be added to your project file by <em>TQt Designer</em>. If you create the <tt>main.cpp</tt> file outside of <em>TQt Designer</em> you must add it to the project file manually by adding the following line at the end of your project's<!-- index .pro --><tt>.pro</tt> file:</p>
<pre>
<pre>
SOURCES += main.cpp
SOURCES += main.cpp
</pre>
</pre>
<p>You can then use <tt>qmake</tt> to generate the Makefile. (For example <tt>qmake -o Makefile myproject.pro</tt>.) Running <tt>make</tt> (Linux, Unix or Borland compilers), or <tt>nmake</tt> (Visual C++), will then call <tt>uic</tt>, <tt>moc</tt> and your compiler as necessary to build your application.</p>
<p>You can then use <tt>qmake</tt> to generate the Makefile. (For example <tt>qmake -o Makefile myproject.pro</tt>.) Running <tt>make</tt> (Linux, Unix or Borland compilers), or <tt>nmake</tt> (Visual C++), will then call <tt>tquic</tt>, <tt>tqmoc</tt> and your compiler as necessary to build your application.</p>
<!-- index Errors!Undefined reference --><!-- index Undefined references, Error --><!-- index qmake!HEADERS --><!-- index qmake!SOURCES --><p>If you use <em>TQt Designer</em> to create your main window and dialogs, but also add other C++ files, or if you subclass any of your forms you will need to add these files to the<!-- index .pro --><tt>.pro</tt> file so that they are compiled with the rest of your application's source files. Each<!-- index .h --><tt>.h</tt> file that you create separately from <em>TQt Designer</em> should be added to the <tt>HEADERS</tt> line, and each<!-- index .cpp --><tt>.cpp</tt> file should be added to the <tt>SOURCES</tt> line, just as we've done for<!-- index main.cpp --><tt>main.cpp</tt>. If you get undefined reference errors it is worth checking that you've added the names of all your header and implementation files to the<!-- index .pro --><tt>.pro</tt> file.</p>
<!-- index Errors!Undefined reference --><!-- index Undefined references, Error --><!-- index qmake!HEADERS --><!-- index qmake!SOURCES --><p>If you use <em>TQt Designer</em> to create your main window and dialogs, but also add other C++ files, or if you subclass any of your forms you will need to add these files to the<!-- index .pro --><tt>.pro</tt> file so that they are compiled with the rest of your application's source files. Each<!-- index .h --><tt>.h</tt> file that you create separately from <em>TQt Designer</em> should be added to the <tt>HEADERS</tt> line, and each<!-- index .cpp --><tt>.cpp</tt> file should be added to the <tt>SOURCES</tt> line, just as we've done for<!-- index main.cpp --><tt>main.cpp</tt>. If you get undefined reference errors it is worth checking that you've added the names of all your header and implementation files to the<!-- index .pro --><tt>.pro</tt> file.</p>
<h4><aname="1-2"></a>Subclassing a Form</h4>
<h4><aname="1-2"></a>Subclassing a Form</h4>
<!-- index Subclassing --><p>When subclassing a form it is helpful to use a naming convention to help us identify which files are generated from <em>TQt Designer</em>'s<!-- index .ui --><tt>.ui</tt> files and which are hand coded.</p>
<!-- index Subclassing --><p>When subclassing a form it is helpful to use a naming convention to help us identify which files are generated from <em>TQt Designer</em>'s<!-- index .ui --><tt>.ui</tt> files and which are hand coded.</p>
<li><p>Open TQt Project -- Runs <tt>qmake</tt> with a<!-- index .pro --><tt>.pro</tt> file</p>
<li><p>Open TQt Project -- Runs <tt>qmake</tt> with a<!-- index .pro --><tt>.pro</tt> file</p>
<li><p>Write TQt Project -- Saves the current VS project as a<!-- index .pro --><tt>.pro</tt> file</p>
<li><p>Write TQt Project -- Saves the current VS project as a<!-- index .pro --><tt>.pro</tt> file</p>
<li><p>Use TQt -- Add the TQt libraries to the active project</p>
<li><p>Use TQt -- Add the TQt libraries to the active project</p>
<li><p>Add MOC -- Add the <tt>moc</tt> precompiler to the active file</p>
<li><p>Add TQMoc -- Add <tt>tqmoc</tt> precompiler to the active file</p>
</ul><p>Double clicking a<!-- index .ui --><tt>.ui</tt> file in the workspace overview will now launch <em>TQt Designer</em>.</p>
</ul><p>Double clicking a<!-- index .ui --><tt>.ui</tt> file in the workspace overview will now launch <em>TQt Designer</em>.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT --><p>If you create a<!-- index .cpp --><tt>.cpp</tt> file which contains the <tt>TQ_OBJECT</tt> macro you will need an additional file which is generated by the <tt>moc</tt> to be included in your project. For example, if you have 'file.cpp', then the last line would be <tt>#include "file.moc"</tt> and the additional file would be called 'file.moc'. To ensure that Visual Studio executes the <tt>moc</tt> and generates this file you must create a custom dependency. Double click the<!-- index .cpp --><tt>.cpp</tt> file (in your project workspace) that contains the <tt>TQ_OBJECT</tt> macro. Click the <b>Add MOC</b> toolbar button; this will create an empty<!-- index .moc --><tt>.moc</tt> file in your project workspace. Right click the newly created<!-- index .moc --><tt>.moc</tt> file, then click <b>Settings</b> from the pop-up menu to invoke the Project Settings dialog. Click the Custom Build tab. Click the <b>Dependencies</b> button to pop up the User Defined Dependencies dialog. Type in <tt>$(InputDir)\$(InputPath)</tt>, then press <b>Return</b>. Click <b>OK</b> to leave the Dependencies dialog, then click <b>OK</b> to leave the Project Settings dialog.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT --><p>If you create a<!-- index .cpp --><tt>.cpp</tt> file which contains the <tt>TQ_OBJECT</tt> macro you will need an additional file which is generated by <tt>tqmoc</tt> to be included in your project. For example, if you have 'file.cpp', then the last line would be <tt>#include "file.moc"</tt> and the additional file would be called 'file.moc'. To ensure that Visual Studio executes the <tt>tqmoc</tt> and generates this file you must create a custom dependency. Double click the<!-- index .cpp --><tt>.cpp</tt> file (in your project workspace) that contains the <tt>TQ_OBJECT</tt> macro. Click the <b>Add TQMoc</b> toolbar button; this will create an empty<!-- index .moc --><tt>.moc</tt> file in your project workspace. Right click the newly created<!-- index .moc --><tt>.moc</tt> file, then click <b>Settings</b> from the pop-up menu to invoke the Project Settings dialog. Click the Custom Build tab. Click the <b>Dependencies</b> button to pop up the User Defined Dependencies dialog. Type in <tt>$(InputDir)\$(InputPath)</tt>, then press <b>Return</b>. Click <b>OK</b> to leave the Dependencies dialog, then click <b>OK</b> to leave the Project Settings dialog.</p>
<p>If you wish to delete the add-in remove it from the toolbar then delete the<!-- index qmsdev.dll --><tt>qmsdev.dll</tt> file from the add-ins directory.</p>
<p>If you wish to delete the add-in remove it from the toolbar then delete the<!-- index qmsdev.dll --><tt>qmsdev.dll</tt> file from the add-ins directory.</p>
<h4><aname="3-1"></a>Creating Makefiles without qmake</h4>
<h4><aname="3-1"></a>Creating Makefiles without qmake</h4>
<!-- index Makefiles --><p>The <tt>qmake</tt> tool provided with TQt can create Makefiles appropriate to your platform based on<!-- index .pro --><tt>.pro</tt> project files. This section describes the dependencies involved in building a TQt application and gives a couple of simple example Makefiles. This section assumes that you have a good understanding of Makefiles.</p>
<!-- index Makefiles --><p>The <tt>qmake</tt> tool provided with TQt can create Makefiles appropriate to your platform based on<!-- index .pro --><tt>.pro</tt> project files. This section describes the dependencies involved in building a TQt application and gives a couple of simple example Makefiles. This section assumes that you have a good understanding of Makefiles.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT --><p><em>TQt Designer</em> produces<!-- index .ui --><tt>.ui</tt> files which are used to generate<!-- index .h --><tt>.h</tt> and<!-- index .cpp --><tt>.cpp</tt> files for the compiler to compile. The<!-- index .ui --><tt>.ui</tt> files are processed by <tt>uic</tt>. Classes which inherit from <ahref="tqobject.html">TQObject</a>, e.g. those which use slots and signals, require an additional<!-- index .cpp --><tt>.cpp</tt> file to be generated. These files are generated by the <tt>moc</tt> and are named '<em>moc_</em>file.cpp' where the original<!-- index .cpp --><tt>.cpp</tt> file is called 'file.cpp'. If your<!-- index .cpp --><tt>.cpp</tt> file contains the <tt>TQ_OBJECT</tt> macro an additional file 'file.moc' should be generated which must be <tt>#include</tt>d in the<!-- index .cpp --><tt>.cpp</tt>, normally at the end. This requires an extra dependency being created.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT --><p><em>TQt Designer</em> produces<!-- index .ui --><tt>.ui</tt> files which are used to generate<!-- index .h --><tt>.h</tt> and<!-- index .cpp --><tt>.cpp</tt> files for the compiler to compile. The<!-- index .ui --><tt>.ui</tt> files are processed by <tt>uic</tt>. Classes which inherit from <ahref="tqobject.html">TQObject</a>, e.g. those which use slots and signals, require an additional<!-- index .cpp --><tt>.cpp</tt> file to be generated. These files are generated by <tt>tqmoc</tt> and are named '<em>tqmoc_</em>file.cpp' where the original<!-- index .cpp --><tt>.cpp</tt> file is called 'file.cpp'. If your<!-- index .cpp --><tt>.cpp</tt> file contains the <tt>TQ_OBJECT</tt> macro an additional file 'file.moc' should be generated which must be <tt>#include</tt>d in the<!-- index .cpp --><tt>.cpp</tt>, normally at the end. This requires an extra dependency being created.</p>
<p>Processing<!-- index .ui --><tt>.ui</tt> files with <tt>uic</tt> is done <em>twice</em>:</p>
<p>Processing<!-- index .ui --><tt>.ui</tt> files with <tt>uic</tt> is done <em>twice</em>:</p>
<p>First we generate the header and implementation file for our base class. Then we generate the header and implementation skeletons for our subclass. Note that the use of <tt>uic</tt> to generate skeletons is not something that would be done in a Makefile, we mention it here because it can be useful for command line users. Note also that the command line for <tt>-subdecl</tt> and for <tt>-subimpl</tt> are subtly different.</p>
<p>First we generate the header and implementation file for our base class. Then we generate the header and implementation skeletons for our subclass. Note that the use of <tt>uic</tt> to generate skeletons is not something that would be done in a Makefile, we mention it here because it can be useful for command line users. Note also that the command line for <tt>-subdecl</tt> and for <tt>-subimpl</tt> are subtly different.</p>
<p>For implementation files that contain classes which inherit from <ahref="tqobject.html">TQObject</a> we must create moc files:</p>
<p>For implementation files that contain classes which inherit from <ahref="tqobject.html">TQObject</a> we must create tqmoc files:</p>
<pre>
<pre>
moc myform.h -o moc_myform.cpp
tqmoc myform.h -o tqmoc_myform.cpp
</pre>
</pre>
<p>We'll look at a simple Makefile to see the dependencies in practice.</p>
<p>We'll look at a simple Makefile to see the dependencies in practice.</p>
<p>Note that you may need to include the full path to the commands in your Makefile, and under Windows the filenames are<!-- index moc.exe --><tt>moc.exe</tt> and<!-- index uic.exe --><tt>uic.exe</tt>.</p>
<p>Note that you may need to include the full path to the commands in your Makefile, and under Windows the filenames are<!-- index tqmoc.exe --><tt>tqmoc.exe</tt> and<!-- index uic.exe --><tt>uic.exe</tt>.</p>
<p>In Unix/Linux environments the <tt>make</tt> command may be able to do more for us, so we should be able to use a simpler Makefile like this:</p>
<p>In Unix/Linux environments the <tt>make</tt> command may be able to do more for us, so we should be able to use a simpler Makefile like this:</p>
<li><ahref="#3-6"> Using the 'Use TQt In Current Project' button
<li><ahref="#3-6"> Using the 'Use TQt In Current Project' button
</a>
</a>
<li><ahref="#3-7"> Using the 'Add MOC' button
<li><ahref="#3-7"> Using the 'Add TQMoc' button
</a>
</a>
</ul>
</ul>
</ul>
</ul>
@ -96,7 +96,7 @@ following steps.
<li> Open TQt Project
<li> Open TQt Project
<li> Write TQt Project
<li> Write TQt Project
<li> Use TQt In Current Project
<li> Use TQt In Current Project
<li> Add MOC
<li> Add TQMoc
</ul>
</ul>
<p><h3> Using the 'New TQt Project' button
<p><h3> Using the 'New TQt Project' button
</h3>
</h3>
@ -148,10 +148,10 @@ name your <tt>qmake</tt> project file and click Save.
<aname="3-6"></a><p> The 'Use TQt In Current Project' button simply adds in the necessary
<aname="3-6"></a><p> The 'Use TQt In Current Project' button simply adds in the necessary
information for the current project so that it links against TQt and
information for the current project so that it links against TQt and
sets any other settings needed to use TQt in that project.
sets any other settings needed to use TQt in that project.
<p><h3> Using the 'Add MOC' button
<p><h3> Using the 'Add TQMoc' button
</h3>
</h3>
<aname="3-7"></a><p> The 'Add MOC' button will add in the custom build step for the selected file
<aname="3-7"></a><p> The 'Add TQMoc' button will add in the custom build step for the selected file
so that it creates any needed MOC files and it will add these generated
so that it creates any needed moc files and it will add these generated
files to the project. All you need to do to use it is click on a file that
files to the project. All you need to do to use it is click on a file that
has <ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> and click the button.
has <ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> and click the button.
<p> You only need to use this button if you added a file that has <ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> in it by hand, you don't need to use this if you used any
<p> You only need to use this button if you added a file that has <ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> in it by hand, you don't need to use this if you used any
<p><em>qmake</em> is a tool created by Trolltech to write makefiles for different compilers and platforms.</p>
<p><em>qmake</em> is a tool created by Trolltech to write makefiles for different compilers and platforms.</p>
<p>Writing makefiles by hand can be difficult and error prone, especially if several makefiles are required for different compiler and platform combinations. With <em>qmake</em>, developers create a simple single 'project' file and run <em>qmake</em> to generate the appropriate makefiles. <em>qmake</em> takes care of all the compiler and platform dependencies, freeing developers to focus on their code. Trolltech uses <em>qmake</em> as the primary build tool for the TQt library, and for the tools supplied with TQt.</p>
<p>Writing makefiles by hand can be difficult and error prone, especially if several makefiles are required for different compiler and platform combinations. With <em>qmake</em>, developers create a simple single 'project' file and run <em>qmake</em> to generate the appropriate makefiles. <em>qmake</em> takes care of all the compiler and platform dependencies, freeing developers to focus on their code. Trolltech uses <em>qmake</em> as the primary build tool for the TQt library, and for the tools supplied with TQt.</p>
<p><em>qmake</em> also takes care of TQt's special requirements, automatically including build rules for <ahref="moc.html">moc</a> and <em>uic</em>.</p>
<p><em>qmake</em> also takes care of TQt's special requirements, automatically including build rules for <ahref="tqmoc.html">tqmoc</a> and <em>tquic</em>.</p>
<p>The final step is to set the <em>CONFIG</em> variable. Since this is a TQt application, we need to put 'qt' on the CONFIG line so that <em>qmake</em> will add the relevant libraries to be linked against and ensure that build lines for <em>moc</em> and <em>uic</em> are included in the makefile.</p>
<p>The final step is to set the <em>CONFIG</em> variable. Since this is a TQt application, we need to put 'qt' on the CONFIG line so that <em>qmake</em> will add the relevant libraries to be linked against and ensure that build lines for <em>tqmoc</em> and <em>tquic</em> are included in the makefile.</p>
<p>The finished project file should look like this:</p>
<p>The finished project file should look like this:</p>
<p><em>qmake</em> will generate dependency information (unless -nodepend is specified on the <ahref="qmake-manual-8.html#Commands">command line</a>) for the specified headers. <em>qmake</em> will also automatically detect if <em>moc</em> is required by the classes in these headers, and add the appropriate dependencies and files to the project for generating and linking the moc files.</p>
<p><em>qmake</em> will generate dependency information (unless -nodepend is specified on the <ahref="qmake-manual-8.html#Commands">command line</a>) for the specified headers. <em>qmake</em> will also automatically detect if <em>tqmoc</em> is required by the classes in these headers, and add the appropriate dependencies and files to the project for generating and linking the tqmoc files.</p>
<p>This variable specifies the directory where all intermediate moc files should be placed.</p>
<p>This variable specifies the directory where all intermediate tqmoc files should be placed.</p>
<p>For example:</p>
<p>For example:</p>
<pre>
<pre>
unix:MOC_DIR = ../myproject/tmp
unix:MOC_DIR = ../myproject/tmp
@ -271,7 +271,7 @@ DISTFILES += ../program.txt
<p>This variable contains a list of yacc source files to be included in the project. All dependencies, headers and source files will automatically be included in the project.</p>
<p>This variable contains a list of yacc source files to be included in the project. All dependencies, headers and source files will automatically be included in the project.</p>
<p>For example:</p>
<p>For example:</p>
<pre>
<pre>
YACCSOURCES = moc.y
YACCSOURCES = tqmoc.y
</pre>
</pre>
<aname="RarelyUsedSystemVariables"></a><h4><aname="4-2"></a>Rarely Used System Variables</h4>
<aname="RarelyUsedSystemVariables"></a><h4><aname="4-2"></a>Rarely Used System Variables</h4>
<p>The following variables are also recognized by <em>qmake</em> but are either internal or very rarely used.</p>
<p>The following variables are also recognized by <em>qmake</em> but are either internal or very rarely used.</p>
<p>This variable is generated from the <ahref="qmake-manual-8.html#SOURCES">SOURCES</a> variable. The extension of each source file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable is generated from the <ahref="qmake-manual-8.html#SOURCES">SOURCES</a> variable. The extension of each source file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable is set by <em>qmake</em> if files can be found that contain the TQ_OBJECT macro. <tt>OBJMOC</tt> contains the name of all intermediate moc object files. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable is set by <em>qmake</em> if files can be found that contain the TQ_OBJECT macro. <tt>OBJMOC</tt> contains the name of all intermediate tqmoc object files. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable indicates the header file for creating a precompiled header file, to increase the compilation speed of a project. Precompiled headers are currently only supported on some platforms (Windows - all MSVC project types, Mac OS X - Xcode, Makefile, UNIX - gcc 3.3 and up).</p>
<p>This variable indicates the header file for creating a precompiled header file, to increase the compilation speed of a project. Precompiled headers are currently only supported on some platforms (Windows - all MSVC project types, Mac OS X - Xcode, Makefile, UNIX - gcc 3.3 and up).</p>
<p>On other platforms, this variable has different meaning, as noted below.</p>
<p>On other platforms, this variable has different meaning, as noted below.</p>
<p>This variable contains a list of header files that require some sort of pre-compilation step (such as with moc). The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains a list of header files that require some sort of pre-compilation step (such as with tqmoc). The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the name of the <em>qmake</em> program itself and is placed in generated makefiles. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the name of the <em>qmake</em> program itself and is placed in generated makefiles. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable is not empty if the warn_on <ahref="qmake-manual-8.html#TEMPLATE">TEMPLATE</a> option is specified. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable is not empty if the warn_on <ahref="qmake-manual-8.html#TEMPLATE">TEMPLATE</a> option is specified. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains any files which are not generated files (such as moc and uic generated files) and object files that should be removed when using "make clean".</p>
<p>This variable contains any files which are not generated files (such as tqmoc and tquic generated files) and object files that should be removed when using "make clean".</p>
<p>This variable contains the C++ compiler flags for creating a debuggable application. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the C++ compiler flags for creating a debuggable application. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the name of the makefile to create. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the name of the makefile to create. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<h5><aname="4-2-86"></a>QMAKE_MOC_SRC</h5>
<h5><aname="4-2-86"></a>QMAKE_MOC_SRC</h5>
<p>This variable contains the names of all moc source files to generate and include in the project. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the names of all tqmoc source files to generate and include in the project. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<h5><aname="4-2-87"></a>QMAKE_QMAKE</h5>
<h5><aname="4-2-87"></a>QMAKE_QMAKE</h5>
<p>This variable contains the location of qmake if it is not in the path. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the location of qmake if it is not in the path. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<h5><aname="4-2-88"></a>QMAKE_QT_DLL</h5>
<h5><aname="4-2-88"></a>QMAKE_QT_DLL</h5>
@ -510,7 +510,7 @@ app {
<h5><aname="4-2-96"></a>RES_FILE</h5>
<h5><aname="4-2-96"></a>RES_FILE</h5>
<p>This variable contains the name of the resource file for the application. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable contains the name of the resource file for the application. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<h5><aname="4-2-97"></a>SRCMOC</h5>
<h5><aname="4-2-97"></a>SRCMOC</h5>
<p>This variable is set by <em>qmake</em> if files can be found that contain the TQ_OBJECT macro. <tt>SRCMOC</tt> contains the name of all the generated moc files. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable is set by <em>qmake</em> if files can be found that contain the TQ_OBJECT macro. <tt>SRCMOC</tt> contains the name of all the generated tqmoc files. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<h5><aname="4-2-98"></a>TARGET_EXT</h5>
<h5><aname="4-2-98"></a>TARGET_EXT</h5>
<p>This variable specifies the target's extension. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<p>This variable specifies the target's extension. The value of this variable is typically handled by <em>qmake</em> or <ahref="qmake-manual-8.html#QMAKESPEC">qmake.conf</a> and rarely needs to be modified.</p>
<h5><aname="4-2-99"></a>TARGET_x</h5>
<h5><aname="4-2-99"></a>TARGET_x</h5>
@ -528,7 +528,7 @@ app {
<h5><aname="4-2-105"></a>VER_PAT</h5>
<h5><aname="4-2-105"></a>VER_PAT</h5>
<p>This variable contains the patch version number of the library, if the 'lib' <ahref="qmake-manual-8.html#TEMPLATE">template</a> is specified.</p>
<p>This variable contains the patch version number of the library, if the 'lib' <ahref="qmake-manual-8.html#TEMPLATE">template</a> is specified.</p>
<h5><aname="4-2-106"></a>QMAKE_EXT_MOC</h5>
<h5><aname="4-2-106"></a>QMAKE_EXT_MOC</h5>
<p>This variable changes the extention used on included moc files.</p>
<p>This variable changes the extention used on included tqmoc files.</p>
<p>See also <ahref="qmake-manual-8.html#Extensions">File Extensions</a>.</p>
<p>See also <ahref="qmake-manual-8.html#Extensions">File Extensions</a>.</p>
<h5><aname="4-2-107"></a>QMAKE_EXT_UI</h5>
<h5><aname="4-2-107"></a>QMAKE_EXT_UI</h5>
<p>This variable changes the extention used on /e Designer UI files.</p>
<p>This variable changes the extention used on /e Designer UI files.</p>
<p>This is all you need to do to actually build custom targets in qmake, of course you may want to tie one of these targets to actually building the <ahref="qmake-manual-8.html#TARGET">qmake build target</a>. To do this, you simply need to include your Makefile target in the list of <ahref="qmake-manual-8.html#PRE_TARGETDEPS">PRE_TARGETDEPS</a>.</p>
<p>This is all you need to do to actually build custom targets in qmake, of course you may want to tie one of these targets to actually building the <ahref="qmake-manual-8.html#TARGET">qmake build target</a>. To do this, you simply need to include your Makefile target in the list of <ahref="qmake-manual-8.html#PRE_TARGETDEPS">PRE_TARGETDEPS</a>.</p>
<p>For convenience there is also a method of customizing (UNIX) projects for generic new compilers (or even preprocessors).</p>
<p>For convenience there is also a method of customizing (UNIX) projects for generic new compilers (or even preprocessors).</p>
<pre>
<pre>
new_moc.output = moc_${QMAKE_FILE_BASE}.cpp
new_moc.output = tqmoc_${QMAKE_FILE_BASE}.cpp
new_moc.commands = moc ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}
@ -171,11 +171,11 @@ about each other, as long as there is someone around to set up a
connection between them initially.
connection between them initially.
<p> The preprocessor changes or removes the <tt>signals</tt>, <tt>slots</tt> and
<p> The preprocessor changes or removes the <tt>signals</tt>, <tt>slots</tt> and
<tt>emit</tt> keywords so that the compiler is presented with standard C++.
<tt>emit</tt> keywords so that the compiler is presented with standard C++.
<p> Run the <ahref="moc.html">moc</a> on class definitions that contain
<p> Run the <ahref="tqmoc.html">tqmoc</a> on class definitions that contain
signals or slots. This produces a C++ source file which should be compiled
signals or slots. This produces a C++ source file which should be compiled
and linked with the other object files for the application. If you use
and linked with the other object files for the application. If you use
<ahref="qmake-manual.html">qmake</a>, the makefile rules to
<ahref="qmake-manual.html">qmake</a>, the makefile rules to
automatically invoke the <ahref="moc.html">moc</a> will be added to
automatically invoke the <ahref="tqmoc.html">tqmoc</a> will be added to
your makefile for you.
your makefile for you.
<p><h2> Signals
<p><h2> Signals
</h2>
</h2>
@ -197,7 +197,7 @@ mechanism is totally independent of any GUI event loop. The
<p> If several slots are connected to one signal, the slots will be
<p> If several slots are connected to one signal, the slots will be
executed one after the other, in an arbitrary order, when the signal
executed one after the other, in an arbitrary order, when the signal
is emitted.
is emitted.
<p> Signals are automatically generated by the <ahref="moc.html">moc</a>
<p> Signals are automatically generated by the <ahref="tqmoc.html">tqmoc</a>
and must not be implemented in the <tt>.cpp</tt> file. They can never have
and must not be implemented in the <tt>.cpp</tt> file. They can never have
return types (i.e. use <tt>void</tt>).
return types (i.e. use <tt>void</tt>).
<p> A note about arguments. Our experience shows that signals and slots
<p> A note about arguments. Our experience shows that signals and slots
@ -254,7 +254,7 @@ the signals and slots mechanism is well worth the overhead, which your
users won't even notice.
users won't even notice.
<p><h2> Meta Object Information
<p><h2> Meta Object Information
</h2>
</h2>
<aname="4"></a><p> The <ahref="metaobjects.html#meta-object">meta object</a> compiler (<ahref="moc.html"><ahref="moc.html#moc">moc</a></a>) parses the class
<aname="4"></a><p> The <ahref="metaobjects.html#meta-object">meta object</a> compiler (<ahref="tqmoc.html"><ahref="tqmoc.html#tqmoc">tqmoc</a></a>) parses the class
declaration in a C++ file and generates C++ code that initializes the
declaration in a C++ file and generates C++ code that initializes the
meta object. The meta object contains the names of all the signal and
meta object. The meta object contains the names of all the signal and
slot members, as well as pointers to these functions. (For more
slot members, as well as pointers to these functions. (For more
@ -287,21 +287,21 @@ declarations.
</pre>
</pre>
<p> TQ_OBJECT is expanded by the preprocessor to declare several member
<p> TQ_OBJECT is expanded by the preprocessor to declare several member
functions that are implemented by the moc; if you get compiler errors
functions that are implemented by tqmoc; if you get compiler errors
along the lines of "virtual function TQButton::className not defined"
along the lines of "virtual function TQButton::className not defined"
you have probably forgotten to <ahref="moc.html">run the moc</a> or to
you have probably forgotten to <ahref="tqmoc.html">run tqmoc</a> or to
@ -80,7 +80,7 @@ property() and propertyNames() to obtain information about a class's properties.
.PP
.PP
Classes may have a list of name-value pairs of class information. The number of pairs is returned by numClassInfo(), and values are returned by classInfo().
Classes may have a list of name-value pairs of class information. The number of pairs is returned by numClassInfo(), and values are returned by classInfo().
.PP
.PP
See also moc (Meta Object Compiler) and Object Model.
See also tqmoc (Meta Object Compiler) and Object Model.
.PP
.PP
.SH MEMBER FUNCTION DOCUMENTATION
.SH MEMBER FUNCTION DOCUMENTATION
.SH "const QClassInfo * TQMetaObject::classInfo ( int index, bool super = FALSE ) const"
.SH "const QClassInfo * TQMetaObject::classInfo ( int index, bool super = FALSE ) const"
@ -209,7 +209,7 @@ TQObjects can receive events through event() and filter the events of other obje
.PP
.PP
Last but not least, TQObject provides the basic timer support in Qt; see TQTimer for high-level support for timers.
Last but not least, TQObject provides the basic timer support in Qt; see TQTimer for high-level support for timers.
.PP
.PP
Notice that the TQ_OBJECT macro is mandatory for any object that implements signals, slots or properties. You also need to run the moc program (Meta Object Compiler) on the source file. We strongly recommend the use of this macro in \fIall\fR subclasses of TQObject regardless of whether or not they actually use signals, slots and properties, since failure to do so may lead certain functions to exhibit undefined behaviour.
Notice that the TQ_OBJECT macro is mandatory for any object that implements signals, slots or properties. You also need to run the tqmoc program (Meta Object Compiler) on the source file. We strongly recommend the use of this macro in \fIall\fR subclasses of TQObject regardless of whether or not they actually use signals, slots and properties, since failure to do so may lead certain functions to exhibit undefined behaviour.
.PP
.PP
All TQt widgets inherit TQObject. The convenience function isWidgetType() returns whether an object is actually a widget. It is much faster than inherits( "TQWidget" ).
All TQt widgets inherit TQObject. The convenience function isWidgetType() returns whether an object is actually a widget. It is much faster than inherits( "TQWidget" ).