<!-- 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>
<p>Suppose, for example, that we are developing a dialog and writing the code directly in <em>TQt Designer</em>. We might call our dialog 'OptionsForm' and the<!-- index .ui --><tt>.ui</tt> file, <tt>optionsform.ui</tt>. The automatically generated files will be <tt>optionsform.h</tt> and <tt>optionsform.cpp</tt>.</p>
<p>If we were developing another dialog, but this time one that we intended to subclass, we want to make it easy to distinguish between the automatically generated files and our hand coded files. For example, we might call our dialog 'SettingsFormBase' and the<!-- index .ui --><tt>.ui</tt> file <tt>settingsformbase.ui</tt>. The automatically generated files would then be called <tt>settingsformbase.h</tt> and <tt>settingsformbase.cpp</tt>. We would then call our subclass 'SettingsForm' and code it in the files <tt>settingsform.h</tt> and <tt>settingsform.cpp</tt>.</p>
<!-- index Q_OBJECT!Macros --><!-- index Macros!Q_OBJECT --><!-- index Signals and Slots!Q_OBJECT --><p>Any subclass of a form should include the <tt>Q_OBJECT</tt> macro so that slots and signals will work correctly. Once you've created your subclass be sure to add the<!-- index .h --><tt>.h</tt> and the<!-- index .cpp --><tt>.cpp</tt> files to the<!-- index .pro --><tt>.pro</tt> project file. For example we would add the following lines for our subclassed 'SettingsForm' at the end of the<!-- index .pro --><tt>.pro</tt> file:</p>
<!-- index TQ_OBJECT!Macros --><!-- index Macros!TQ_OBJECT --><!-- index Signals and Slots!TQ_OBJECT --><p>Any subclass of a form should include the <tt>TQ_OBJECT</tt> macro so that slots and signals will work correctly. Once you've created your subclass be sure to add the<!-- index .h --><tt>.h</tt> and the<!-- index .cpp --><tt>.cpp</tt> files to the<!-- index .pro --><tt>.pro</tt> project file. For example we would add the following lines for our subclassed 'SettingsForm' at the end of the<!-- index .pro --><tt>.pro</tt> file:</p>
<pre>
HEADERS += settingsform.h
SOURCES += settingsform.cpp
@ -102,7 +102,7 @@ int main( int argc, char *argv[] )
class CreditForm : public CreditFormBase
{
Q_OBJECT
TQ_OBJECT
public:
CreditForm( <ahref="ntqwidget.html">TQWidget</a>* parent = 0, const char* name = 0,
bool modal = FALSE, WFlags fl = 0 );
@ -111,7 +111,7 @@ int main( int argc, char *argv[] )
void setAmount();
};
</pre>
<!-- index Macros!Q_OBJECT --><!-- index Q_OBJECT --><p>We've declared the slot, <tt>setAmount()</tt>, that we created in <em>TQt Designer</em>. The <tt>Q_OBJECT</tt> macro is included because it is essential for classes that use signals and slots.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT --><p>We've declared the slot, <tt>setAmount()</tt>, that we created in <em>TQt Designer</em>. The <tt>TQ_OBJECT</tt> macro is included because it is essential for classes that use signals and slots.</p>
<p>The implementation in <tt>qt/tools/designer/examples/credit/creditform.cpp</tt> is simple:</p>
<!-- index Macros!Q_OBJECT --><!-- index Q_OBJECT!Macros --><p>Our class must be a <ahref="ntqobject.html">TQObject</a> subclass and because we're using signals and slots it must include the <tt>Q_OBJECT</tt> macro. We declare a function and the <tt>setAmount()</tt> slot that we wish to implement as well as a private <ahref="ntqdialog.html">TQDialog</a> pointer.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT!Macros --><p>Our class must be a <ahref="ntqobject.html">TQObject</a> subclass and because we're using signals and slots it must include the <tt>TQ_OBJECT</tt> macro. We declare a function and the <tt>setAmount()</tt> slot that we wish to implement as well as a private <ahref="ntqdialog.html">TQDialog</a> pointer.</p>
<p>The implementation requires the header files of the classes it uses:</p>
<!-- index Macros!Q_OBJECT --><!-- index Q_OBJECT --><p>We include <tt>ntqwidget.h</tt> since we'll be deriving our custom widget from <ahref="ntqwidget.html">TQWidget</a>. We declare a constructor where the widget will be created and the four signals we want our widget to emit.</p>
<p><b>Note:</b> Since we're using signals we must also include the <tt>Q_OBJECT</tt> macro. This macro also ensures that information about the class is available via the <ahref="metaobjects.html">Meta Object System</a> and ensures that <em>TQt Designer</em> will display the correct information about the widget.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT --><p>We include <tt>ntqwidget.h</tt> since we'll be deriving our custom widget from <ahref="ntqwidget.html">TQWidget</a>. We declare a constructor where the widget will be created and the four signals we want our widget to emit.</p>
<p><b>Note:</b> Since we're using signals we must also include the <tt>TQ_OBJECT</tt> macro. This macro also ensures that information about the class is available via the <ahref="metaobjects.html">Meta Object System</a> and ensures that <em>TQt Designer</em> will display the correct information about the widget.</p>
<p>The implementation is straightforward. The only function we implement is the constructor. The rest of the file consists of include statements and embedded<!-- index .xpm --><tt>.xpm</tt> images.</p>
: <ahref="ntqwidget.html">TQWidget</a>( parent, name )
@ -128,10 +128,10 @@ DBFILE = vcr.db
</pre>
<p>Our widget will be derived from <ahref="ntqwidget.html">TQWidget</a> so we include the <tt>ntqwidget.h</tt> header file. We also forward declare the two classes that our widget will be built from.</p>
<pre></pre>
<!-- index Macros!Q_OBJECT --><!-- index Q_OBJECT --><!-- index Macros!Q_ENUMS --><!-- index Q_ENUMS --><p>We include the <tt>Q_OBJECT</tt> macro since this is required for classes that declare signals or slots. The <tt>Q_ENUMS</tt> declaration is used to register the Mode enumeration. Our widget has two properties, mode, to store whether the user should select a File or a Directory and fileName which stores the file or directory they chose.</p>
<!-- index Macros!TQ_OBJECT --><!-- index TQ_OBJECT --><!-- index Macros!Q_ENUMS --><!-- index Q_ENUMS --><p>We include the <tt>TQ_OBJECT</tt> macro since this is required for classes that declare signals or slots. The <tt>Q_ENUMS</tt> declaration is used to register the Mode enumeration. Our widget has two properties, mode, to store whether the user should select a File or a Directory and fileName which stores the file or directory they chose.</p>
<pre> class QT_WIDGET_PLUGIN_EXPORT FileChooser : public <ahref="ntqwidget.html">TQWidget</a>
<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>
</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!Q_OBJECT --><!-- index Q_OBJECT --><p>If you create a<!-- index .cpp --><tt>.cpp</tt> file which contains the <tt>Q_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>Q_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 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>
<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>
<!-- 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!Q_OBJECT --><!-- index Q_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="ntqobject.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>Q_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="ntqobject.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>
<p>Processing<!-- index .ui --><tt>.ui</tt> files with <tt>uic</tt> is done <em>twice</em>:</p>
@ -153,8 +153,8 @@ sets any other settings needed to use TQt in that project.
<aname="3-7"></a><p> The 'Add MOC' 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
files to the project. All you need to do to use it is click on a file that
has <ahref="metaobjects.html#Q_OBJECT">Q_OBJECT</a> and click the button.
<p> You only need to use this button if you added a file that has <ahref="metaobjects.html#Q_OBJECT">Q_OBJECT</a> in it by hand, you don't need to use this if you used any
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
of the previously mentioned buttons. It can also be invoked by using
the Ctrl+Shift+M key combination in Visual Studio.
button = new TQPushButton( tr("&Quit"), this);
</pre>
<!-- index Q_OBJECT --><p>All <ahref="ntqobject.html">TQObject</a> subclasses that use the <tt>Q_OBJECT</tt> macro implement the <tt>tr()</tt> function.</p>
<!-- index TQ_OBJECT --><p>All <ahref="ntqobject.html">TQObject</a> subclasses that use the <tt>TQ_OBJECT</tt> macro implement the <tt>tr()</tt> function.</p>
<p>Although the <tt>tr()</tt> call is normally made directly since it is usually called as a member function of a <ahref="ntqobject.html">TQObject</a> subclass, in other cases an explicit class name can be supplied, for example:</p>
<pre>
TQPushButton::tr("&Quit")
@ -315,7 +315,7 @@ TRANSLATIONS = tt2_fr.ts \
<!-- index ArrowPad!in Translation Tutorial --><!-- index English Language --><p>In <tt>arrowpad.h</tt> we define the <tt>ArrowPad</tt> subclass which is a subclass of <ahref="ntqwidget.html">TQWidget</a>. In the <em>Tutorial 2 Screenshot, English version</em>, above, the central widget with the four buttons is an <tt>ArrowPad</tt>.</p>
<pre> class ArrowPad : public <ahref="ntqgrid.html">TQGrid</a>
</pre>
<!-- index Q_OBJECT --><!-- index tr() --><!-- index TQObject!tr() --><!-- index Translation Contexts --><!-- index Contexts!for Translation --><p>When <ahref="linguist-manual-2.html#2">lupdate</a> is run it not only extracts the source texts but it also groups them into contexts. A context is the name of the class in which the source text appears. Thus, in this example, "ArrowPad" is a context: it is the context of the texts in the <tt>ArrowPad</tt> class. The <tt>Q_OBJECT</tt> macro defines <tt>tr(x)</tt> in <tt>ArrowPad</tt> like this</p>
<!-- index TQ_OBJECT --><!-- index tr() --><!-- index TQObject!tr() --><!-- index Translation Contexts --><!-- index Contexts!for Translation --><p>When <ahref="linguist-manual-2.html#2">lupdate</a> is run it not only extracts the source texts but it also groups them into contexts. A context is the name of the class in which the source text appears. Thus, in this example, "ArrowPad" is a context: it is the context of the texts in the <tt>ArrowPad</tt> class. The <tt>TQ_OBJECT</tt> macro defines <tt>tr(x)</tt> in <tt>ArrowPad</tt> like this</p>
<!-- index TQApplication!translate() --><!-- index translate()!TQApplication --><pre>
<blockquote><palign="center"><em>Tutorial 2 Screenshot, English version</em></p></blockquote>
<!-- index Q_OBJECT --><!-- index MainWindow!in Translation Tutorial --><pre> class MainWindow : public <ahref="ntqmainwindow.html">TQMainWindow</a>
<!-- index TQ_OBJECT --><!-- index MainWindow!in Translation Tutorial --><pre> class MainWindow : public <ahref="ntqmainwindow.html">TQMainWindow</a>
{
Q_OBJECT
TQ_OBJECT
</pre>
<p>In the <em>Tutorial 2 Screenshot, English version</em>, above, the whole window is a <tt>MainWindow</tt>. This is defined in the <tt>mainwindow.h</tt> header file. Here too, we use <tt>Q_OBJECT</tt>, so that <tt>MainWindow</tt> will become a context in <em>TQt Linguist</em>.</p>
<p>In the <em>Tutorial 2 Screenshot, English version</em>, above, the whole window is a <tt>MainWindow</tt>. This is defined in the <tt>mainwindow.h</tt> header file. Here too, we use <tt>TQ_OBJECT</tt>, so that <tt>MainWindow</tt> will become a context in <em>TQt Linguist</em>.</p>
<p>In the implementation of <tt>MainWindow</tt>, <tt>mainwindow.cpp</tt>, we create an instance of our <tt>ArrowPad</tt> class</p>
<pre> ArrowPad *ap = new ArrowPad( this, "arrow pad" );
</pre>
@ -426,9 +426,9 @@ TRANSLATIONS = tt3_pt.ts
<p>The PrintPanel is defined in <tt>printpanel.h</tt>.</p>
<pre> class PrintPanel : public <ahref="ntqvbox.html">TQVBox</a>
{
Q_OBJECT
TQ_OBJECT
</pre>
<!-- index Q_OBJECT --><!-- index PrintPanel!in Translation Tutorial --><p>PrintPanel is a <ahref="ntqwidget.html">TQWidget</a>. It needs the <tt>Q_OBJECT</tt> macro for <tt>tr()</tt> to work properly.</p>
<!-- index TQ_OBJECT --><!-- index PrintPanel!in Translation Tutorial --><p>PrintPanel is a <ahref="ntqwidget.html">TQWidget</a>. It needs the <tt>TQ_OBJECT</tt> macro for <tt>tr()</tt> to work properly.</p>
<p>The implementation file is <tt>printpanel.cpp</tt>.</p>
<pre> /*
<ahref="ntqlabel.html">TQLabel</a> *lab = new <ahref="ntqlabel.html">TQLabel</a>( <ahref="ntqobject.html#tr">tr</a>("<b>TROLL PRINT</b>"), this );
@ -147,7 +147,7 @@ details. A convenience handler, <a href="#childEvent">childEvent</a>(), can be r
to catch child events.
<p> Last but not least, TQObject provides the basic timer support in
TQt; see <ahref="ntqtimer.html">TQTimer</a> for high-level support for timers.
<p> Notice that the <ahref="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro is mandatory for any object that
<p> Notice that the <ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> macro is mandatory for any object that
implements signals, slots or properties. You also need to run the
<ahref="moc.html">moc program (Meta Object Compiler)</a> on the
source file. We strongly recommend the use of this macro in <em>all</em>
@ -270,7 +270,7 @@ in the list.
<p> This function is generated by the <ahref="metaobjects.html">Meta
Object Compiler.</a>
<p><b>Warning:</b> This function will return the wrong name if the class
definition lacks the <ahref="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro.
definition lacks the <ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> macro.
<p><p>See also <ahref="#name-prop">name</a>, <ahref="#inherits">inherits</a>(), <ahref="#isA">isA</a>(), and <ahref="#isWidgetType">isWidgetType</a>().
</pre>The class declaration includes the Q_OBJECT macro to activate TQt's <ahref="metaobjects.html#meta-object">meta object</a> system, and sets COM identifiers for the class using the
</pre>The class declaration includes the TQ_OBJECT macro to activate TQt's <ahref="metaobjects.html#meta-object">meta object</a> system, and sets COM identifiers for the class using the
@ -92,7 +92,7 @@ to render OpenGL, and from <a href="qaxbindable.html">TQAxBindable</a>.
class GLBox : public <ahref="qglwidget.html">TQGLWidget</a>,
public TQAxBindable
{
<ahref="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
<ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a>
</pre>The class reimplements the <ahref="qaxbindable.html#createAggregate">TQAxBindable::createAggregate</a>() function from <ahref="qaxbindable.html">TQAxBindable</a>
to return the pointer to a <ahref="qaxaggregated.html">TQAxAggregated</a> object.
@ -383,10 +383,10 @@ or any existing TQWidget subclass:
class MyActiveX : public <ahref="ntqwidget.html">TQWidget</a>
{
<ahref="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
<ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a>
</pre>
<p> The <ahref="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro is required to provide the <ahref="metaobjects.html#meta-object">meta object</a> information
<p> The <ahref="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> macro is required to provide the <ahref="metaobjects.html#meta-object">meta object</a> information
about the widget to the ActiveTQt framework.
Use the <tt>Q_PROPERTY</tt> macro to declare properties for the ActiveX control:
<p><pre>
@ -618,7 +618,7 @@ inheritance from the <a href="qaxbindable.html">TQAxBindable</a> class:
class MyActiveX : public <ahref="ntqwidget.html">TQWidget</a><b>, public TQAxBindable</b>
{
Q_OBJECT
TQ_OBJECT
</pre>
When implementing the property write functions, use the
@ -914,7 +914,7 @@ Office applications.
<pre>
class MyActiveX : public <ahref="ntqwidget.html">TQWidget</a>
<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 Q_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 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 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>
@ -510,7 +510,7 @@ app {
<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>
<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 Q_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 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>
<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>
double rad = atan(((double)<ahref="ntqwidget.html#rect">rect</a>().bottom()-pnt.<ahref="ntqpoint.html#y">y</a>())/pnt.<ahref="ntqpoint.html#x">x</a>());
double rad = atan(((double)<ahref="ntqwidget.html#rect">rect</a>().bottom()-pnt.<ahref="ntqpoint.html#y">y</a>())/pnt.<ahref="ntqpoint.html#x">x</a>());
setAngle( qRound ( rad*180/3.14159265 ) );
setAngle( tqRound ( rad*180/3.14159265 ) );
}
</pre>
<p> This is another TQt event handler. It is called when the user already
.BI "QtMsgHandler \fBqInstallMsgHandler\fR ( QtMsgHandler h )"
@ -1705,7 +1705,7 @@ If \fCb\fR is zero, the Q_ASSERT statement will output the following message usi
.fi
.PP
See also qWarning() and Debugging.
.SH "void Q_CHECK_PTR ( void * p )"
.SH "void TQ_CHECK_PTR ( void * p )"
If \fIp\fR is 0, prints a warning message containing the source code file name and line number, saying that the program ran out of memory.
.PP
This is really a macro defined in ntqglobal.h.
@ -1717,12 +1717,12 @@ Example:
int *a;
.br
.br
Q_CHECK_PTR( a = new int[80] ); // WRONG!
TQ_CHECK_PTR( a = new int[80] ); // WRONG!
.br
.br
a = new (nothrow) int[80]; // Right
.br
Q_CHECK_PTR( a );
TQ_CHECK_PTR( a );
.br
.fi
.PP
@ -1934,7 +1934,7 @@ This function does nothing when Qt is built with \fCQT_NO_DEBUG\fR defined.
.SH "const char * qVersion ()"
Returns the Qt version number as a string, for example, "2.3.0" or" 3.0.5".
.PP
The \fCQT_VERSION\fR define has the numeric value in the form: 0xmmiibb (m = major, i = minor, b = bugfix). For example, Qt 3.0.5's \fCQT_VERSION\fR is 0x030005.
The \fCTQT_VERSION\fR define has the numeric value in the form: 0xmmiibb (m = major, i = minor, b = bugfix). For example, Qt 3.0.5's \fCTQT_VERSION\fR is 0x030005.
.SH "void qWarning ( const char * msg, ... )"
Prints a warning message \fImsg\fR, or calls the message handler (if it has been installed).
@ -53,7 +53,7 @@ A QAxObject can be instantiated as an empty object, with the name of the COM obj
.PP
QAxObject is a QObject and can be used as such, e.g. it can be organized in an object hierarchy, receive events and connect to signals and slots.
.PP
\fBWarning:\fR You can subclass QAxObject, but you cannot use the Q_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxObject as a member of the QObject subclass.
\fBWarning:\fR You can subclass QAxObject, but you cannot use the TQ_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxObject as a member of the QObject subclass.
@ -60,7 +60,7 @@ A QAxWidget can be instantiated as an empty object, with the name of the ActiveX
.PP
QAxWidget is a QWidget and can be used as such, e.g. it can be organized in a widget hierarchy, receive events or act as an event filter. Standard widget properties, e.g. enabled are supported, but it depends on the ActiveX control to implement support for ambient properties like e.g. palette or font. QAxWidget tries to provide the necessary hints.
.PP
\fBWarning:\fR You can subclass QAxWidget, but you cannot use the Q_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxWidget as a member of the QObject subclass.
\fBWarning:\fR You can subclass QAxWidget, but you cannot use the TQ_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxWidget as a member of the QObject subclass.
.PP
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QAxWidget::QAxWidget ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
@ -209,7 +209,7 @@ QObjects can receive events through event() and filter the events of other objec
.PP
Last but not least, QObject provides the basic timer support in Qt; see QTimer for high-level support for timers.
.PP
Notice that the Q_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 QObject 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 moc program (Meta Object Compiler) on the source file. We strongly recommend the use of this macro in \fIall\fR subclasses of QObject 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
All Qt widgets inherit QObject. The convenience function isWidgetType() returns whether an object is actually a widget. It is much faster than inherits( "QWidget" ).
.PP
@ -290,7 +290,7 @@ Returns the class name of this object.
.PP
This function is generated by the Meta Object Compiler.
.PP
\fBWarning:\fR This function will return the wrong name if the class definition lacks the Q_OBJECT macro.
\fBWarning:\fR This function will return the wrong name if the class definition lacks the TQ_OBJECT macro.
.PP
See also name, inherits(), isA(), and isWidgetType().
.PP
@ -322,7 +322,7 @@ A signal can also be connected to another signal:
.br
{
.br
Q_OBJECT
TQ_OBJECT
.br
public:
.br
@ -741,7 +741,7 @@ See also timerEvent(), startTimer(), and killTimer().
Returns a pointer to the meta object of this object.
.PP
A meta object contains information about a class that inherits QObject, e.g. class name, superclass name, properties, signals and slots. Every class that contains the Q_OBJECT macro will also have a meta object.
A meta object contains information about a class that inherits QObject, e.g. class name, superclass name, properties, signals and slots. Every class that contains the TQ_OBJECT macro will also have a meta object.
.PP
The meta object information is required by the signal/slot connection mechanism and the property system. The functions isA() and inherits() also make use of the meta object.
.SH "const char * QObject::name () const"
@ -870,7 +870,7 @@ Example:
.br
{
.br
Q_OBJECT
TQ_OBJECT
.br
public:
.br
@ -924,7 +924,7 @@ See also startTimer(), killTimer(), killTimers(), and event().
Examples:
.)l biff/biff.cpp, dclock/dclock.cpp, forever/forever.cpp, grapher/grapher.cpp, qmag/qmag.cpp, and xform/xform.cpp.
Returns a translated version of \fIsourceText\fR, or \fIsourceText\fR itself if there is no appropriate translated version. The translation context is QObject with \fIcomment\fR (0 by default). All QObject subclasses using the Q_OBJECT macro automatically have a reimplementation of this function with the subclass name as context.
Returns a translated version of \fIsourceText\fR, or \fIsourceText\fR itself if there is no appropriate translated version. The translation context is QObject with \fIcomment\fR (0 by default). All QObject subclasses using the TQ_OBJECT macro automatically have a reimplementation of this function with the subclass name as context.
.PP
\fBWarning:\fR This method is reentrant only if all translators are installed \fIbefore\fR calling this method. Installing or removing translators while performing translations is not supported. Doing so will probably result in crashes or other undesirable behavior.
@ -333,7 +333,7 @@ Notice that the latest changes to Mary's salary did not affect the value in the
.PP
There are several ways to find items in the list. The begin() and end() functions return iterators to the beginning and end of the list. The advantage of getting an iterator is that you can move forward or backward from this position by incrementing/decrementing the iterator. The iterator returned by end() points to the item which is one \fIpast\fR the last item in the container. The past-the-end iterator is still associated with the list it belongs to, however it is \fInot\fR dereferenceable; operator*() will not return a well-defined value. If the list is empty(), the iterator returned by begin() will equal the iterator returned by end().
.PP
Another way to find an item in the list is by using the qFind() algorithm. For example:
Another way to find an item in the list is by using the tqFind() algorithm. For example:
.PP
.nf
.br
@ -341,7 +341,7 @@ Another way to find an item in the list is by using the qFind() algorithm. For e
.br
...
.br
QValueList<int>::iterator it = qFind( list.begin(), list.end(), 3 );
QValueList<int>::iterator it = tqFind( list.begin(), list.end(), 3 );
@ -337,7 +337,7 @@ Whenever inserting, removing or referencing elements in a vector, always make su
.PP
The iterators provided by vector are random access iterators, therefore you can use them with many generic algorithms, for example, algorithms provided by the STL or the QTL.
.PP
Another way to find an element in the vector is by using the std::find() or qFind() algorithms. For example:
Another way to find an element in the vector is by using the std::find() or tqFind() algorithms. For example:
.PP
.nf
.br
@ -345,7 +345,7 @@ Another way to find an element in the vector is by using the std::find() or qFin
.br
...
.br
QValueVector<int>::const_iterator it = qFind( vec.begin(), vec.end(), 3 );
QValueVector<int>::const_iterator it = tqFind( vec.begin(), vec.end(), 3 );