diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/designer-manual-6.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/designer-manual-6.html')
-rw-r--r-- | doc/html/designer-manual-6.html | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/doc/html/designer-manual-6.html b/doc/html/designer-manual-6.html index e6825b8ef..b07ac78a0 100644 --- a/doc/html/designer-manual-6.html +++ b/doc/html/designer-manual-6.html @@ -80,7 +80,7 @@ FORMS = settingsformbase.ui <h5><a name="1-3-2"></a>Creating the Test Harness</h5> <!-- index Forms!Creating Test Harnesses --><!-- index Creating Test Harnesses for Forms --><!-- index Subclassing --><p>Although we intend our dialog to be used within an application it is useful to create a test harness so that we can develop and test it stand-alone. Click <b>File|New</b> to invoke the 'New File' dialog, then click 'C++ Source', then click <b>OK</b>. In the editor window that pops up, enter the following code:</p> <pre> -#include <qapplication.h> +#include <ntqapplication.h> #include "creditformbase.h" int main( int argc, char *argv[] ) @@ -104,7 +104,7 @@ int main( int argc, char *argv[] ) { Q_OBJECT public: - CreditForm( <a href="qwidget.html">TQWidget</a>* parent = 0, const char* name = 0, + CreditForm( <a href="ntqwidget.html">TQWidget</a>* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~CreditForm(); public slots: @@ -113,11 +113,11 @@ int main( int argc, char *argv[] ) </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> <p>The implementation in <tt>qt/tools/designer/examples/credit/creditform.cpp</tt> is simple:</p> -<pre> #include <<a href="qradiobutton-h.html">qradiobutton.h</a>> - #include <<a href="qspinbox-h.html">qspinbox.h</a>> +<pre> #include <<a href="qradiobutton-h.html">ntqradiobutton.h</a>> + #include <<a href="qspinbox-h.html">ntqspinbox.h</a>> #include "creditform.h" - CreditForm::CreditForm( <a href="qwidget.html">TQWidget</a>* parent, const char* name, + CreditForm::CreditForm( <a href="ntqwidget.html">TQWidget</a>* parent, const char* name, bool modal, WFlags fl ) : CreditFormBase( parent, name, modal, fl ) { @@ -136,18 +136,18 @@ int main( int argc, char *argv[] ) </pre> <p>We call <tt>setAmount()</tt> in the constructor to ensure that the correct amount is shown when the form starts based on whichever radio button we checked in <em>TQt Designer</em>. In <tt>setAmount()</tt> we set the amount if the standard or none radio button is checked. If the user has checked the special radio button they are free to change the amount themselves.</p> <!-- index Makefiles --><!-- index qmake!HEADERS --><!-- index qmake!SOURCES --><p>To be able to test our subclass we change<!-- index main.cpp --> <tt>main.cpp</tt> to include <tt>creditform.h</tt> rather than <tt>creditformbase.h</tt> and change the instantiation of the creditForm object:</p> -<pre> #include <<a href="qapplication-h.html">qapplication.h</a>> +<pre> #include <<a href="qapplication-h.html">ntqapplication.h</a>> #include "creditform.h" int main( int argc, char *argv[] ) { - <a href="qapplication.html">TQApplication</a> app( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); CreditForm creditForm; - app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &creditForm ); + app.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &creditForm ); creditForm.show(); - return app.<a href="qapplication.html#exec">exec</a>(); + return app.<a href="ntqapplication.html#exec">exec</a>(); } </pre> <p>If you created the <tt>creditform.h</tt> and <tt>creditform.cpp</tt> files in <em>TQt Designer</em>, they are already in the project file, but if you created them manually you must also update the project file by adding these two new lines at the end:</p> @@ -177,18 +177,18 @@ INCLUDEPATH += $(QTDIR)/tools/designer/uilib <p>We do <em>not</em> include the <tt>creditformbase.ui</tt> file since this file will be read at runtime, as we'll see shortly. We must include the <tt>tqui</tt> library since the functionality we require is not part of the standard TQt library.</p> <h4><a name="2-2"></a>Creating main.cpp</h4> <p>The<!-- index main.cpp --> <tt>main.cpp</tt> is quite standard. It will invoke the form we're going to create in <em>TQt Designer</em> as its main form. This form will then load and execute the dynamic dialog.</p> -<pre> #include <<a href="qapplication-h.html">qapplication.h</a>> +<pre> #include <<a href="qapplication-h.html">ntqapplication.h</a>> #include "mainform.h" int main( int argc, char *argv[] ) { - <a href="qapplication.html">TQApplication</a> app( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); MainForm *mainForm = new MainForm; - app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( mainForm ); + app.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( mainForm ); mainForm->show(); - return app.<a href="qapplication.html#exec">exec</a>(); + return app.<a href="ntqapplication.html#exec">exec</a>(); } </pre> <p>We create a new instance of our MainForm class, set it to be the main widget, show it and enter the event loop in the <tt>app.exec()</tt> call.</p> @@ -200,73 +200,73 @@ INCLUDEPATH += $(QTDIR)/tools/designer/uilib <li><!-- index Signals and Slots!Connecting to Close a Dialog --><p>We'll now handle the signals and slots connections. Invoke the <em>View and Edit Connections</em> dialog and connect the credit dialog button's clicked() signal to a new creditDialog() custom slot (which is created by clicking the <b>Edit Slots...</b> button). Now connect the Quit button's<!-- index clicked() --> <tt>clicked()</tt> signal to the dialog's<!-- index accept() --> <tt>accept()</tt> function.</p> </ol><p>Save the form and call it <tt>mainform.ui</tt>. (Press <b>Ctrl+S</b> and enter the filename.) In the next section we'll write the code for loading and launching the dynamic dialog directly in <em>TQt Designer</em>.</p> <h5><a name="2-3-2"></a>Loading and Executing a Dynamic Dialog</h5> -<!-- index Dynamic Dialogs!Loading and Executing --><!-- index Dialogs!Dynamic --><!-- index Forms!Forward declarations --><!-- index Forward declarations --><!-- index Includes --><p>We'll now add the code to invoke the credit dialog. Before we can do this we need to add the widget factory's header file to the form. Click the Source tab in the Object Hierarchy. Right click Includes (in Implementation), then click <b>New</b>. Type in '<tt><qwidgetfactory.h></tt>', then press <b>Enter</b>. Because we will need to access the spin box in the dynamic dialog we must add its header file. Right click Includes (in Implmentation), then click <b>New</b>. Type in '<tt><qspinbox.h></tt>', then press <b>Enter</b>.</p> +<!-- index Dynamic Dialogs!Loading and Executing --><!-- index Dialogs!Dynamic --><!-- index Forms!Forward declarations --><!-- index Forward declarations --><!-- index Includes --><p>We'll now add the code to invoke the credit dialog. Before we can do this we need to add the widget factory's header file to the form. Click the Source tab in the Object Hierarchy. Right click Includes (in Implementation), then click <b>New</b>. Type in '<tt><ntqwidgetfactory.h></tt>', then press <b>Enter</b>. Because we will need to access the spin box in the dynamic dialog we must add its header file. Right click Includes (in Implmentation), then click <b>New</b>. Type in '<tt><ntqspinbox.h></tt>', then press <b>Enter</b>.</p> <p>In our main form we created a slot called <tt>creditDialog()</tt>. We will implement this slot directly in <em>TQt Designer</em> and use it to load and execute the dynamic dialog. The code is taken from <tt>qt/tools/designer/examples/receiver1/mainform.ui.h</tt> which contains the C++ implementation of <tt>mainform.ui</tt>'s slots.</p> <pre> void MainForm::creditDialog() { - <a href="qdialog.html">TQDialog</a> *creditForm = (TQDialog *) - TQWidgetFactory::<a href="qwidgetfactory.html#create">create</a>( "../credit/creditformbase.ui" ); + <a href="ntqdialog.html">TQDialog</a> *creditForm = (TQDialog *) + TQWidgetFactory::<a href="ntqwidgetfactory.html#create">create</a>( "../credit/creditformbase.ui" ); // Set up the dynamic dialog here - if ( creditForm-><a href="qdialog.html#exec">exec</a>() ) { + if ( creditForm-><a href="ntqdialog.html#exec">exec</a>() ) { // The user accepted, act accordingly - <a href="qspinbox.html">TQSpinBox</a> *amount = (TQSpinBox *) creditForm-><a href="qobject.html#child">child</a>( "amountSpinBox", "TQSpinBox" ); + <a href="ntqspinbox.html">TQSpinBox</a> *amount = (TQSpinBox *) creditForm-><a href="ntqobject.html#child">child</a>( "amountSpinBox", "TQSpinBox" ); if ( amount ) - ratingTextLabel->setText( amount-><a href="qspinbox.html#text">text</a>() ); + ratingTextLabel->setText( amount-><a href="ntqspinbox.html#text">text</a>() ); } delete creditForm; } </pre> - <p>The<!-- index create() --> <tt>create()</tt> function is a static <a href="qwidgetfactory.html">TQWidgetFactory</a> function. It loads the specified<!-- index .ui --> <tt>.ui</tt> file and returns a pointer to the toplevel <a href="qwidget.html">TQWidget</a> created from the<!-- index .ui --> <tt>.ui</tt> file. We have cast the pointer to <a href="qdialog.html">TQDialog</a> since we know that the <tt>creditformbase.ui</tt> file defines a <a href="qdialog.html">TQDialog</a>. After creating the dialog we<!-- index exec() --> <tt>exec()</tt> it. If the user clicked <b>OK</b> the dialog returns Accepted and we enter the body of the <tt>if</tt> statement. We want to know the amount of credit that the user selected. We call the<!-- index child() --> <tt>child()</tt> function on the dialog passing it the name of the widget we're interested in. The<!-- index child() --> <tt>child()</tt> function returns a pointer to the widget with the name we passed, or returns 0 if no widget of that name was found. In the example we call<!-- index child() --> <tt>child()</tt> to get a pointer to the 'amountSpinBox'. If the pointer we get back is not 0 we set the rating text to the amount in the dialog's spin box. At the end we delete the dynamic dialog. Deleting the dialog ensures that we free up its resources as soon as it is no longer required.</p> -<p>We used the<!-- index child() --> <tt>child()</tt> to gain access to a widget within the dynamic dialog, passing it the name of the widget we were interested in. In some situations we might not know what a widget is called. We can access the first widget of a specified class by calling<!-- index child() --> <tt>child()</tt> with a null widget name and a classname, e.g. <tt>child(0,"TQPushButton")</tt>. This will return a pointer to the first <a href="qpushbutton.html">TQPushButton</a> it finds (or 0 if there isn't one). If you want pointers to all the widgets of a given class you can call the<!-- index TQObject::queryList() --> <tt>TQObject::queryList()</tt> function, passing it the name of the class. It returns a <a href="qobjectlist.html">TQObjectList</a> pointer which points to every object in the dialog that is derived from the given class. See the online <a href="http://doc.trolltech.com/qobject.html">TQObject</a> documentation for further details.</p> + <p>The<!-- index create() --> <tt>create()</tt> function is a static <a href="ntqwidgetfactory.html">TQWidgetFactory</a> function. It loads the specified<!-- index .ui --> <tt>.ui</tt> file and returns a pointer to the toplevel <a href="ntqwidget.html">TQWidget</a> created from the<!-- index .ui --> <tt>.ui</tt> file. We have cast the pointer to <a href="ntqdialog.html">TQDialog</a> since we know that the <tt>creditformbase.ui</tt> file defines a <a href="ntqdialog.html">TQDialog</a>. After creating the dialog we<!-- index exec() --> <tt>exec()</tt> it. If the user clicked <b>OK</b> the dialog returns Accepted and we enter the body of the <tt>if</tt> statement. We want to know the amount of credit that the user selected. We call the<!-- index child() --> <tt>child()</tt> function on the dialog passing it the name of the widget we're interested in. The<!-- index child() --> <tt>child()</tt> function returns a pointer to the widget with the name we passed, or returns 0 if no widget of that name was found. In the example we call<!-- index child() --> <tt>child()</tt> to get a pointer to the 'amountSpinBox'. If the pointer we get back is not 0 we set the rating text to the amount in the dialog's spin box. At the end we delete the dynamic dialog. Deleting the dialog ensures that we free up its resources as soon as it is no longer required.</p> +<p>We used the<!-- index child() --> <tt>child()</tt> to gain access to a widget within the dynamic dialog, passing it the name of the widget we were interested in. In some situations we might not know what a widget is called. We can access the first widget of a specified class by calling<!-- index child() --> <tt>child()</tt> with a null widget name and a classname, e.g. <tt>child(0,"TQPushButton")</tt>. This will return a pointer to the first <a href="ntqpushbutton.html">TQPushButton</a> it finds (or 0 if there isn't one). If you want pointers to all the widgets of a given class you can call the<!-- index TQObject::queryList() --> <tt>TQObject::queryList()</tt> function, passing it the name of the class. It returns a <a href="ntqobjectlist.html">TQObjectList</a> pointer which points to every object in the dialog that is derived from the given class. See the online <a href="http://doc.trolltech.com/ntqobject.html">TQObject</a> documentation for further details.</p> <h5><a name="2-3-3"></a>Implementing Slots for Dynamic Dialogs</h5> -<!-- index Signals and Slots!Dynamic Dialogs --><!-- index Dynamic Dialogs --><p>There is one outstanding issue that we haven't addressed: the dynamic dialog does not have the behaviour of the original credit dialog because we have not implemented the <tt>setAmount()</tt> slot. We can implement slots for dynamic dialogs by creating a <a href="qobject.html">TQObject</a> subclass. We then create an instance of this subclass and pass a pointer to it to the<!-- index TQWidgetFactory::create() --> <tt>TQWidgetFactory::create()</tt> function which will connect the dynamic dialog's signals to the slots implemented in our subclass.</p> -<p>We need to create a <a href="qobject.html">TQObject</a> subclass and change our <tt>creditDialog()</tt> to create an instance of our subclass that can be passed to the<!-- index TQWidgetFactory::create() --> <tt>TQWidgetFactory::create()</tt> function. Here is the modified <tt>creditDialog()</tt> function from the <tt>qt/tools/designer/examples/receiver2/mainform.ui.h</tt> file that contains the code for <tt>mainform.ui</tt>'s slots:</p> +<!-- index Signals and Slots!Dynamic Dialogs --><!-- index Dynamic Dialogs --><p>There is one outstanding issue that we haven't addressed: the dynamic dialog does not have the behaviour of the original credit dialog because we have not implemented the <tt>setAmount()</tt> slot. We can implement slots for dynamic dialogs by creating a <a href="ntqobject.html">TQObject</a> subclass. We then create an instance of this subclass and pass a pointer to it to the<!-- index TQWidgetFactory::create() --> <tt>TQWidgetFactory::create()</tt> function which will connect the dynamic dialog's signals to the slots implemented in our subclass.</p> +<p>We need to create a <a href="ntqobject.html">TQObject</a> subclass and change our <tt>creditDialog()</tt> to create an instance of our subclass that can be passed to the<!-- index TQWidgetFactory::create() --> <tt>TQWidgetFactory::create()</tt> function. Here is the modified <tt>creditDialog()</tt> function from the <tt>qt/tools/designer/examples/receiver2/mainform.ui.h</tt> file that contains the code for <tt>mainform.ui</tt>'s slots:</p> <pre> void MainForm::creditDialog() { Receiver *receiver = new Receiver; - <a href="qdialog.html">TQDialog</a> *creditForm = (TQDialog *) - TQWidgetFactory::<a href="qwidgetfactory.html#create">create</a>( "../credit/creditformbase.ui", receiver ); + <a href="ntqdialog.html">TQDialog</a> *creditForm = (TQDialog *) + TQWidgetFactory::<a href="ntqwidgetfactory.html#create">create</a>( "../credit/creditformbase.ui", receiver ); receiver->setParent( creditForm ); // Set up the dynamic dialog here - if ( creditForm-><a href="qdialog.html#exec">exec</a>() ) { + if ( creditForm-><a href="ntqdialog.html#exec">exec</a>() ) { // The user accepted, act accordingly - <a href="qspinbox.html">TQSpinBox</a> *amount = (TQSpinBox *) creditForm-><a href="qobject.html#child">child</a>( "amountSpinBox", "TQSpinBox" ); + <a href="ntqspinbox.html">TQSpinBox</a> *amount = (TQSpinBox *) creditForm-><a href="ntqobject.html#child">child</a>( "amountSpinBox", "TQSpinBox" ); if ( amount ) - ratingTextLabel->setText( amount-><a href="qspinbox.html#text">text</a>() ); + ratingTextLabel->setText( amount-><a href="ntqspinbox.html#text">text</a>() ); } delete receiver; delete creditForm; } </pre> - <p>We create a new instance of our 'Receiver' subclass. (We'll write the code for this class shortly.) We then create the <a href="qdialog.html">TQDialog</a> using<!-- index TQWidgetFactory::create() --> <tt>TQWidgetFactory::create()</tt>. This call differs from our previous example because we pass in the subclass object so that the<!-- index create() --> <tt>create()</tt> function can set up the signals/slots connections automatically for us. Since our slot must access the widgets in the dynamic form we pass a pointer to the form to the receiver object through our <tt>setParent()</tt> function. The remainder of the function is the same as before except that we delete our receiver object.</p> + <p>We create a new instance of our 'Receiver' subclass. (We'll write the code for this class shortly.) We then create the <a href="ntqdialog.html">TQDialog</a> using<!-- index TQWidgetFactory::create() --> <tt>TQWidgetFactory::create()</tt>. This call differs from our previous example because we pass in the subclass object so that the<!-- index create() --> <tt>create()</tt> function can set up the signals/slots connections automatically for us. Since our slot must access the widgets in the dynamic form we pass a pointer to the form to the receiver object through our <tt>setParent()</tt> function. The remainder of the function is the same as before except that we delete our receiver object.</p> <p>Since we are using the 'Receiver' subclass in our main form we must include its header file. In <em>Object Explorer</em>'s Members tab, right click Includes (in Implmentation), then click <b>New</b>. Type in '<tt>receiver.h</tt>', then press <b>Enter</b>.</p> <!-- index Dynamic Dialogs --><p>We'll now look at the implementation of our 'Receiver' subclass. The code is taken from <tt>qt/tools/designer/examples/receiver2/receiver.h</tt> and the corresponding <tt>receiver.cpp</tt> file. We'll start with the header file.</p> -<pre>#include <<a href="qobject-h.html">qobject.h</a>> -#include <<a href="qdialog-h.html">qdialog.h</a>> +<pre>#include <<a href="qobject-h.html">ntqobject.h</a>> +#include <<a href="qdialog-h.html">ntqdialog.h</a>> -class Receiver : public <a href="qobject.html">TQObject</a> +class Receiver : public <a href="ntqobject.html">TQObject</a> { Q_OBJECT public: - void setParent( <a href="qdialog.html">TQDialog</a> *parent ); + void setParent( <a href="ntqdialog.html">TQDialog</a> *parent ); public slots: void setAmount(); private: - <a href="qdialog.html">TQDialog</a> *p; + <a href="ntqdialog.html">TQDialog</a> *p; }; </pre> -<!-- index Macros!Q_OBJECT --><!-- index Q_OBJECT!Macros --><p>Our class must be a <a href="qobject.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 <a href="qdialog.html">TQDialog</a> pointer.</p> +<!-- index Macros!Q_OBJECT --><!-- index Q_OBJECT!Macros --><p>Our class must be a <a href="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 <a href="ntqdialog.html">TQDialog</a> pointer.</p> <p>The implementation requires the header files of the classes it uses:</p> -<pre> #include <<a href="qradiobutton-h.html">qradiobutton.h</a>> - #include <<a href="qspinbox-h.html">qspinbox.h</a>> +<pre> #include <<a href="qradiobutton-h.html">ntqradiobutton.h</a>> + #include <<a href="qspinbox-h.html">ntqspinbox.h</a>> #include "receiver.h" </pre> <p>We'll discuss the implementation of each function in <tt>receiver.cpp</tt> separately.</p> -<pre> void Receiver::setParent( <a href="qdialog.html">TQDialog</a> *parent ) +<pre> void Receiver::setParent( <a href="ntqdialog.html">TQDialog</a> *parent ) { p = parent; setAmount(); @@ -275,30 +275,30 @@ private: <p>The <tt>setParent()</tt> function assigns a pointer to the dynamic dialog to our private pointer. We could not do this in a constructor call because we have to construct our Receiver object before we call<!-- index TQWidgetFactory::create() --> <tt>TQWidgetFactory::create()</tt>, since we must pass the Receiver object to the<!-- index create() --> <tt>create()</tt> function. Once we've called<!-- index create() --> <tt>create()</tt> we then have a pointer to the dynamic dialog which we can then pass via <tt>setParent()</tt> to our Receiver class. In the subclass version of this example we called <tt>setAmount()</tt> in the constructor; but we cannot do that here because the implementation of <tt>setAmount()</tt> depends on knowledge of the dynamic dialog which is not available at construction time. Because of this we call <tt>setAmount()</tt> in the <tt>setParent()</tt> function.</p> <pre> void Receiver::setAmount() { - <a href="qspinbox.html">TQSpinBox</a> *amount = + <a href="ntqspinbox.html">TQSpinBox</a> *amount = (TQSpinBox *) p->child( "amountSpinBox", "TQSpinBox" ); - <a href="qradiobutton.html">TQRadioButton</a> *radio = + <a href="ntqradiobutton.html">TQRadioButton</a> *radio = (TQRadioButton *) p->child( "stdRadioButton", "TQRadioButton" ); - if ( radio && radio-><a href="qradiobutton.html#isChecked">isChecked</a>() ) { + if ( radio && radio-><a href="ntqradiobutton.html#isChecked">isChecked</a>() ) { if ( amount ) - amount-><a href="qspinbox.html#setValue">setValue</a>( amount-><a href="qspinbox.html#maxValue">maxValue</a>() / 2 ); + amount-><a href="ntqspinbox.html#setValue">setValue</a>( amount-><a href="ntqspinbox.html#maxValue">maxValue</a>() / 2 ); return; } radio = (TQRadioButton *) p->child( "noneRadioButton", "TQRadioButton" ); - if ( radio && radio-><a href="qradiobutton.html#isChecked">isChecked</a>() ) + if ( radio && radio-><a href="ntqradiobutton.html#isChecked">isChecked</a>() ) if ( amount ) - amount-><a href="qspinbox.html#setValue">setValue</a>( amount-><a href="qspinbox.html#minValue">minValue</a>() ); + amount-><a href="ntqspinbox.html#setValue">setValue</a>( amount-><a href="ntqspinbox.html#minValue">minValue</a>() ); } </pre> <p>Since we may be updating the amount spin box we need to get a pointer to it. We call<!-- index child() --> <tt>child()</tt> on the pointer <tt>p</tt> which points to the dynamic dialog assigned in the <tt>setParent()</tt> call. We cast the resulting pointer to the correct type so that we can call any functions relevant to that type. In the example we call<!-- index child() --> <tt>child()</tt> to get a pointer to the amount spin box, and then call<!-- index child() --> <tt>child()</tt> again to get a pointer to the 'stdRadioButton'. If we get a pointer to the radio button and the button is checked we set the amount providing we have a pointer to the amount spin box. If this radio button was checked we're finished so we return. If the 'stdRadioButton' isn't checked we get a pointer to the 'noneRadioButton' and set the amount if this button is checked. We do nothing if the 'specialRadioButton' is checked because the user is free to enter a value of their choice.</p> <blockquote> <p align="center"><b> Compiling vs Dynamically Loading Dialogs</b></p> <!-- index Dynamic Dialogs!Compared with Compiling --><!-- index Dynamic Dialogs!Subclassing --><!-- index Subclassing!Dynamic Dialogs --><p>The differences between using a 'compiled in'<!-- index .ui --> <tt>.ui</tt> file and a dynamically loaded<!-- index .ui --> <tt>.ui</tt> file are these:</p> -<ul><li><p>Dynamic dialogs cannot have any C++ code in the<!-- index .ui --> <tt>.ui</tt> file; any custom slots must be implemented via a <a href="qobject.html">TQObject</a> subclass. Compiled dialogs can contain code either in the<!-- index .ui --> <tt>.ui</tt> file or in a subclass.</p> -<li><p>Dynamic dialogs will load slower because the<!-- index .ui --> <tt>.ui</tt> file must be read and a <a href="qwidget.html">TQWidget</a> instance instantiated based on the<!-- index .ui --> <tt>.ui</tt> file's parse tree. Compiled code will load much faster because no file reading or parsing is necessary. Note that the user may not notice any difference in speed since the difference may be mere fractions of a second.</p> +<ul><li><p>Dynamic dialogs cannot have any C++ code in the<!-- index .ui --> <tt>.ui</tt> file; any custom slots must be implemented via a <a href="ntqobject.html">TQObject</a> subclass. Compiled dialogs can contain code either in the<!-- index .ui --> <tt>.ui</tt> file or in a subclass.</p> +<li><p>Dynamic dialogs will load slower because the<!-- index .ui --> <tt>.ui</tt> file must be read and a <a href="ntqwidget.html">TQWidget</a> instance instantiated based on the<!-- index .ui --> <tt>.ui</tt> file's parse tree. Compiled code will load much faster because no file reading or parsing is necessary. Note that the user may not notice any difference in speed since the difference may be mere fractions of a second.</p> <li><p>Dynamic dialogs allow you to change the<!-- index .ui --> <tt>.ui</tt> file independently of the code so long as none of the changes impact the code. This means that you can change the appearance of the form, e.g. move widgets and lay them out differently. If you want to change a compiled dialog you must change the<!-- index .ui --> <tt>.ui</tt> file and recompile. If you are building an application and want your customers to be able to customize aspects of the user interface you can give them a copy of <em>TQt Designer</em> (if your license permits this) and use dynamic dialogs.</p> </ul></blockquote> <!-- eof --> |